aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-06-14 12:11:04 +0800
committerkumavis <aaron@kumavis.me>2018-06-14 12:11:04 +0800
commite9cb6508324c166a2d6efe53cf82c39abd4520b4 (patch)
treeda584d964cf84470250f242923967afa7b6a4822 /ui/app/conversion-util.js
parent691ac5d288963f376e34c1711e23bbd58432396f (diff)
parent66c77dc2bd95f40e2d6113e3b932e25c6dc8030c (diff)
downloadtangerine-wallet-browser-e9cb6508324c166a2d6efe53cf82c39abd4520b4.tar
tangerine-wallet-browser-e9cb6508324c166a2d6efe53cf82c39abd4520b4.tar.gz
tangerine-wallet-browser-e9cb6508324c166a2d6efe53cf82c39abd4520b4.tar.bz2
tangerine-wallet-browser-e9cb6508324c166a2d6efe53cf82c39abd4520b4.tar.lz
tangerine-wallet-browser-e9cb6508324c166a2d6efe53cf82c39abd4520b4.tar.xz
tangerine-wallet-browser-e9cb6508324c166a2d6efe53cf82c39abd4520b4.tar.zst
tangerine-wallet-browser-e9cb6508324c166a2d6efe53cf82c39abd4520b4.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into ValidateEmptyKey
Diffstat (limited to 'ui/app/conversion-util.js')
-rw-r--r--ui/app/conversion-util.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/app/conversion-util.js b/ui/app/conversion-util.js
index d484ed16d..100402d95 100644
--- a/ui/app/conversion-util.js
+++ b/ui/app/conversion-util.js
@@ -11,7 +11,8 @@
* @param {string} [options.fromNumericBase = 'hex' | 'dec' | 'BN'] The numeric basic of the passed value.
* @param {string} [options.toNumericBase = 'hex' | 'dec' | 'BN'] The desired numeric basic of the result.
* @param {string} [options.fromDenomination = 'WEI'] The denomination of the passed value
-* @param {number} [options.numberOfDecimals] The desired number of in the result
+* @param {string} [options.numberOfDecimals] The desired number of decimals in the result
+* @param {string} [options.roundDown] The desired number of decimals to round down to
* @param {number} [options.conversionRate] The rate to use to make the fromCurrency -> toCurrency conversion
* @returns {(number | string | BN)}
*
@@ -38,6 +39,7 @@ const BIG_NUMBER_GWEI_MULTIPLIER = new BigNumber('1000000000')
// Individual Setters
const convert = R.invoker(1, 'times')
const round = R.invoker(2, 'round')(R.__, BigNumber.ROUND_HALF_DOWN)
+const roundDown = R.invoker(2, 'round')(R.__, BigNumber.ROUND_DOWN)
const invertConversionRate = conversionRate => () => new BigNumber(1.0).div(conversionRate)
const decToBigNumberViaString = n => R.pipe(String, toBigNumber['dec'])
@@ -104,6 +106,7 @@ const converter = R.pipe(
whenPredSetWithPropAndSetter(fromAndToCurrencyPropsNotEqual, 'conversionRate', convert),
whenPropApplySetterMap('toDenomination', toSpecifiedDenomination),
whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round),
+ whenPredSetWithPropAndSetter(R.prop('roundDown'), 'roundDown', roundDown),
whenPropApplySetterMap('toNumericBase', baseChange),
R.view(R.lensProp('value'))
)