aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-15 07:18:20 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-15 07:34:45 +0800
commit69054d85e80f9e41200015a9b0eef2a9fe00f439 (patch)
treec8296279c2f51518940cc772a26e626f5931e9de /packages/instant
parent3e596f6a8c211eb39917cfd2a9a68a6facf2c904 (diff)
downloaddexon-sol-tools-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar
dexon-sol-tools-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.gz
dexon-sol-tools-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.bz2
dexon-sol-tools-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.lz
dexon-sol-tools-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.xz
dexon-sol-tools-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.zst
dexon-sol-tools-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')
-rw-r--r--packages/instant/src/util/asset.ts6
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,