Update ZeroExTransactionSchema
This commit is contained in:
parent
9552676783
commit
1ada679663
@ -1,6 +1,7 @@
|
||||
{
|
||||
"id": "/zeroExTransactionSchema",
|
||||
"properties": {
|
||||
"verifyingContractAddress": { "$ref": "/addressSchema" },
|
||||
"data": { "$ref": "/hexSchema" },
|
||||
"signerAddress": { "$ref": "/addressSchema" },
|
||||
"salt": { "$ref": "/wholeNumberSchema" }
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -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();
|
||||
});
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user