@0x/order-utils: Fix EP signature utils schema assertion.

This commit is contained in:
Lawrence Forman 2020-08-19 12:14:26 -04:00 committed by Lawrence Forman
parent 6aa8f17ed5
commit d31d646ecc
2 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,10 @@
{ {
"note": "Add `findTransformerNonce()` and `getTransformerAddress()` functions.", "note": "Add `findTransformerNonce()` and `getTransformerAddress()` functions.",
"pr": 2657 "pr": 2657
},
{
"note": "Fix EP signature utils schema assertion.",
"pr": 2657
} }
] ]
}, },

View File

@ -206,7 +206,9 @@ export const signatureUtils = {
transaction: ExchangeProxyMetaTransaction, transaction: ExchangeProxyMetaTransaction,
signerAddress: string, signerAddress: string,
): Promise<SignedExchangeProxyMetaTransaction> { ): Promise<SignedExchangeProxyMetaTransaction> {
assert.doesConformToSchema('transaction', transaction, schemas.zeroExTransactionSchema, [schemas.hexSchema]); assert.doesConformToSchema('transaction', transaction, schemas.exchangeProxyMetaTransactionSchema, [
schemas.hexSchema,
]);
try { try {
const signedTransaction = await signatureUtils.ecSignTypedDataExchangeProxyMetaTransactionAsync( const signedTransaction = await signatureUtils.ecSignTypedDataExchangeProxyMetaTransactionAsync(
supportedProvider, supportedProvider,
@ -253,7 +255,9 @@ export const signatureUtils = {
): Promise<SignedExchangeProxyMetaTransaction> { ): Promise<SignedExchangeProxyMetaTransaction> {
const provider = providerUtils.standardizeOrThrow(supportedProvider); const provider = providerUtils.standardizeOrThrow(supportedProvider);
assert.isETHAddressHex('signerAddress', signerAddress); assert.isETHAddressHex('signerAddress', signerAddress);
assert.doesConformToSchema('transaction', transaction, schemas.zeroExTransactionSchema, [schemas.hexSchema]); assert.doesConformToSchema('transaction', transaction, schemas.exchangeProxyMetaTransactionSchema, [
schemas.hexSchema,
]);
const web3Wrapper = new Web3Wrapper(provider); const web3Wrapper = new Web3Wrapper(provider);
await assert.isSenderAddressAsync('signerAddress', signerAddress, web3Wrapper); await assert.isSenderAddressAsync('signerAddress', signerAddress, web3Wrapper);
const normalizedSignerAddress = signerAddress.toLowerCase(); const normalizedSignerAddress = signerAddress.toLowerCase();