diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 07:18:20 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 07:34:45 +0800 |
commit | 69054d85e80f9e41200015a9b0eef2a9fe00f439 (patch) | |
tree | c8296279c2f51518940cc772a26e626f5931e9de /packages/instant/src/util/asset.ts | |
parent | 3e596f6a8c211eb39917cfd2a9a68a6facf2c904 (diff) | |
download | dexon-0x-contracts-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.gz dexon-0x-contracts-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.zst dexon-0x-contracts-69054d85e80f9e41200015a9b0eef2a9fe00f439.zip |
Only send in amountAvailableToFill if it's a non-zero amount, add additional tests and nest, and put error into its own file
Diffstat (limited to 'packages/instant/src/util/asset.ts')
-rw-r--r-- | packages/instant/src/util/asset.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts index 5e83e7e6d..756194f1f 100644 --- a/packages/instant/src/util/asset.ts +++ b/packages/instant/src/util/asset.ts @@ -113,7 +113,11 @@ export const assetUtils = { assetBuyerErrorMessage: (asset: ERC20Asset, error: Error): string | undefined => { if (error.message === AssetBuyerError.InsufficientAssetLiquidity) { const assetName = assetUtils.bestNameForAsset(asset, 'of this asset'); - if (error instanceof InsufficientAssetLiquidityError) { + if ( + error instanceof InsufficientAssetLiquidityError && + error.amountAvailableToFill && + error.amountAvailableToFill.greaterThan(BIG_NUMBER_ZERO) + ) { const unitAmountAvailableToFill = Web3Wrapper.toUnitAmount( error.amountAvailableToFill, asset.metaData.decimals, |