Fix outdated comments and make verifyingContractAddress a required part of the 0x tx schema
This commit is contained in:
parent
8246dec843
commit
eac254f925
@ -6,6 +6,6 @@
|
||||
"signerAddress": { "$ref": "/addressSchema" },
|
||||
"salt": { "$ref": "/wholeNumberSchema" }
|
||||
},
|
||||
"required": ["data", "salt", "signerAddress"],
|
||||
"required": ["verifyingContractAddress", "data", "salt", "signerAddress"],
|
||||
"type": "object"
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user