aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/selectors/confirm-transaction.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-11-20 08:06:34 +0800
committerGitHub <noreply@github.com>2018-11-20 08:06:34 +0800
commit4c87c05a02d5bf5634234a74910e5d3e559dd413 (patch)
tree638338429538e6bc62b5ad812c11e1f7925fe184 /ui/app/selectors/confirm-transaction.js
parent7fe37276a17cbbcb566a0650603eb5ed6115179b (diff)
downloadtangerine-wallet-browser-4c87c05a02d5bf5634234a74910e5d3e559dd413.tar
tangerine-wallet-browser-4c87c05a02d5bf5634234a74910e5d3e559dd413.tar.gz
tangerine-wallet-browser-4c87c05a02d5bf5634234a74910e5d3e559dd413.tar.bz2
tangerine-wallet-browser-4c87c05a02d5bf5634234a74910e5d3e559dd413.tar.lz
tangerine-wallet-browser-4c87c05a02d5bf5634234a74910e5d3e559dd413.tar.xz
tangerine-wallet-browser-4c87c05a02d5bf5634234a74910e5d3e559dd413.tar.zst
tangerine-wallet-browser-4c87c05a02d5bf5634234a74910e5d3e559dd413.zip
Fix rounding issue when sending max tokens (#5695)
* Fix rounding issue when sending max tokens * Ensure amount row shows exact amount of max tokens on send screen (#2) * Fix tests * Change stored redux value from BigNumber to hex string. Fix TokenInput default value
Diffstat (limited to 'ui/app/selectors/confirm-transaction.js')
-rw-r--r--ui/app/selectors/confirm-transaction.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ui/app/selectors/confirm-transaction.js b/ui/app/selectors/confirm-transaction.js
index 90924c036..23ef26d95 100644
--- a/ui/app/selectors/confirm-transaction.js
+++ b/ui/app/selectors/confirm-transaction.js
@@ -137,11 +137,12 @@ export const tokenAmountAndToAddressSelector = createSelector(
const valueParam = params.find(param => param.name === TOKEN_PARAM_VALUE)
toAddress = toParam ? toParam.value : params[0].value
const value = valueParam ? Number(valueParam.value) : Number(params[1].value)
- tokenAmount = roundExponential(value)
if (tokenDecimals) {
- tokenAmount = calcTokenAmount(value, tokenDecimals)
+ tokenAmount = calcTokenAmount(value, tokenDecimals).toNumber()
}
+
+ tokenAmount = roundExponential(tokenAmount)
}
return {
@@ -163,7 +164,7 @@ export const approveTokenAmountAndToAddressSelector = createSelector(
const value = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value)
if (tokenDecimals) {
- tokenAmount = calcTokenAmount(value, tokenDecimals)
+ tokenAmount = calcTokenAmount(value, tokenDecimals).toNumber()
}
tokenAmount = roundExponential(tokenAmount)
@@ -188,7 +189,7 @@ export const sendTokenTokenAmountAndToAddressSelector = createSelector(
let value = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value)
if (tokenDecimals) {
- value = calcTokenAmount(value, tokenDecimals)
+ value = calcTokenAmount(value, tokenDecimals).toNumber()
}
tokenAmount = roundExponential(value)