From b361e1c8d9d8cab0dad51f889e526fa017660ff5 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 5 Feb 2025 15:15:37 -0300 Subject: [PATCH] [FIX] wallet status update --- src/store/wallet/wallet.reducer.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/store/wallet/wallet.reducer.ts b/src/store/wallet/wallet.reducer.ts index 3c8c304c1..82f2bff6d 100644 --- a/src/store/wallet/wallet.reducer.ts +++ b/src/store/wallet/wallet.reducer.ts @@ -632,14 +632,17 @@ export const walletReducer = ( }); // Update wallet statuses - walletBalances.forEach(({keyId, walletId, status}) => { - if (updatedKeys[keyId]?.wallets?.[walletId]) { - updatedKeys[keyId].wallets[walletId] = { - ...updatedKeys[keyId].wallets[walletId], - balance: status.balance, - pendingTxps: status.pendingTxps, - singleAddress: status.singleAddress, - }; + walletBalances.forEach(({ keyId, walletId, status }) => { + if (updatedKeys[keyId]?.wallets?.length > 0) { + updatedKeys[keyId].wallets = updatedKeys[keyId].wallets.map((wallet) => { + if (wallet.id === walletId) { + wallet.balance = status.balance; + wallet.pendingTxps = status.pendingTxps; + wallet.isRefreshing = false; + wallet.singleAddress = status.singleAddress; + } + return wallet; + }); } });