From 022754527e27b8326eeeeb9aaa2663ae787add6a Mon Sep 17 00:00:00 2001 From: "@greweb" Date: Tue, 22 Mar 2022 13:06:22 +0100 Subject: [PATCH] Uses balance from backend even if no txs (#1806) e.g. receive by unsupported internal tx Fixes LIVE-1102 --- src/families/ethereum/synchronisation.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/families/ethereum/synchronisation.ts b/src/families/ethereum/synchronisation.ts index 6279c98411..bd2cf27d2d 100644 --- a/src/families/ethereum/synchronisation.ts +++ b/src/families/ethereum/synchronisation.ts @@ -59,20 +59,23 @@ export const getAccountShape: GetAccountShape = async ( const txsP = fetchAllTransactions(api, address, pullFromBlockHash); const currentBlockP = fetchCurrentBlock(currency); const balanceP = api.getAccountBalance(address); - const [txs, currentBlock] = await Promise.all([txsP, currentBlockP]); + const [txs, currentBlock, balance] = await Promise.all([ + txsP, + currentBlockP, + balanceP, + ]); const blockHeight = currentBlock.height.toNumber(); if (!pullFromBlockHash && txs.length === 0) { log("ethereum", "no ops on " + address); return { id: accountId, - balance: new BigNumber(0), + balance, subAccounts: [], blockHeight, }; } - const balance = await balanceP; // transform transactions into operations let newOps = flatMap(txs, txToOps({ address, id: accountId, currency })); // extracting out the sub operations by token account