1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-03-21 02:26:13 +00:00

Merge pull request #514 from trezor/fix/update-account-empty-state

Fix/update account empty state
This commit is contained in:
Vladimir Volek 2019-04-16 16:17:28 +02:00 committed by GitHub
commit cde2cf2f6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,
})
);
};