Skip to content

Commit

Permalink
v3.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Feb 15, 2025
1 parent b263cb4 commit 3dfdc1f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions changelogs/3.3.4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bug fixes and performance improvements
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mytonwallet",
"version": "3.3.3",
"version": "3.3.4",
"description": "The most feature-rich web wallet and browser extension for TON – with support of multi-accounts, tokens (jettons), NFT, TON DNS, TON Sites, TON Proxy, and TON Magic.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.3
3.3.4
9 changes: 5 additions & 4 deletions src/components/swap/SwapInitial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function SwapInitial({
(amountInBigint ?? 0n) > 0n
&& (amountOutBigint ?? 0n) > 0n
&& isEnoughBalance
&& (!explainedFee.isGasless || dieselStatus === 'available')
&& (!explainedFee.isGasless || dieselStatus === 'available' || dieselStatus === 'stars-fee')
&& !isEstimating
&& errorType === undefined
);
Expand All @@ -204,7 +204,8 @@ function SwapInitial({
: amountOut?.toString();
const isAmountGreaterThanBalance = balanceIn !== undefined && amountInBigint !== undefined
&& amountInBigint > balanceIn;
const isInsufficientFee = isEnoughBalance === false && !isAmountGreaterThanBalance;
const hasInsufficientFeeError = isEnoughBalance === false && !isAmountGreaterThanBalance
&& dieselStatus !== 'not-authorized' && dieselStatus !== 'pending-previous';

const isPriceImpactError = priceImpact >= MAX_PRICE_IMPACT_VALUE;
const isCrosschain = swapType === SwapType.CrosschainFromWallet || swapType === SwapType.CrosschainToWallet;
Expand Down Expand Up @@ -359,7 +360,7 @@ function SwapInitial({
let precision: FeePrecision = 'exact';

if (shouldShow) {
const actualFee = isInsufficientFee ? explainedFee.fullFee : explainedFee.realFee;
const actualFee = hasInsufficientFeeError ? explainedFee.fullFee : undefined;
if (actualFee) {
({ terms, precision } = actualFee);
}
Expand Down Expand Up @@ -521,7 +522,7 @@ function SwapInitial({
isOpen={currentSubModal === 'settings'}
onClose={closeSubModal}
onNetworkFeeClick={openFeeModal}
showFullNetworkFee={isInsufficientFee}
showFullNetworkFee={hasInsufficientFeeError}
/>
<FeeDetailsModal
isOpen={currentSubModal === 'feeDetails'}
Expand Down
17 changes: 11 additions & 6 deletions src/components/transfer/TransferInitial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,21 @@ function TransferInitial({
const hasToAddressError = toAddress.length > 0 && !isAddressValid;
const isAmountGreaterThanBalance = !isNftTransfer && balance !== undefined && amount !== undefined
&& amount > balance;
const isInsufficientFee = isEnoughBalance === false && !isAmountGreaterThanBalance;
const hasInsufficientFeeError = isEnoughBalance === false && !isAmountGreaterThanBalance
&& diesel?.status !== 'not-authorized' && diesel?.status !== 'pending-previous';
const hasAmountError = !isNftTransfer && amount !== undefined && (
(maxAmount !== undefined && amount > maxAmount)
|| isInsufficientFee // Ideally, the insufficient fee error message should be displayed somewhere else
|| hasInsufficientFeeError // Ideally, the insufficient fee error message should be displayed somewhere else
);
const isCommentRequired = Boolean(toAddress) && isMemoRequired;
const hasCommentError = isCommentRequired && !comment;

const canSubmit = isDieselNotAuthorized || Boolean(
isAddressValid && !isAmountMissing && !hasAmountError && isEnoughBalance && !hasCommentError
isAddressValid
&& !isAmountMissing && !hasAmountError
&& isEnoughBalance
&& !hasCommentError
&& (!explainedFee.isGasless || diesel?.status === 'available' || diesel?.status === 'stars-fee')
&& !(isNftTransfer && !nfts?.length),
);

Expand Down Expand Up @@ -636,7 +641,7 @@ function TransferInitial({
if (isAmountGreaterThanBalance) {
transitionKey = 1;
content = <span className={styles.balanceError}>{lang('Insufficient balance')}</span>;
} else if (isInsufficientFee) {
} else if (hasInsufficientFeeError) {
transitionKey = 2;
content = <span className={styles.balanceError}>{lang('Insufficient fee')}</span>;
}
Expand Down Expand Up @@ -805,7 +810,7 @@ function TransferInitial({
if (diesel?.status === 'not-authorized') {
return lang('Authorize %token% Fee', { token: symbol! });
}
if (diesel?.status === 'pending-previous' && isInsufficientFee) {
if (diesel?.status === 'pending-previous') {
return lang('Awaiting Previous Fee');
}
return lang('$send_token_symbol', isNftTransfer ? 'NFT' : symbol || 'TON');
Expand All @@ -818,7 +823,7 @@ function TransferInitial({
let precision: FeePrecision = 'exact';

if (!isAmountMissing) {
const actualFee = isInsufficientFee ? explainedFee.fullFee : explainedFee.realFee;
const actualFee = hasInsufficientFeeError ? explainedFee.fullFee : explainedFee.realFee;
if (actualFee) {
({ terms, precision } = actualFee);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/ui/PinPad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function PinPad({

useEffect(() => {
return () => {
// Don't trust this effect 100%, because it won't give the desired result when PinPad unmounts after the NBS closing
clearIsPinAccepted();
};
}, []);
Expand Down
6 changes: 6 additions & 0 deletions src/global/actions/api/dapps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ addActionHandler('submitDappConnectRequestConfirm', async (global, actions, { pa
});

global = getGlobal();
if (IS_CAPACITOR) {
global = clearIsPinAccepted(global);
}
global = clearDappConnectRequest(global);
setGlobal(global);

Expand Down Expand Up @@ -208,6 +211,9 @@ addActionHandler('submitDappTransferPassword', async (global, actions, { passwor
void callApi('confirmDappRequest', promiseId, password);

global = getGlobal();
if (IS_CAPACITOR) {
global = clearIsPinAccepted(global);
}
global = clearCurrentDappTransfer(global);
setGlobal(global);
});
Expand Down
5 changes: 3 additions & 2 deletions src/global/actions/api/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ addActionHandler('updatePendingSwaps', async (global) => {
});

addActionHandler('setSwapDex', (global, actions, { dexLabel }) => {
const { estimates } = global.currentSwap;
const { estimates, bestRateDexLabel } = global.currentSwap;
const newEstimate = (estimates || []).find((estimate) => estimate.dexLabel === dexLabel);
if (!newEstimate) return;

Expand All @@ -899,7 +899,8 @@ addActionHandler('setSwapDex', (global, actions, { dexLabel }) => {
dieselFee: newEstimate.dieselFee,
priceImpact: newEstimate.impact,
currentDexLabel: dexLabel,
isDexLabelChanged: true,
// The "Best Rate" selection should enable automatic best dex selection mode
isDexLabelChanged: dexLabel !== bestRateDexLabel ? true : undefined,
}, true);
setGlobal(global);
});
Expand Down

0 comments on commit 3dfdc1f

Please sign in to comment.