diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-09-21 22:24:45 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-09-21 22:24:45 +0800 |
commit | 1bfaefb240d08eb0a8a5d6743d529604383f6e43 (patch) | |
tree | 0e8fa7a2bc46ba2fcd312f213a1686774f7eaffe /packages/asset-buyer/src/asset_buyer.ts | |
parent | c48cf3ab3b74a9082eb30540115534c7432667ac (diff) | |
download | dexon-sol-tools-1bfaefb240d08eb0a8a5d6743d529604383f6e43.tar dexon-sol-tools-1bfaefb240d08eb0a8a5d6743d529604383f6e43.tar.gz dexon-sol-tools-1bfaefb240d08eb0a8a5d6743d529604383f6e43.tar.bz2 dexon-sol-tools-1bfaefb240d08eb0a8a5d6743d529604383f6e43.tar.lz dexon-sol-tools-1bfaefb240d08eb0a8a5d6743d529604383f6e43.tar.xz dexon-sol-tools-1bfaefb240d08eb0a8a5d6743d529604383f6e43.tar.zst dexon-sol-tools-1bfaefb240d08eb0a8a5d6743d529604383f6e43.zip |
Add order provider response validation
Diffstat (limited to 'packages/asset-buyer/src/asset_buyer.ts')
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 9774a8d39..03f9b5a2b 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -269,6 +269,10 @@ export class AssetBuyer { const [targetOrderProviderResponse, feeOrderProviderResponse] = await Promise.all( _.map(requests, async request => this.orderProvider.getOrdersAsync(request)), ); + // since the order provider is an injected dependency, validate that it respects the API + // ie. it should only return maker/taker assetDatas that are specified + orderProviderResponseProcessor.throwIfInvalidResponse(targetOrderProviderResponse, targetOrderProviderRequest); + orderProviderResponseProcessor.throwIfInvalidResponse(feeOrderProviderResponse, feeOrderProviderRequest); // process the responses into one object const ordersAndFillableAmounts = await orderProviderResponseProcessor.processAsync( targetOrderProviderResponse, |