mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-30 19:00:53 +00:00
add availableBalance to Account.update action
This commit is contained in:
parent
bfebef73c7
commit
9b7987e951
@ -196,7 +196,11 @@ export const updateAccount = (account: Account, newAccount: EthereumAccount, net
|
||||
const balance = await instance.web3.eth.getBalance(account.address);
|
||||
const nonce = await instance.web3.eth.getTransactionCount(account.address);
|
||||
dispatch(AccountsActions.update({
|
||||
...account, ...newAccount, balance: EthereumjsUnits.convert(balance, 'wei', 'ether'), nonce,
|
||||
...account,
|
||||
...newAccount,
|
||||
nonce,
|
||||
balance: EthereumjsUnits.convert(balance, 'wei', 'ether'),
|
||||
availableBalance: EthereumjsUnits.convert(balance, 'wei', 'ether'),
|
||||
}));
|
||||
|
||||
// update tokens for this account
|
||||
|
@ -4,6 +4,7 @@ import TrezorConnect from 'trezor-connect';
|
||||
import * as BLOCKCHAIN from 'actions/constants/blockchain';
|
||||
import * as PENDING from 'actions/constants/pendingTx';
|
||||
import * as AccountsActions from 'actions/AccountsActions';
|
||||
import { toDecimalAmount } from 'utils/formatUtils';
|
||||
|
||||
import type { BlockchainNotification } from 'trezor-connect';
|
||||
import type {
|
||||
@ -75,7 +76,8 @@ export const onNotification = (payload: $ElementType<BlockchainNotification, 'pa
|
||||
|
||||
dispatch(AccountsActions.update({
|
||||
...account,
|
||||
balance: updatedAccount.payload.balance,
|
||||
balance: toDecimalAmount(updatedAccount.payload.balance, 6),
|
||||
availableDevice: toDecimalAmount(updatedAccount.payload.availableBalance, 6),
|
||||
block: updatedAccount.payload.block,
|
||||
sequence: updatedAccount.payload.sequence,
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user