From f0d7de8aa1a458fb4c0c0205748c7966da2aa49b Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 13 Sep 2018 14:51:45 +0200 Subject: [PATCH] ethereumGetAccountInfo only if there are some accounts --- src/actions/BlockchainActions.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/actions/BlockchainActions.js b/src/actions/BlockchainActions.js index 9e4a79a3..de319eb5 100644 --- a/src/actions/BlockchainActions.js +++ b/src/actions/BlockchainActions.js @@ -92,18 +92,20 @@ export const onBlockMined = (network: string): PromiseAction => async (dis await dispatch( Web3Actions.resolvePendingTransactions(network) ); const accounts: Array = getState().accounts.filter(a => a.network === network); - // find out which account changed - const response = await TrezorConnect.ethereumGetAccountInfo({ - accounts, - coin: network, - }); - - if (response.success) { - response.payload.forEach((a, i) => { - if (a.transactions > 0) { - dispatch( Web3Actions.updateAccount(accounts[i], a, network) ) - } + if (accounts.length > 0) { + // find out which account changed + const response = await TrezorConnect.ethereumGetAccountInfo({ + accounts, + coin: network, }); + + if (response.success) { + response.payload.forEach((a, i) => { + if (a.transactions > 0) { + dispatch( Web3Actions.updateAccount(accounts[i], a, network) ) + } + }); + } } } @@ -179,8 +181,6 @@ export const init = (): PromiseAction => async (dispatch: Dispatch, getSta for (let i = 0; i < networks.length; i++) { await dispatch( subscribe(networks[i]) ); } - } else { - await dispatch( subscribe('ropsten') ); } // continue wallet initialization