1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-27 10:48:22 +00:00

update account empty state

This commit is contained in:
slowbackspace 2019-04-16 14:54:22 +02:00
parent 502ccf0a94
commit dc821b7a37
2 changed files with 4 additions and 0 deletions

View File

@ -212,11 +212,13 @@ export const updateAccount = (
const instance: Web3Instance = await dispatch(initWeb3(network));
const balance = await instance.web3.eth.getBalance(account.descriptor);
const nonce = await instance.web3.eth.getTransactionCount(account.descriptor);
const empty = nonce <= 0 && balance === '0';
dispatch(
AccountsActions.update({
networkType: 'ethereum',
...account,
...newAccount,
empty,
nonce,
balance: EthereumjsUnits.convert(balance, 'wei', 'ether'),
availableBalance: EthereumjsUnits.convert(balance, 'wei', 'ether'),

View File

@ -141,6 +141,7 @@ export const onNotification = (
if (!updatedAccount.success) return;
const empty = updatedAccount.payload.sequence <= 0 && updatedAccount.payload.balance === '0';
dispatch(
AccountsActions.update({
networkType: 'ripple',
@ -153,6 +154,7 @@ export const onNotification = (
block: updatedAccount.payload.block,
sequence: updatedAccount.payload.sequence,
reserve: '0',
empty,
})
);
};