diff options
author | fragosti <francesco.agosti93@gmail.com> | 2019-01-25 04:05:44 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2019-01-25 04:05:44 +0800 |
commit | 5b06595a6b6d459d53840d066fb204c0a9e3ed02 (patch) | |
tree | a5e9ed5c805cd69bd2f78525ac5b02cb9cdebdbf /packages/instant/src/util/asset.ts | |
parent | 44aafe4d78059267c9279fdf747fd51e6c3b26e1 (diff) | |
parent | 92cbff67d196abc7755e82087dbb1831485485d1 (diff) | |
download | dexon-0x-contracts-5b06595a6b6d459d53840d066fb204c0a9e3ed02.tar dexon-0x-contracts-5b06595a6b6d459d53840d066fb204c0a9e3ed02.tar.gz dexon-0x-contracts-5b06595a6b6d459d53840d066fb204c0a9e3ed02.tar.bz2 dexon-0x-contracts-5b06595a6b6d459d53840d066fb204c0a9e3ed02.tar.lz dexon-0x-contracts-5b06595a6b6d459d53840d066fb204c0a9e3ed02.tar.xz dexon-0x-contracts-5b06595a6b6d459d53840d066fb204c0a9e3ed02.tar.zst dexon-0x-contracts-5b06595a6b6d459d53840d066fb204c0a9e3ed02.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into development
Diffstat (limited to 'packages/instant/src/util/asset.ts')
-rw-r--r-- | packages/instant/src/util/asset.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts index 709561dbc..b5c97913d 100644 --- a/packages/instant/src/util/asset.ts +++ b/packages/instant/src/util/asset.ts @@ -114,15 +114,18 @@ export const assetUtils = { const assetName = assetUtils.bestNameForAsset(asset, 'of this asset'); if ( error instanceof InsufficientAssetLiquidityError && - error.amountAvailableToFill.greaterThan(BIG_NUMBER_ZERO) + error.amountAvailableToFill.isGreaterThan(BIG_NUMBER_ZERO) ) { const unitAmountAvailableToFill = Web3Wrapper.toUnitAmount( error.amountAvailableToFill, asset.metaData.decimals, ); - const roundedUnitAmountAvailableToFill = unitAmountAvailableToFill.round(2, BigNumber.ROUND_DOWN); + const roundedUnitAmountAvailableToFill = unitAmountAvailableToFill.decimalPlaces( + 2, + BigNumber.ROUND_DOWN, + ); - if (roundedUnitAmountAvailableToFill.greaterThan(BIG_NUMBER_ZERO)) { + if (roundedUnitAmountAvailableToFill.isGreaterThan(BIG_NUMBER_ZERO)) { return `There are only ${roundedUnitAmountAvailableToFill} ${assetName} available to buy`; } } |