|
|
|
@ -172,12 +172,7 @@ export function init(instance: ?Web3, coinIndex: number = 0): AsyncAction {
|
|
|
|
|
for (const account of accounts) {
|
|
|
|
|
const nonce = await getNonceAsync(web3, account.address);
|
|
|
|
|
if (nonce !== account.nonce) {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: ADDRESS.SET_NONCE,
|
|
|
|
|
address: account.address,
|
|
|
|
|
network: account.network,
|
|
|
|
|
nonce
|
|
|
|
|
});
|
|
|
|
|
dispatch(AddressActions.setNonce(account.address, account.network, account.deviceState, nonce));
|
|
|
|
|
|
|
|
|
|
// dispatch( getBalance(account) );
|
|
|
|
|
// TODO: check if nonce was updated,
|
|
|
|
@ -254,6 +249,7 @@ export function getBalance(account: Account): AsyncAction {
|
|
|
|
|
dispatch(AddressActions.setBalance(
|
|
|
|
|
account.address,
|
|
|
|
|
account.network,
|
|
|
|
|
account.deviceState,
|
|
|
|
|
newBalance
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
@ -296,12 +292,7 @@ export function getNonce(account: Account): AsyncAction {
|
|
|
|
|
web3.eth.getTransactionCount(account.address, (error: Error, result: number) => {
|
|
|
|
|
if (!error) {
|
|
|
|
|
if (account.nonce !== result) {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: ADDRESS.SET_NONCE,
|
|
|
|
|
address: account.address,
|
|
|
|
|
network: account.network,
|
|
|
|
|
nonce: result
|
|
|
|
|
});
|
|
|
|
|
dispatch(AddressActions.setNonce(account.address, account.network, account.deviceState, result));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|