aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/json-schemas/schemas/zero_ex_transaction_schema.json1
-rw-r--r--packages/order-utils/src/eip712_utils.ts9
-rw-r--r--packages/order-utils/test/eip712_utils_test.ts14
-rw-r--r--packages/types/src/index.ts5
4 files changed, 15 insertions, 14 deletions
diff --git a/packages/json-schemas/schemas/zero_ex_transaction_schema.json b/packages/json-schemas/schemas/zero_ex_transaction_schema.json
index 0c714f14d..726886e20 100644
--- a/packages/json-schemas/schemas/zero_ex_transaction_schema.json
+++ b/packages/json-schemas/schemas/zero_ex_transaction_schema.json
@@ -1,6 +1,7 @@
{
"id": "/zeroExTransactionSchema",
"properties": {
+ "verifyingContractAddress": { "$ref": "/addressSchema" },
"data": { "$ref": "/hexSchema" },
"signerAddress": { "$ref": "/addressSchema" },
"salt": { "$ref": "/wholeNumberSchema" }
diff --git a/packages/order-utils/src/eip712_utils.ts b/packages/order-utils/src/eip712_utils.ts
index 385fda989..646d9e301 100644
--- a/packages/order-utils/src/eip712_utils.ts
+++ b/packages/order-utils/src/eip712_utils.ts
@@ -63,11 +63,8 @@ export const eip712Utils = {
* @param exchangeAddress The address of the exchange contract
* @return A typed data object
*/
- createZeroExTransactionTypedData: (
- zeroExTransaction: ZeroExTransaction,
- exchangeAddress: string,
- ): EIP712TypedData => {
- assert.isETHAddressHex('exchangeAddress', exchangeAddress);
+ createZeroExTransactionTypedData: (zeroExTransaction: ZeroExTransaction): EIP712TypedData => {
+ assert.isETHAddressHex('verifyingContractAddress', zeroExTransaction.verifyingContractAddress);
assert.doesConformToSchema('zeroExTransaction', zeroExTransaction, schemas.zeroExTransactionSchema);
const normalizedTransaction = _.mapValues(zeroExTransaction, value => {
return !_.isString(value) ? value.toString() : value;
@@ -76,7 +73,7 @@ export const eip712Utils = {
constants.EIP712_ZEROEX_TRANSACTION_SCHEMA.name,
{ ZeroExTransaction: constants.EIP712_ZEROEX_TRANSACTION_SCHEMA.parameters },
normalizedTransaction,
- exchangeAddress,
+ zeroExTransaction.verifyingContractAddress,
);
return typedData;
},
diff --git a/packages/order-utils/test/eip712_utils_test.ts b/packages/order-utils/test/eip712_utils_test.ts
index a54e49958..fb9388fcc 100644
--- a/packages/order-utils/test/eip712_utils_test.ts
+++ b/packages/order-utils/test/eip712_utils_test.ts
@@ -29,14 +29,12 @@ describe('EIP712 Utils', () => {
});
describe('createTypedData', () => {
it('adds in the EIP712DomainSeparator', () => {
- const typedData = eip712Utils.createZeroExTransactionTypedData(
- {
- salt: new BigNumber('0'),
- data: constants.NULL_BYTES,
- signerAddress: constants.NULL_ADDRESS,
- },
- constants.NULL_ADDRESS,
- );
+ const typedData = eip712Utils.createZeroExTransactionTypedData({
+ salt: new BigNumber('0'),
+ data: constants.NULL_BYTES,
+ signerAddress: constants.NULL_ADDRESS,
+ verifyingContractAddress: constants.NULL_ADDRESS,
+ });
expect(typedData.primaryType).to.eq(constants.EIP712_ZEROEX_TRANSACTION_SCHEMA.name);
expect(typedData.types.EIP712Domain).to.not.be.undefined();
});
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 49f788fb0..ce124e289 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -45,11 +45,16 @@ export interface SignedOrder extends Order {
* ZeroExTransaction for use with 0x Exchange executeTransaction
*/
export interface ZeroExTransaction {
+ verifyingContractAddress: string;
salt: BigNumber;
signerAddress: string;
data: string;
}
+export interface SignedZeroExTransaction extends ZeroExTransaction {
+ signature: string;
+}
+
/**
* Elliptic Curve signature
*/