From 8313df085ffdd4ac53dcb78f662a50dfc06184db Mon Sep 17 00:00:00 2001 From: Alexander <69318224+owlsua@users.noreply.github.com> Date: Sat, 1 Mar 2025 23:50:05 +0100 Subject: [PATCH 1/2] A-1209528494070631: blank screen fix (#204) * fix: blank screen after token send * fix: blank screen --- src/components/composed/Balance/Balance.js | 14 ++++++++++++++ .../containers/SendTransaction/SendTransaction.js | 2 +- .../MintlayerProvider/MintlayerProvider.js | 3 ++- src/hooks/UseWalletInfo/useMlWalletInfo.js | 4 +++- .../DelegationWithdraw/DelegationWithdraw.js | 4 ++-- src/pages/SendTransaction/SendTransaction.js | 15 ++++++++++++++- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/components/composed/Balance/Balance.js b/src/components/composed/Balance/Balance.js index 239fd596..fbd2fa54 100644 --- a/src/components/composed/Balance/Balance.js +++ b/src/components/composed/Balance/Balance.js @@ -32,6 +32,13 @@ const Balance = ({ balance, balanceLocked, exchangeRate, walletType }) => { if (walletType.name === 'Bitcoin') { return 'BTC' } + if ( + !tokenBalances || + !tokenBalances[walletType.name] || + !tokenBalances[walletType.name].token_info + ) { + return 'TKN' + } return tokenBalances[walletType.name].token_info.token_ticker.string } @@ -42,6 +49,13 @@ const Balance = ({ balance, balanceLocked, exchangeRate, walletType }) => { if (walletType.name === 'Bitcoin') { return } + if ( + !tokenBalances || + !tokenBalances[walletType.name] || + !tokenBalances[walletType.name].token_info + ) { + return + } return ( )} - + {/* TODO: remove popup */} {openSendFundConfirmation && ( { setLockedBalance(0) setTokenBalances({}) setUtxos([]) - setMlDelegationList([]) + // TODO: eneable this when after remove popup confirmation + // setMlDelegationList([]) setMlDelegationsBalance(0) } diff --git a/src/hooks/UseWalletInfo/useMlWalletInfo.js b/src/hooks/UseWalletInfo/useMlWalletInfo.js index 1ce7de44..5e0d3dc8 100644 --- a/src/hooks/UseWalletInfo/useMlWalletInfo.js +++ b/src/hooks/UseWalletInfo/useMlWalletInfo.js @@ -29,7 +29,9 @@ const useMlWalletInfo = (addresses, token) => { const nativecoins = ['Mintlayer', 'Bitcoin'] if (token && !nativecoins.includes(token)) { - const tokenBalance = tokenBalances[token].balance || 0 + const tokenBalance = tokenBalances[token]?.balance + ? tokenBalances[token].balance + : 0 return { transactions: transactions.filter((tx) => tx.token_id === token), diff --git a/src/pages/DelegationWithdraw/DelegationWithdraw.js b/src/pages/DelegationWithdraw/DelegationWithdraw.js index c9a6a0ff..5cae97ab 100644 --- a/src/pages/DelegationWithdraw/DelegationWithdraw.js +++ b/src/pages/DelegationWithdraw/DelegationWithdraw.js @@ -57,7 +57,7 @@ const DelegationWithdrawPage = () => { ) const delegationBalance = Format.BTCValue( - MLHelpers.getAmountInCoins(currentDelegationInfo.balance), + MLHelpers.getAmountInCoins(currentDelegationInfo?.balance || 0), ) const maxValueToken = delegationBalance - totalFeeCrypto @@ -103,7 +103,7 @@ const DelegationWithdrawPage = () => { ? mlPrivKeys.mlMainnetPrivateKey : mlPrivKeys.mlTestnetPrivateKey - const walletPrivKeys = await ML.getWalletPrivKeysList( + const walletPrivKeys = ML.getWalletPrivKeysList( privKey, networkType, changeAddressesLength, diff --git a/src/pages/SendTransaction/SendTransaction.js b/src/pages/SendTransaction/SendTransaction.js index 1b62a8b3..70c9e222 100644 --- a/src/pages/SendTransaction/SendTransaction.js +++ b/src/pages/SendTransaction/SendTransaction.js @@ -65,6 +65,13 @@ const SendTransactionPage = () => { if (walletType.name === 'Bitcoin') { return 'BTC' } + if ( + !tokenBalances || + !tokenBalances[walletType.name] || + !tokenBalances[walletType.name].token_info + ) { + return 'TKN' + } return tokenBalances[walletType.name].token_info.token_ticker.string } @@ -238,7 +245,13 @@ const SendTransactionPage = () => { return result } - const goBackToWallet = () => navigate('/wallet/' + walletType.name) + const goBackToWallet = () => { + if (walletType.tokenId) { + navigate('/') + } else { + navigate('/wallet/' + walletType.name) + } + } return ( <> From 2632f77bab342a187db33b82443ef8003e44603f Mon Sep 17 00:00:00 2001 From: owlsua Date: Tue, 4 Mar 2025 22:31:29 +0100 Subject: [PATCH 2/2] bump version to 1.3.7 --- package-lock.json | 4 ++-- package.json | 2 +- public/manifestDefault.json | 2 +- public/manifestFirefox.json | 2 +- src/components/composed/Navigation/Navigation.js | 2 +- src/pages/CreateRestore/CreateRestore.js | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index e58112a2..e084f368 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "browser-extension", - "version": "1.3.6", + "version": "1.3.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "browser-extension", - "version": "1.3.6", + "version": "1.3.7", "dependencies": { "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3", "@mintlayer/entropy-generator": "^1.0.4", diff --git a/package.json b/package.json index 4346e36d..bc859c56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browser-extension", - "version": "1.3.6", + "version": "1.3.7", "private": true, "dependencies": { "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3", diff --git a/public/manifestDefault.json b/public/manifestDefault.json index 371541c4..0c05e2df 100644 --- a/public/manifestDefault.json +++ b/public/manifestDefault.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Mojito - A Mintlayer Wallet", - "version": "1.3.6", + "version": "1.3.7", "short_name": "Mojito", "description": "Mojito is a non-custodial decentralized crypto wallet that lets you send and receive BTC and ML from any other address.", "homepage_url": "https://www.mintlayer.org/", diff --git a/public/manifestFirefox.json b/public/manifestFirefox.json index de4219d5..e3d25ce5 100644 --- a/public/manifestFirefox.json +++ b/public/manifestFirefox.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Mojito - A Mintlayer Wallet", - "version": "1.3.6", + "version": "1.3.7", "description": "Mojito is a non-custodial decentralized crypto wallet that lets you send and receive BTC and ML from any other address.", "homepage_url": "https://www.mintlayer.org/", "icons": { diff --git a/src/components/composed/Navigation/Navigation.js b/src/components/composed/Navigation/Navigation.js index acd12329..d009ae6b 100644 --- a/src/components/composed/Navigation/Navigation.js +++ b/src/components/composed/Navigation/Navigation.js @@ -185,7 +185,7 @@ const Navigation = ({ customNavigation }) => { Logout )} - v1.3.6 + v1.3.7 ) diff --git a/src/pages/CreateRestore/CreateRestore.js b/src/pages/CreateRestore/CreateRestore.js index 23bb8932..5fd3ce9d 100644 --- a/src/pages/CreateRestore/CreateRestore.js +++ b/src/pages/CreateRestore/CreateRestore.js @@ -87,7 +87,7 @@ const CreateRestorePage = () => { className="footnote-version" data-testid="footnote-name" > - v1.3.6 + v1.3.7