Update WalletDetails.tsx

This commit is contained in:
Marcos Rodriguez Velez 2025-03-02 20:43:19 -04:00
parent 4b249edaa4
commit 9574554780

View file

@ -309,6 +309,7 @@ const WalletDetails: React.FC = () => {
walletID, walletID,
}); });
}; };
const navigateToXPub = () => const navigateToXPub = () =>
navigate('WalletXpubRoot', { navigate('WalletXpubRoot', {
screen: 'WalletXpub', screen: 'WalletXpub',
@ -365,16 +366,16 @@ const WalletDetails: React.FC = () => {
if (backdoorPressed < 10) return setBackdoorPressed(backdoorPressed + 1); if (backdoorPressed < 10) return setBackdoorPressed(backdoorPressed + 1);
setBackdoorPressed(0); setBackdoorPressed(0);
const msg = 'Transactions & balances purged. Pls go to main screen and back to rerender screen'; const msg = 'Transactions & balances purged. Pls go to main screen and back to rerender screen';
let wasPurged = false;
if (wallet.type === HDSegwitBech32Wallet.type) { if (wallet.type === HDSegwitBech32Wallet.type) {
wallet._txs_by_external_index = {}; wallet._txs_by_external_index = {};
wallet._txs_by_internal_index = {}; wallet._txs_by_internal_index = {};
presentAlert({ message: msg });
wallet._balances_by_external_index = {}; wallet._balances_by_external_index = {};
wallet._balances_by_internal_index = {}; wallet._balances_by_internal_index = {};
wallet._lastTxFetch = 0; wallet._lastTxFetch = 0;
wallet._lastBalanceFetch = 0; wallet._lastBalanceFetch = 0;
wasPurged = true;
} }
// @ts-expect-error: Need to fix later // @ts-expect-error: Need to fix later
@ -383,6 +384,7 @@ const WalletDetails: React.FC = () => {
wallet._hdWalletInstance._txs_by_external_index = {}; wallet._hdWalletInstance._txs_by_external_index = {};
// @ts-expect-error: Need to fix later // @ts-expect-error: Need to fix later
wallet._hdWalletInstance._txs_by_internal_index = {}; wallet._hdWalletInstance._txs_by_internal_index = {};
// @ts-expect-error: Need to fix later // @ts-expect-error: Need to fix later
wallet._hdWalletInstance._balances_by_external_index = {}; wallet._hdWalletInstance._balances_by_external_index = {};
// @ts-expect-error: Need to fix later // @ts-expect-error: Need to fix later
@ -391,12 +393,6 @@ const WalletDetails: React.FC = () => {
wallet._hdWalletInstance._lastTxFetch = 0; wallet._hdWalletInstance._lastTxFetch = 0;
// @ts-expect-error: Need to fix later // @ts-expect-error: Need to fix later
wallet._hdWalletInstance._lastBalanceFetch = 0; wallet._hdWalletInstance._lastBalanceFetch = 0;
wasPurged = true;
}
if (wasPurged) {
await saveToDisk();
// Find the WalletTransactions screen in the navigation state and reset just that screen. // Find the WalletTransactions screen in the navigation state and reset just that screen.
// It can be multiple WalletTransactions screen. // It can be multiple WalletTransactions screen.
dispatch(state => { dispatch(state => {