Use more specific helper method decodeAssetDataOrThrow

This commit is contained in:
Steve Klebanoff
2019-01-16 17:12:08 -08:00
parent ff8250cd35
commit 92f5ad4f15
2 changed files with 4 additions and 5 deletions

View File

@@ -193,7 +193,7 @@ export class AssetBuyer {
): Promise<LiquidityForAssetData> {
const shouldForceOrderRefresh =
options.shouldForceOrderRefresh !== undefined ? options.shouldForceOrderRefresh : false;
assert.isString('assetData', assetData);
assetDataUtils.decodeAssetDataOrThrow(assetData);
assert.isBoolean('options.shouldForceOrderRefresh', shouldForceOrderRefresh);
const assetPairs = await this.orderProvider.getAvailableMakerAssetDatasAsync(assetData);

View File

@@ -156,10 +156,9 @@ export const hasLiquidityForAssetDataAsync = async (
const assetBuyerOptions = { networkId };
const assetBuyer =
typeof orderSource === 'string'
? AssetBuyer.getAssetBuyerForStandardRelayerAPIUrl(bestProvider, orderSource, assetBuyerOptions)
: AssetBuyer.getAssetBuyerForProvidedOrders(bestProvider, orderSource, assetBuyerOptions);
const assetBuyer = _.isString(orderSource)
? AssetBuyer.getAssetBuyerForStandardRelayerAPIUrl(bestProvider, orderSource, assetBuyerOptions)
: AssetBuyer.getAssetBuyerForProvidedOrders(bestProvider, orderSource, assetBuyerOptions);
const liquidity = await assetBuyer.getLiquidityForAssetDataAsync(assetData);
return liquidity.ethValueAvailableInWei.gt(new BigNumber(0));