aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-09-15 20:31:25 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-09-16 07:16:41 +0800
commit095d327140fe4bb2b4a131a66e2774bdfeb8ce37 (patch)
tree559c3d59d438c25a0015cac707767d7b5779170e /ui/app/conversion-util.js
parentab77142c90a532a775636cf20a7e23191ff47f8f (diff)
downloadtangerine-wallet-browser-095d327140fe4bb2b4a131a66e2774bdfeb8ce37.tar
tangerine-wallet-browser-095d327140fe4bb2b4a131a66e2774bdfeb8ce37.tar.gz
tangerine-wallet-browser-095d327140fe4bb2b4a131a66e2774bdfeb8ce37.tar.bz2
tangerine-wallet-browser-095d327140fe4bb2b4a131a66e2774bdfeb8ce37.tar.lz
tangerine-wallet-browser-095d327140fe4bb2b4a131a66e2774bdfeb8ce37.tar.xz
tangerine-wallet-browser-095d327140fe4bb2b4a131a66e2774bdfeb8ce37.tar.zst
tangerine-wallet-browser-095d327140fe4bb2b4a131a66e2774bdfeb8ce37.zip
Adds USD to token list.
Diffstat (limited to 'ui/app/conversion-util.js')
-rw-r--r--ui/app/conversion-util.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/app/conversion-util.js b/ui/app/conversion-util.js
index 5e1125194..847650758 100644
--- a/ui/app/conversion-util.js
+++ b/ui/app/conversion-util.js
@@ -13,6 +13,7 @@
* @param {string} [options.fromDenomination = 'WEI'] The denomination of the passed value
* @param {number} [options.numberOfDecimals] The desired number of in the result
* @param {number} [options.conversionRate] The rate to use to make the fromCurrency -> toCurrency conversion
+* @param {number} [options.ethToUSDRate] If present, a second conversion - at ethToUSDRate - happens after conversionRate is applied.
* @returns {(number | string | BN)}
*
* The utility passes value along with the options as a single object to the `converter` function.
@@ -80,6 +81,7 @@ const converter = R.pipe(
whenPropApplySetterMap('fromNumericBase', toBigNumber),
whenPropApplySetterMap('fromDenomination', toNormalizedDenomination),
whenPredSetWithPropAndSetter(fromAndToCurrencyPropsNotEqual, 'conversionRate', convert),
+ whenPredSetWithPropAndSetter(R.prop('ethToUSDRate'), 'ethToUSDRate', convert),
whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round),
whenPropApplySetterMap('toNumericBase', baseChange),
R.view(R.lensProp('value'))
@@ -93,6 +95,7 @@ const conversionUtil = (value, {
fromDenomination,
numberOfDecimals,
conversionRate,
+ ethToUSDRate,
}) => converter({
fromCurrency,
toCurrency,
@@ -101,6 +104,7 @@ const conversionUtil = (value, {
fromDenomination,
numberOfDecimals,
conversionRate,
+ ethToUSDRate,
value,
});