aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-11-03 06:20:29 +0800
committerGitHub <noreply@github.com>2017-11-03 06:20:29 +0800
commit9f70762434deb1c973665a76623838289e655f22 (patch)
tree738fccaff1c153c72aea0d0699ddfec0b4c097c7 /ui/app/conversion-util.js
parentdc0b3255cf908320b5b46f02765ea03b5b4db6b7 (diff)
parentacc973d543ac65f8db980c0007c248c509345411 (diff)
downloadtangerine-wallet-browser-9f70762434deb1c973665a76623838289e655f22.tar
tangerine-wallet-browser-9f70762434deb1c973665a76623838289e655f22.tar.gz
tangerine-wallet-browser-9f70762434deb1c973665a76623838289e655f22.tar.bz2
tangerine-wallet-browser-9f70762434deb1c973665a76623838289e655f22.tar.lz
tangerine-wallet-browser-9f70762434deb1c973665a76623838289e655f22.tar.xz
tangerine-wallet-browser-9f70762434deb1c973665a76623838289e655f22.tar.zst
tangerine-wallet-browser-9f70762434deb1c973665a76623838289e655f22.zip
Merge pull request #2530 from MetaMask/uat
Merge uat into NewUI-flat
Diffstat (limited to 'ui/app/conversion-util.js')
-rw-r--r--ui/app/conversion-util.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/ui/app/conversion-util.js b/ui/app/conversion-util.js
index cb715460f..9359d7c90 100644
--- a/ui/app/conversion-util.js
+++ b/ui/app/conversion-util.js
@@ -22,6 +22,8 @@
*/
const BigNumber = require('bignumber.js')
+const ethUtil = require('ethereumjs-util')
+const BN = ethUtil.BN
const R = require('ramda')
const { stripHexPrefix } = require('ethereumjs-util')
@@ -104,7 +106,7 @@ const converter = R.pipe(
whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round),
whenPropApplySetterMap('toNumericBase', baseChange),
R.view(R.lensProp('value'))
-);
+)
const conversionUtil = (value, {
fromCurrency = null,
@@ -127,15 +129,15 @@ const conversionUtil = (value, {
conversionRate,
invertConversionRate,
value: value || '0',
-});
+})
const addCurrencies = (a, b, options = {}) => {
const {
aBase,
bBase,
- ...conversionOptions,
+ ...conversionOptions
} = options
- const value = (new BigNumber(a, aBase)).add(b, bBase);
+ const value = (new BigNumber(a, aBase)).add(b, bBase)
return converter({
value,
@@ -147,13 +149,13 @@ const multiplyCurrencies = (a, b, options = {}) => {
const {
multiplicandBase,
multiplierBase,
- ...conversionOptions,
+ ...conversionOptions
} = options
const bigNumberA = new BigNumber(String(a), multiplicandBase)
const bigNumberB = new BigNumber(String(b), multiplierBase)
- const value = bigNumberA.times(bigNumberB);
+ const value = bigNumberA.times(bigNumberB)
return converter({
value,
@@ -163,7 +165,7 @@ const multiplyCurrencies = (a, b, options = {}) => {
const conversionGreaterThan = (
{ ...firstProps },
- { ...secondProps },
+ { ...secondProps },
) => {
const firstValue = converter({ ...firstProps })
const secondValue = converter({ ...secondProps })
@@ -172,7 +174,7 @@ const conversionGreaterThan = (
const conversionGTE = (
{ ...firstProps },
- { ...secondProps },
+ { ...secondProps },
) => {
const firstValue = converter({ ...firstProps })
const secondValue = converter({ ...secondProps })
@@ -181,7 +183,7 @@ const conversionGTE = (
const conversionLTE = (
{ ...firstProps },
- { ...secondProps },
+ { ...secondProps },
) => {
const firstValue = converter({ ...firstProps })
const secondValue = converter({ ...secondProps })
@@ -200,4 +202,4 @@ module.exports = {
conversionGTE,
conversionLTE,
toNegative,
-} \ No newline at end of file
+}