diff --git a/src/App.tsx b/src/App.tsx index a01a4eb..ae2bc8a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -103,6 +103,7 @@ function App() { } }, [extState]) + const address = useMemo(() => { if (!rawWallet?.address0) return ""; return rawWallet.address0; @@ -212,7 +213,7 @@ function App() { const getBalanceFunc = () => { setQortBalanceLoading(true) chrome.runtime.sendMessage({ action: "balance" }, (response) => { - if (response && !response?.error) { + if (!response?.error && !isNaN(+response)) { setBalance(response); } setQortBalanceLoading(false) @@ -221,7 +222,7 @@ function App() { const getLtcBalanceFunc = () => { setLtcBalanceLoading(true) chrome.runtime.sendMessage({ action: "ltcBalance" }, (response) => { - if (response && !response?.error) { + if (!response?.error && !isNaN(+response)) { setLtcBalance(response); } setLtcBalanceLoading(false) @@ -577,6 +578,7 @@ function App() { const resetAllStates = () => { setExtstate("not-authenticated"); + setAuthenticatedMode('qort') setBackupjson(null); setRawWallet(null); setdecryptedWallet(null); @@ -625,6 +627,11 @@ function App() { } }); getBalanceFunc(); + chrome.runtime.sendMessage({ action: "getWalletInfo" }, (response) => { + if (response && response?.walletInfo) { + setRawWallet(response?.walletInfo); + } + }); } else if (response?.error) { setIsLoading(false) setWalletToBeDecryptedError(response.error) @@ -724,7 +731,7 @@ function App() { {ltcBalanceLoading && } - {ltcBalance && !isNaN(+ltcBalance) && !ltcBalanceLoading && ( + {!isNaN(+ltcBalance) && !ltcBalanceLoading && ( {qortBalanceLoading && } - {balance && ( - - {balance} QORT - - )} - + {(balance >= 0) && ( + + {balance?.toFixed(2)} QORT + + )} { @@ -896,7 +902,7 @@ function App() { fontWeight: 700, }} > - {balance} QORT + {balance?.toFixed(2)} QORT