mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Use token decimals when calculating confirm screen amount for token approvals.
This commit is contained in:
parent
aab6e366c5
commit
c4f1dfb82e
@ -147,14 +147,20 @@ export const tokenAmountAndToAddressSelector = createSelector(
|
|||||||
|
|
||||||
export const approveTokenAmountAndToAddressSelector = createSelector(
|
export const approveTokenAmountAndToAddressSelector = createSelector(
|
||||||
tokenDataParamsSelector,
|
tokenDataParamsSelector,
|
||||||
params => {
|
tokenDecimalsSelector,
|
||||||
|
(params, tokenDecimals) => {
|
||||||
let toAddress = ''
|
let toAddress = ''
|
||||||
let tokenAmount = 0
|
let tokenAmount = 0
|
||||||
|
|
||||||
if (params && params.length) {
|
if (params && params.length) {
|
||||||
toAddress = params.find(param => param.name === TOKEN_PARAM_SPENDER).value
|
toAddress = params.find(param => param.name === TOKEN_PARAM_SPENDER).value
|
||||||
const value = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value)
|
const value = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value)
|
||||||
tokenAmount = roundExponential(value)
|
|
||||||
|
if (tokenDecimals) {
|
||||||
|
tokenAmount = calcTokenAmount(value, tokenDecimals)
|
||||||
|
}
|
||||||
|
|
||||||
|
tokenAmount = roundExponential(tokenAmount)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user