diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-23 05:58:03 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-23 06:39:03 +0800 |
commit | b0b3f9e339cc470860f8c1080ab6dad145d70624 (patch) | |
tree | e6fa0def5441fed853a700deead0ac4a480dd045 /packages/forwarder-helper | |
parent | a5c7ddcff54fcb9e88adfda15167836b00db877d (diff) | |
download | dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar.gz dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar.bz2 dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar.lz dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar.xz dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar.zst dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.zip |
Add assertions to factory
Diffstat (limited to 'packages/forwarder-helper')
-rw-r--r-- | packages/forwarder-helper/package.json | 2 | ||||
-rw-r--r-- | packages/forwarder-helper/src/forwarder_helper_factory.ts | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index d5f6c52b6..3a84e4620 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -47,6 +47,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/forwarder-helper/README.md", "dependencies": { + "@0xproject/assert": "^1.0.5", + "@0xproject/json-schemas": "^1.0.1-rc.4", "@0xproject/order-utils": "^1.0.1-rc.3", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", diff --git a/packages/forwarder-helper/src/forwarder_helper_factory.ts b/packages/forwarder-helper/src/forwarder_helper_factory.ts index 0fb02e3a6..95f11f555 100644 --- a/packages/forwarder-helper/src/forwarder_helper_factory.ts +++ b/packages/forwarder-helper/src/forwarder_helper_factory.ts @@ -1,3 +1,5 @@ +import { assert } from '@0xproject/assert'; +import { schemas } from '@0xproject/json-schemas'; import { SignedOrder } from '@0xproject/types'; import { ForwarderHelperImpl, ForwarderHelperImplConfig } from './forwarder_helper_impl'; @@ -7,10 +9,12 @@ export const forwarderHelperFactory = { /** * Given an array of orders and an array of feeOrders * @param orders An array of objects conforming to SignedOrder. Each order should specify the same makerAssetData and takerAssetData - * @param orders An array of objects conforming to SignedOrder. Each order should specify ZRX as makerAssetData WETH as takerAssetData + * @param feeOrders An array of objects conforming to SignedOrder. Each order should specify ZRX as makerAssetData WETH as takerAssetData * @return A ForwarderHelper, see type for definition */ getForwarderHelperForOrders(orders: SignedOrder[], feeOrders: SignedOrder[] = []): ForwarderHelper { + assert.doesConformToSchema('orders', orders, schemas.signedOrdersSchema); + assert.doesConformToSchema('feeOrders', orders, schemas.signedOrdersSchema); const config: ForwarderHelperImplConfig = { orders, feeOrders, |