aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-14 22:53:43 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2019-01-15 23:25:25 +0800
commiteb393f0a6643183c784914bf3e039d1f4299247d (patch)
treedbc37d33b4538d3468479ad9be9354a7c204e4d6 /packages/instant/src/util
parentc3afc13dd660348e99b727c2dd01930eec8d99c3 (diff)
downloaddexon-sol-tools-eb393f0a6643183c784914bf3e039d1f4299247d.tar.gz
dexon-sol-tools-eb393f0a6643183c784914bf3e039d1f4299247d.tar.zst
dexon-sol-tools-eb393f0a6643183c784914bf3e039d1f4299247d.zip
Upgrade chai-bignumber
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/asset.ts5
-rw-r--r--packages/instant/src/util/format.ts2
2 files changed, 5 insertions, 2 deletions
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts
index a6fd77d5a..9e509edf9 100644
--- a/packages/instant/src/util/asset.ts
+++ b/packages/instant/src/util/asset.ts
@@ -121,7 +121,10 @@ export const assetUtils = {
error.amountAvailableToFill,
asset.metaData.decimals,
);
- const roundedUnitAmountAvailableToFill = unitAmountAvailableToFill.integerValue(2, BigNumber.ROUND_DOWN);
+ const roundedUnitAmountAvailableToFill = unitAmountAvailableToFill.decimalPlaces(
+ 2,
+ BigNumber.ROUND_DOWN,
+ );
if (roundedUnitAmountAvailableToFill.isGreaterThan(BIG_NUMBER_ZERO)) {
return `There are only ${roundedUnitAmountAvailableToFill} ${assetName} available to buy`;
diff --git a/packages/instant/src/util/format.ts b/packages/instant/src/util/format.ts
index eef332d3c..61aeb839f 100644
--- a/packages/instant/src/util/format.ts
+++ b/packages/instant/src/util/format.ts
@@ -25,7 +25,7 @@ export const format = {
if (_.isUndefined(ethUnitAmount)) {
return defaultText;
}
- let roundedAmount = ethUnitAmount.integerValue(decimalPlaces).toDigits(decimalPlaces);
+ let roundedAmount = ethUnitAmount.decimalPlaces(decimalPlaces).precision(decimalPlaces);
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