aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Miller <danjm.com@gmail.com>2018-08-08 23:06:59 +0800
committerDan Miller <danjm.com@gmail.com>2018-08-08 23:06:59 +0800
commitc4f1dfb82e46023aae56bfa1311d5c1d80caf1bf (patch)
treea998b158e7716175eada7d3fdb58941512901d34
parentaab6e366c5162a85ae7853f5da29321f3d767cf4 (diff)
downloadtangerine-wallet-browser-c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf.tar
tangerine-wallet-browser-c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf.tar.gz
tangerine-wallet-browser-c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf.tar.bz2
tangerine-wallet-browser-c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf.tar.lz
tangerine-wallet-browser-c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf.tar.xz
tangerine-wallet-browser-c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf.tar.zst
tangerine-wallet-browser-c4f1dfb82e46023aae56bfa1311d5c1d80caf1bf.zip
Use token decimals when calculating confirm screen amount for token approvals.
-rw-r--r--ui/app/selectors/confirm-transaction.js10
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 {