From 10e6c3cd906c6625ed0c9ae98d20ef9f32676cbe Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 29 Oct 2018 15:48:45 -0700 Subject: feat: remove isValidProvided orders validation --- packages/asset-buyer/src/asset_buyer.ts | 1 - packages/asset-buyer/src/utils/assert.ts | 15 --------------- 2 files changed, 16 deletions(-) (limited to 'packages/asset-buyer') diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 34e2d9639..ed52f2d9d 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -56,7 +56,6 @@ export class AssetBuyer { ): AssetBuyer { assert.isWeb3Provider('provider', provider); assert.doesConformToSchema('orders', orders, schemas.signedOrdersSchema); - assert.areValidProvidedOrders('orders', orders); assert.assert(orders.length !== 0, `Expected orders to contain at least one order`); const orderProvider = new BasicOrderProvider(orders); const assetBuyer = new AssetBuyer(provider, orderProvider, options); diff --git a/packages/asset-buyer/src/utils/assert.ts b/packages/asset-buyer/src/utils/assert.ts index e8cb7f763..7e4eb7175 100644 --- a/packages/asset-buyer/src/utils/assert.ts +++ b/packages/asset-buyer/src/utils/assert.ts @@ -31,21 +31,6 @@ export const assert = { sharedAssert.isHexString(`${variableName}.takerAssetData`, orderFetcherRequest.takerAssetData); sharedAssert.isNumber(`${variableName}.networkId`, orderFetcherRequest.networkId); }, - areValidProvidedOrders(variableName: string, orders: SignedOrder[]): void { - if (orders.length === 0) { - return; - } - const makerAssetData = orders[0].makerAssetData; - const takerAssetData = orders[0].takerAssetData; - const filteredOrders = _.filter( - orders, - order => order.makerAssetData === makerAssetData && order.takerAssetData === takerAssetData, - ); - sharedAssert.assert( - orders.length === filteredOrders.length, - `Expected all orders in ${variableName} to have the same makerAssetData and takerAssetData.`, - ); - }, isValidPercentage(variableName: string, percentage: number): void { assert.isNumber(variableName, percentage); assert.assert( -- cgit From 17f024056a56ae1b67a3a674f24460172ae84d27 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 29 Oct 2018 15:50:54 -0700 Subject: chore: add changelog --- packages/asset-buyer/CHANGELOG.json | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/asset-buyer') diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json index 5d6604ea9..ce4effa7e 100644 --- a/packages/asset-buyer/CHANGELOG.json +++ b/packages/asset-buyer/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "`getAssetBuyerForProvidedOrders` factory function now takes 3 args instead of 4", "pr": 1187 + }, + { + "note": "No longer require that provided orders all have the same maker and taker asset data", + "pr": 1197 } ] }, -- cgit From 59ad2b75c107071d9543f70ffd60fe651134c742 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 31 Oct 2018 13:29:20 -0700 Subject: chore: remove unused import --- packages/asset-buyer/src/utils/assert.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'packages/asset-buyer') diff --git a/packages/asset-buyer/src/utils/assert.ts b/packages/asset-buyer/src/utils/assert.ts index 7e4eb7175..0f39fb4a5 100644 --- a/packages/asset-buyer/src/utils/assert.ts +++ b/packages/asset-buyer/src/utils/assert.ts @@ -1,6 +1,5 @@ import { assert as sharedAssert } from '@0x/assert'; import { schemas } from '@0x/json-schemas'; -import { SignedOrder } from '@0x/types'; import * as _ from 'lodash'; import { BuyQuote, BuyQuoteInfo, OrderProvider, OrderProviderRequest } from '../types'; -- cgit