mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-30 12:18:09 +00:00
update account empty state
This commit is contained in:
parent
502ccf0a94
commit
dc821b7a37
@ -212,11 +212,13 @@ export const updateAccount = (
|
|||||||
const instance: Web3Instance = await dispatch(initWeb3(network));
|
const instance: Web3Instance = await dispatch(initWeb3(network));
|
||||||
const balance = await instance.web3.eth.getBalance(account.descriptor);
|
const balance = await instance.web3.eth.getBalance(account.descriptor);
|
||||||
const nonce = await instance.web3.eth.getTransactionCount(account.descriptor);
|
const nonce = await instance.web3.eth.getTransactionCount(account.descriptor);
|
||||||
|
const empty = nonce <= 0 && balance === '0';
|
||||||
dispatch(
|
dispatch(
|
||||||
AccountsActions.update({
|
AccountsActions.update({
|
||||||
networkType: 'ethereum',
|
networkType: 'ethereum',
|
||||||
...account,
|
...account,
|
||||||
...newAccount,
|
...newAccount,
|
||||||
|
empty,
|
||||||
nonce,
|
nonce,
|
||||||
balance: EthereumjsUnits.convert(balance, 'wei', 'ether'),
|
balance: EthereumjsUnits.convert(balance, 'wei', 'ether'),
|
||||||
availableBalance: EthereumjsUnits.convert(balance, 'wei', 'ether'),
|
availableBalance: EthereumjsUnits.convert(balance, 'wei', 'ether'),
|
||||||
|
@ -141,6 +141,7 @@ export const onNotification = (
|
|||||||
|
|
||||||
if (!updatedAccount.success) return;
|
if (!updatedAccount.success) return;
|
||||||
|
|
||||||
|
const empty = updatedAccount.payload.sequence <= 0 && updatedAccount.payload.balance === '0';
|
||||||
dispatch(
|
dispatch(
|
||||||
AccountsActions.update({
|
AccountsActions.update({
|
||||||
networkType: 'ripple',
|
networkType: 'ripple',
|
||||||
@ -153,6 +154,7 @@ export const onNotification = (
|
|||||||
block: updatedAccount.payload.block,
|
block: updatedAccount.payload.block,
|
||||||
sequence: updatedAccount.payload.sequence,
|
sequence: updatedAccount.payload.sequence,
|
||||||
reserve: '0',
|
reserve: '0',
|
||||||
|
empty,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user