mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Ensure token amounts are in fixed notation (#9381)
* Ensure token amounts are in fixed notation
This commit is contained in:
parent
b349a5c8b1
commit
eef4ec981f
@ -44,7 +44,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
const tokenData = getTokenData(data)
|
||||
const tokenValue = getTokenValueParam(tokenData)
|
||||
const toAddress = getTokenAddressParam(tokenData)
|
||||
const tokenAmount = tokenData && calcTokenAmount(tokenValue, decimals).toString()
|
||||
const tokenAmount = tokenData && calcTokenAmount(tokenValue, decimals).toFixed()
|
||||
const contractExchangeRate = contractExchangeRateSelector(state)
|
||||
|
||||
return {
|
||||
|
@ -160,12 +160,15 @@ export const sendTokenTokenAmountAndToAddressSelector = createSelector(
|
||||
let toAddress = ''
|
||||
let tokenAmount = '0'
|
||||
|
||||
// Token params here are ethers BigNumbers, which have a different
|
||||
// interface than bignumber.js
|
||||
if (args && args.length) {
|
||||
toAddress = args[TOKEN_PARAM_TO]
|
||||
let value = args[TOKEN_PARAM_VALUE].toString()
|
||||
|
||||
if (tokenDecimals) {
|
||||
value = calcTokenAmount(value, tokenDecimals).toString()
|
||||
// bignumber.js return value
|
||||
value = calcTokenAmount(value, tokenDecimals).toFixed()
|
||||
}
|
||||
|
||||
tokenAmount = roundExponential(value)
|
||||
|
Loading…
Reference in New Issue
Block a user