diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-14 22:50:32 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-15 23:25:24 +0800 |
commit | c3afc13dd660348e99b727c2dd01930eec8d99c3 (patch) | |
tree | 9a05e88e55200fdf72d08af10b5a753535e23256 /packages/instant/src/util/format.ts | |
parent | f570f80674c22f69712c45e8e3c48e948b51f357 (diff) | |
download | dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.gz dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.bz2 dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.lz dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.xz dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.zst dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.zip |
Upgrade bignumber.js version
Diffstat (limited to 'packages/instant/src/util/format.ts')
-rw-r--r-- | packages/instant/src/util/format.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/instant/src/util/format.ts b/packages/instant/src/util/format.ts index 4adb63e21..eef332d3c 100644 --- a/packages/instant/src/util/format.ts +++ b/packages/instant/src/util/format.ts @@ -25,16 +25,16 @@ export const format = { if (_.isUndefined(ethUnitAmount)) { return defaultText; } - let roundedAmount = ethUnitAmount.round(decimalPlaces).toDigits(decimalPlaces); + let roundedAmount = ethUnitAmount.integerValue(decimalPlaces).toDigits(decimalPlaces); - if (roundedAmount.eq(BIG_NUMBER_ZERO) && ethUnitAmount.greaterThan(BIG_NUMBER_ZERO)) { + if (roundedAmount.eq(BIG_NUMBER_ZERO) && ethUnitAmount.isGreaterThan(BIG_NUMBER_ZERO)) { // Sometimes for small ETH amounts (i.e. 0.000045) the amount rounded to 4 decimalPlaces is 0 // If that is the case, show to 1 significant digit roundedAmount = new BigNumber(ethUnitAmount.toPrecision(1)); } const displayAmount = - roundedAmount.greaterThan(BIG_NUMBER_ZERO) && roundedAmount.lessThan(minUnitAmountToDisplay) + roundedAmount.isGreaterThan(BIG_NUMBER_ZERO) && roundedAmount.isLessThan(minUnitAmountToDisplay) ? `< ${minUnitAmountToDisplay.toString()}` : roundedAmount.toString(); @@ -62,7 +62,7 @@ export const format = { if (_.isUndefined(ethUnitAmount) || _.isUndefined(ethUsdPrice)) { return defaultText; } - const rawUsdPrice = ethUnitAmount.mul(ethUsdPrice); + const rawUsdPrice = ethUnitAmount.multipliedBy(ethUsdPrice); const roundedUsdPrice = rawUsdPrice.toFixed(decimalPlaces); if (roundedUsdPrice === '0.00' && rawUsdPrice.gt(BIG_NUMBER_ZERO)) { return '<$0.01'; |