aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-09-14 10:20:13 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-09-16 07:23:23 +0800
commit54bbf8d8590014b92e7857f30bdc2d8f3779431a (patch)
tree0d9a5939fad15afe90b61de390fffb5f2d9ba9cd /ui/app/conversion-util.js
parentb0f1fba2e5fbde573b46a284285985e63f1a3618 (diff)
downloadtangerine-wallet-browser-54bbf8d8590014b92e7857f30bdc2d8f3779431a.tar.gz
tangerine-wallet-browser-54bbf8d8590014b92e7857f30bdc2d8f3779431a.tar.zst
tangerine-wallet-browser-54bbf8d8590014b92e7857f30bdc2d8f3779431a.zip
Handle transaction totals in WEI in tx-list, send and pending.
Diffstat (limited to 'ui/app/conversion-util.js')
-rw-r--r--ui/app/conversion-util.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/app/conversion-util.js b/ui/app/conversion-util.js
index 847650758..b440aea7f 100644
--- a/ui/app/conversion-util.js
+++ b/ui/app/conversion-util.js
@@ -46,6 +46,9 @@ const toBigNumber = {
const toNormalizedDenomination = {
WEI: bigNumber => bigNumber.div(BIG_NUMBER_WEI_MULTIPLIER)
}
+const toSpecifiedDenomination = {
+ WEI: bigNumber => bigNumber.times(BIG_NUMBER_WEI_MULTIPLIER)
+}
const baseChange = {
hex: n => n.toString(16),
dec: n => n.toString(10),
@@ -80,6 +83,7 @@ const whenPropApplySetterMap = (prop, setterMap) => whenPredSetWithPropAndSetter
const converter = R.pipe(
whenPropApplySetterMap('fromNumericBase', toBigNumber),
whenPropApplySetterMap('fromDenomination', toNormalizedDenomination),
+ whenPropApplySetterMap('toDenomination', toSpecifiedDenomination),
whenPredSetWithPropAndSetter(fromAndToCurrencyPropsNotEqual, 'conversionRate', convert),
whenPredSetWithPropAndSetter(R.prop('ethToUSDRate'), 'ethToUSDRate', convert),
whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round),
@@ -93,6 +97,7 @@ const conversionUtil = (value, {
fromNumericBase,
toNumericBase,
fromDenomination,
+ toDenomination,
numberOfDecimals,
conversionRate,
ethToUSDRate,
@@ -102,6 +107,7 @@ const conversionUtil = (value, {
fromNumericBase,
toNumericBase,
fromDenomination,
+ toDenomination,
numberOfDecimals,
conversionRate,
ethToUSDRate,