aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2019-02-05 01:48:11 +0800
committerAmir Bandeali <abandeali1@gmail.com>2019-02-06 01:26:03 +0800
commiteac254f9256499fda4cd3d739410c8180069e0c7 (patch)
treea942c10d728641bda816f3cdaa3d2e9e72853d40
parent8246dec84342138319b9eaf4778862a8e4770851 (diff)
downloaddexon-0x-contracts-eac254f9256499fda4cd3d739410c8180069e0c7.tar
dexon-0x-contracts-eac254f9256499fda4cd3d739410c8180069e0c7.tar.gz
dexon-0x-contracts-eac254f9256499fda4cd3d739410c8180069e0c7.tar.bz2
dexon-0x-contracts-eac254f9256499fda4cd3d739410c8180069e0c7.tar.lz
dexon-0x-contracts-eac254f9256499fda4cd3d739410c8180069e0c7.tar.xz
dexon-0x-contracts-eac254f9256499fda4cd3d739410c8180069e0c7.tar.zst
dexon-0x-contracts-eac254f9256499fda4cd3d739410c8180069e0c7.zip
Fix outdated comments and make verifyingContractAddress a required part of the 0x tx schema
-rw-r--r--packages/json-schemas/schemas/zero_ex_transaction_schema.json2
-rw-r--r--packages/order-utils/src/order_hash.ts11
-rw-r--r--packages/order-utils/test/order_hash_test.ts5
3 files changed, 11 insertions, 7 deletions
diff --git a/packages/json-schemas/schemas/zero_ex_transaction_schema.json b/packages/json-schemas/schemas/zero_ex_transaction_schema.json
index 726886e20..ffdf1f229 100644
--- a/packages/json-schemas/schemas/zero_ex_transaction_schema.json
+++ b/packages/json-schemas/schemas/zero_ex_transaction_schema.json
@@ -6,6 +6,6 @@
"signerAddress": { "$ref": "/addressSchema" },
"salt": { "$ref": "/wholeNumberSchema" }
},
- "required": ["data", "salt", "signerAddress"],
+ "required": ["verifyingContractAddress", "data", "salt", "signerAddress"],
"type": "object"
}
diff --git a/packages/order-utils/src/order_hash.ts b/packages/order-utils/src/order_hash.ts
index 3bc23c14e..ce7e6d85f 100644
--- a/packages/order-utils/src/order_hash.ts
+++ b/packages/order-utils/src/order_hash.ts
@@ -4,6 +4,7 @@ import { signTypedDataUtils } from '@0x/utils';
import * as _ from 'lodash';
import { assert } from './assert';
+import { constants } from './constants';
import { eip712Utils } from './eip712_utils';
const INVALID_TAKER_FORMAT = 'instance.takerAddress is not of a type(s) string';
@@ -34,8 +35,9 @@ export const orderHashUtils = {
assert.doesConformToSchema('order', order, schemas.orderSchema, [schemas.hexSchema]);
} catch (error) {
if (_.includes(error.message, INVALID_TAKER_FORMAT)) {
- const errMsg =
- 'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS';
+ const errMsg = `Order taker must be of type string. If you want anyone to be able to fill an order - pass ${
+ constants.NULL_ADDRESS
+ }`;
throw new Error(errMsg);
}
throw error;
@@ -55,8 +57,9 @@ export const orderHashUtils = {
assert.doesConformToSchema('order', order, schemas.orderSchema, [schemas.hexSchema]);
} catch (error) {
if (_.includes(error.message, INVALID_TAKER_FORMAT)) {
- const errMsg =
- 'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS';
+ const errMsg = `Order taker must be of type string. If you want anyone to be able to fill an order - pass ${
+ constants.NULL_ADDRESS
+ }`;
throw new Error(errMsg);
}
throw error;
diff --git a/packages/order-utils/test/order_hash_test.ts b/packages/order-utils/test/order_hash_test.ts
index 30fb15a37..514fc2709 100644
--- a/packages/order-utils/test/order_hash_test.ts
+++ b/packages/order-utils/test/order_hash_test.ts
@@ -54,8 +54,9 @@ describe('Order hashing', () => {
...order,
takerAddress: (null as any) as string,
};
- const expectedErrorMessage =
- 'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS';
+ const expectedErrorMessage = `Order taker must be of type string. If you want anyone to be able to fill an order - pass ${
+ constants.NULL_ADDRESS
+ }`;
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
});
});