diff --git a/changelogs/3.3.4.txt b/changelogs/3.3.4.txt new file mode 100644 index 00000000..619f4cd5 --- /dev/null +++ b/changelogs/3.3.4.txt @@ -0,0 +1 @@ +Bug fixes and performance improvements diff --git a/package-lock.json b/package-lock.json index d4e4a4d8..4993fc58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mytonwallet", - "version": "3.3.3", + "version": "3.3.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mytonwallet", - "version": "3.3.3", + "version": "3.3.4", "license": "GPL-3.0-or-later", "dependencies": { "@awesome-cordova-plugins/core": "6.9.0", diff --git a/package.json b/package.json index 5cab53be..e7e12013 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/public/version.txt b/public/version.txt index 619b5376..a0891f56 100644 --- a/public/version.txt +++ b/public/version.txt @@ -1 +1 @@ -3.3.3 +3.3.4 diff --git a/src/components/swap/SwapInitial.tsx b/src/components/swap/SwapInitial.tsx index ae5f6687..4ea74e53 100644 --- a/src/components/swap/SwapInitial.tsx +++ b/src/components/swap/SwapInitial.tsx @@ -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 ); @@ -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; @@ -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); } @@ -521,7 +522,7 @@ function SwapInitial({ isOpen={currentSubModal === 'settings'} onClose={closeSubModal} onNetworkFeeClick={openFeeModal} - showFullNetworkFee={isInsufficientFee} + showFullNetworkFee={hasInsufficientFeeError} /> 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), ); @@ -636,7 +641,7 @@ function TransferInitial({ if (isAmountGreaterThanBalance) { transitionKey = 1; content = {lang('Insufficient balance')}; - } else if (isInsufficientFee) { + } else if (hasInsufficientFeeError) { transitionKey = 2; content = {lang('Insufficient fee')}; } @@ -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'); @@ -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); } diff --git a/src/components/ui/PinPad.tsx b/src/components/ui/PinPad.tsx index 3157a086..5a8f7148 100644 --- a/src/components/ui/PinPad.tsx +++ b/src/components/ui/PinPad.tsx @@ -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(); }; }, []); diff --git a/src/global/actions/api/dapps.ts b/src/global/actions/api/dapps.ts index 8d5b32f9..fea33096 100644 --- a/src/global/actions/api/dapps.ts +++ b/src/global/actions/api/dapps.ts @@ -69,6 +69,9 @@ addActionHandler('submitDappConnectRequestConfirm', async (global, actions, { pa }); global = getGlobal(); + if (IS_CAPACITOR) { + global = clearIsPinAccepted(global); + } global = clearDappConnectRequest(global); setGlobal(global); @@ -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); }); diff --git a/src/global/actions/api/swap.ts b/src/global/actions/api/swap.ts index ef547ef2..a2f379b1 100644 --- a/src/global/actions/api/swap.ts +++ b/src/global/actions/api/swap.ts @@ -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; @@ -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); });