Uses formatAmount

This commit is contained in:
apane 2020-04-24 10:50:38 -03:00 committed by Mikhail Mikheev
parent b46af65fe8
commit d91f403c8d
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import TxType from './TxType'
import { type Column } from '~/components/Table/TableHead'
import { type SortRow, buildOrderFieldFrom } from '~/components/Table/sorting'
import { formatAmount } from '~/logic/tokens/utils/formatAmount'
import { getWeb3 } from '~/logic/wallets/getWeb3'
import { INCOMING_TX_TYPES, type IncomingTransaction } from '~/routes/safe/store/models/incomingTransaction'
import { type Transaction } from '~/routes/safe/store/models/transaction'
@ -46,7 +47,11 @@ export const getTxAmount = (tx: Transaction) => {
if (tx.isTokenTransfer && tx.decodedParams) {
const tokenDecimals = tx.decimals.toNumber ? tx.decimals.toNumber() : tx.decimals
txAmount = `${new BigNumber(tx.decodedParams.value).div(10 ** tokenDecimals).toFixed()} ${tx.symbol}`
txAmount = `${formatAmount(
BigNumber(tx.decodedParams.value)
.div(10 ** tokenDecimals)
.toString(),
)} ${tx.symbol}`
} else if (Number(tx.value) > 0) {
txAmount = `${fromWei(toBN(tx.value), 'ether')} ${tx.symbol}`
}