aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-23 05:58:03 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-23 06:39:03 +0800
commitb0b3f9e339cc470860f8c1080ab6dad145d70624 (patch)
treee6fa0def5441fed853a700deead0ac4a480dd045 /packages
parenta5c7ddcff54fcb9e88adfda15167836b00db877d (diff)
downloaddexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar.gz
dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.tar.zst
dexon-sol-tools-b0b3f9e339cc470860f8c1080ab6dad145d70624.zip
Add assertions to factory
Diffstat (limited to 'packages')
-rw-r--r--packages/forwarder-helper/package.json2
-rw-r--r--packages/forwarder-helper/src/forwarder_helper_factory.ts6
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,
-12-21 22:44:59 +0800'>2005-12-213-10/+17 * - Add SHA256pav2005-11-261-0/+1 * Reset inactive maintainers and update mastersites.linimon2005-10-192-4/+4 * Mark IGNORE, because this port attempts to create uid 73 with akris2004-12-311-0/+2 * fix install with BATCH=1 (for pointyhat)sem2004-08-05