mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-25 16:38:08 +00:00
ethereumGetAccountInfo only if there are some accounts
This commit is contained in:
parent
8884d65c8f
commit
f0d7de8aa1
@ -92,18 +92,20 @@ 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);
|
||||||
// find out which account changed
|
if (accounts.length > 0) {
|
||||||
const response = await TrezorConnect.ethereumGetAccountInfo({
|
// find out which account changed
|
||||||
accounts,
|
const response = await TrezorConnect.ethereumGetAccountInfo({
|
||||||
coin: network,
|
accounts,
|
||||||
});
|
coin: network,
|
||||||
|
|
||||||
if (response.success) {
|
|
||||||
response.payload.forEach((a, i) => {
|
|
||||||
if (a.transactions > 0) {
|
|
||||||
dispatch( Web3Actions.updateAccount(accounts[i], a, 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<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
|
||||||
|
Loading…
Reference in New Issue
Block a user