From ff8250cd3567a276490342a820bf9428257a0c7c Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Wed, 16 Jan 2019 15:45:01 -0800 Subject: change helper method to return a boolean --- packages/instant/src/index.umd.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts index 5c0ab8eae..5ef2e1695 100644 --- a/packages/instant/src/index.umd.ts +++ b/packages/instant/src/index.umd.ts @@ -1,4 +1,4 @@ -import { AssetBuyer } from '@0x/asset-buyer'; +import { AssetBuyer, BigNumber } from '@0x/asset-buyer'; import { assetDataUtils } from '@0x/order-utils'; import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; @@ -138,12 +138,12 @@ export const hasMetaDataForAssetData = (assetData: string): boolean => { return assetMetaDataMap[assetData] !== undefined; }; -export const getLiquidityForAssetDataAsync = async ( +export const hasLiquidityForAssetDataAsync = async ( assetData: string, orderSource: OrderSource, networkId: Network = Network.Mainnet, provider?: Provider, -) => { +): Promise => { assert.isHexString('assetData', assetData); assert.isValidOrderSource('orderSource', orderSource); assert.isNumber('networkId', networkId); @@ -161,7 +161,8 @@ export const getLiquidityForAssetDataAsync = async ( ? AssetBuyer.getAssetBuyerForStandardRelayerAPIUrl(bestProvider, orderSource, assetBuyerOptions) : AssetBuyer.getAssetBuyerForProvidedOrders(bestProvider, orderSource, assetBuyerOptions); - return assetBuyer.getLiquidityForAssetDataAsync(assetData); + const liquidity = await assetBuyer.getLiquidityForAssetDataAsync(assetData); + return liquidity.ethValueAvailableInWei.gt(new BigNumber(0)); }; // Write version info to the exported object for debugging -- cgit v1.2.3