Cleanup erc20 amount calcs
This commit is contained in:
parent
4c45daa2e2
commit
cdbe4dfc57
|
@ -37,7 +37,6 @@ import { TokenProps } from 'src/logic/tokens/store/model/token'
|
||||||
import { RecordOf } from 'immutable'
|
import { RecordOf } from 'immutable'
|
||||||
import { useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas'
|
import { useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas'
|
||||||
import { TransactionFees } from 'src/components/TransactionsFees'
|
import { TransactionFees } from 'src/components/TransactionsFees'
|
||||||
import BigNumber from 'bignumber.js'
|
|
||||||
const useStyles = makeStyles(styles)
|
const useStyles = makeStyles(styles)
|
||||||
|
|
||||||
const { nativeCoin } = getNetworkInfo()
|
const { nativeCoin } = getNetworkInfo()
|
||||||
|
@ -75,8 +74,7 @@ const useTxData = (
|
||||||
if (!isSendingNativeToken) {
|
if (!isSendingNativeToken) {
|
||||||
const StandardToken = await getHumanFriendlyToken()
|
const StandardToken = await getHumanFriendlyToken()
|
||||||
const tokenInstance = await StandardToken.at(txToken.address as string)
|
const tokenInstance = await StandardToken.at(txToken.address as string)
|
||||||
const decimals = await tokenInstance.decimals()
|
const erc20TransferAmount = toTokenUnit(txAmount, txToken.decimals)
|
||||||
const erc20TransferAmount = new BigNumber(txAmount).times(10 ** decimals.toNumber()).toString()
|
|
||||||
txData = tokenInstance.contract.methods.transfer(recipientAddress, erc20TransferAmount).encodeABI()
|
txData = tokenInstance.contract.methods.transfer(recipientAddress, erc20TransferAmount).encodeABI()
|
||||||
}
|
}
|
||||||
setData(txData)
|
setData(txData)
|
||||||
|
|
Loading…
Reference in New Issue