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/asset.ts | |
parent | f570f80674c22f69712c45e8e3c48e948b51f357 (diff) | |
download | dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.gz dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.zst dexon-sol-tools-c3afc13dd660348e99b727c2dd01930eec8d99c3.zip |
Upgrade bignumber.js version
Diffstat (limited to 'packages/instant/src/util/asset.ts')
-rw-r--r-- | packages/instant/src/util/asset.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts index 709561dbc..a6fd77d5a 100644 --- a/packages/instant/src/util/asset.ts +++ b/packages/instant/src/util/asset.ts @@ -104,8 +104,9 @@ export const assetUtils = { return assetDataGroupIfExists[Network.Mainnet]; }, getERC20AssetsFromAssets: (assets: Asset[]): ERC20Asset[] => { - const erc20sOrUndefined = _.map(assets, asset => - asset.metaData.assetProxyId === AssetProxyId.ERC20 ? (asset as ERC20Asset) : undefined, + const erc20sOrUndefined = _.map( + assets, + asset => (asset.metaData.assetProxyId === AssetProxyId.ERC20 ? (asset as ERC20Asset) : undefined), ); return _.compact(erc20sOrUndefined); }, @@ -114,15 +115,15 @@ 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.integerValue(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`; } } |