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:
commit
cde2cf2f6b
@ -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'),
|
||||
|
@ -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,
|
||||
})
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user