diff options
author | Dan J Miller <danjm.com@gmail.com> | 2018-08-09 02:56:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 02:56:03 +0800 |
commit | 1d4ee6bf765f0b7fc80fa7f95618e8de3844488d (patch) | |
tree | 3387f140c6d13440fbc2105ff82cd2f7ccf609a8 /ui | |
parent | 8ac4b586ebbea8ffce917205528852eeaf4d77e1 (diff) | |
parent | c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf (diff) | |
download | tangerine-wallet-browser-1d4ee6bf765f0b7fc80fa7f95618e8de3844488d.tar.gz tangerine-wallet-browser-1d4ee6bf765f0b7fc80fa7f95618e8de3844488d.tar.zst tangerine-wallet-browser-1d4ee6bf765f0b7fc80fa7f95618e8de3844488d.zip |
Merge pull request #4986 from MetaMask/approve-calc-token-decimals
Use token decimals when calculating confirm screen token approval amount
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/selectors/confirm-transaction.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ui/app/selectors/confirm-transaction.js b/ui/app/selectors/confirm-transaction.js index 9548cf75e..aa1fc5404 100644 --- a/ui/app/selectors/confirm-transaction.js +++ b/ui/app/selectors/confirm-transaction.js @@ -147,14 +147,20 @@ export const tokenAmountAndToAddressSelector = createSelector( export const approveTokenAmountAndToAddressSelector = createSelector( tokenDataParamsSelector, - params => { + tokenDecimalsSelector, + (params, tokenDecimals) => { let toAddress = '' let tokenAmount = 0 if (params && params.length) { toAddress = params.find(param => param.name === TOKEN_PARAM_SPENDER).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 { |