1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-26 00:48:35 +00:00

ethereumGetAccountInfo only if there are some accounts

This commit is contained in:
Szymon Lesisz 2018-09-13 14:51:45 +02:00
parent 8884d65c8f
commit f0d7de8aa1

View File

@ -92,6 +92,7 @@ export const onBlockMined = (network: string): PromiseAction<void> => async (dis
await dispatch( Web3Actions.resolvePendingTransactions(network) ); await dispatch( Web3Actions.resolvePendingTransactions(network) );
const accounts: Array<any> = getState().accounts.filter(a => a.network === network); const accounts: Array<any> = getState().accounts.filter(a => a.network === network);
if (accounts.length > 0) {
// find out which account changed // find out which account changed
const response = await TrezorConnect.ethereumGetAccountInfo({ const response = await TrezorConnect.ethereumGetAccountInfo({
accounts, accounts,
@ -105,6 +106,7 @@ export const onBlockMined = (network: string): PromiseAction<void> => async (dis
} }
}); });
} }
}
} }
export const onNotification = (payload: any): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => { export const onNotification = (payload: any): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
@ -179,8 +181,6 @@ export const init = (): PromiseAction<void> => async (dispatch: Dispatch, getSta
for (let i = 0; i < networks.length; i++) { for (let i = 0; i < networks.length; i++) {
await dispatch( subscribe(networks[i]) ); await dispatch( subscribe(networks[i]) );
} }
} else {
await dispatch( subscribe('ropsten') );
} }
// continue wallet initialization // continue wallet initialization