aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-17 07:45:01 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-17 07:45:01 +0800
commitff8250cd3567a276490342a820bf9428257a0c7c (patch)
tree7037c04d1926805c665b1895fae254d4c7d6b383 /packages
parent466ec6b22a51f0a9d618f6091ce6f9f533118280 (diff)
downloaddexon-sol-tools-ff8250cd3567a276490342a820bf9428257a0c7c.tar
dexon-sol-tools-ff8250cd3567a276490342a820bf9428257a0c7c.tar.gz
dexon-sol-tools-ff8250cd3567a276490342a820bf9428257a0c7c.tar.bz2
dexon-sol-tools-ff8250cd3567a276490342a820bf9428257a0c7c.tar.lz
dexon-sol-tools-ff8250cd3567a276490342a820bf9428257a0c7c.tar.xz
dexon-sol-tools-ff8250cd3567a276490342a820bf9428257a0c7c.tar.zst
dexon-sol-tools-ff8250cd3567a276490342a820bf9428257a0c7c.zip
change helper method to return a boolean
Diffstat (limited to 'packages')
-rw-r--r--packages/instant/src/index.umd.ts9
1 files 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<boolean> => {
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