aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src/utils/transaction_encoder.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-11 20:25:47 +0800
committerFabio Berger <me@fabioberger.com>2018-10-11 20:25:47 +0800
commit295a8c760a6d5b567a12d6a2d83ae73021ea343c (patch)
treefaf6810a6b5b810869e36c20641fd4fe25e03ddb /packages/contract-wrappers/src/utils/transaction_encoder.ts
parent9b147f14955c5f6a0b38e03ae30ac13b1be183d1 (diff)
parent1cfcc82ea9869e14c1a1b78e1376c89fdbeb91f4 (diff)
downloaddexon-0x-contracts-295a8c760a6d5b567a12d6a2d83ae73021ea343c.tar.gz
dexon-0x-contracts-295a8c760a6d5b567a12d6a2d83ae73021ea343c.tar.zst
dexon-0x-contracts-295a8c760a6d5b567a12d6a2d83ae73021ea343c.zip
merge dev-section-redesign
Diffstat (limited to 'packages/contract-wrappers/src/utils/transaction_encoder.ts')
-rw-r--r--packages/contract-wrappers/src/utils/transaction_encoder.ts22
1 files changed, 5 insertions, 17 deletions
diff --git a/packages/contract-wrappers/src/utils/transaction_encoder.ts b/packages/contract-wrappers/src/utils/transaction_encoder.ts
index 87cbb43fd..33086944b 100644
--- a/packages/contract-wrappers/src/utils/transaction_encoder.ts
+++ b/packages/contract-wrappers/src/utils/transaction_encoder.ts
@@ -1,22 +1,13 @@
import { schemas } from '@0xproject/json-schemas';
-import { EIP712Schema, EIP712Types, eip712Utils } from '@0xproject/order-utils';
+import { eip712Utils } from '@0xproject/order-utils';
import { Order, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, signTypedDataUtils } from '@0xproject/utils';
import _ = require('lodash');
import { ExchangeContract } from '../contract_wrappers/generated/exchange';
import { assert } from './assert';
-const EIP712_ZEROEX_TRANSACTION_SCHEMA: EIP712Schema = {
- name: 'ZeroExTransaction',
- parameters: [
- { name: 'salt', type: EIP712Types.Uint256 },
- { name: 'signerAddress', type: EIP712Types.Address },
- { name: 'data', type: EIP712Types.Bytes },
- ],
-};
-
/**
* Transaction Encoder. Transaction messages exist for the purpose of calling methods on the Exchange contract
* in the context of another address. For example, UserA can encode and sign a fillOrder transaction and UserB
@@ -41,12 +32,9 @@ export class TransactionEncoder {
signerAddress,
data,
};
- const executeTransactionHashBuff = eip712Utils.structHash(
- EIP712_ZEROEX_TRANSACTION_SCHEMA,
- executeTransactionData,
- );
- const eip721MessageBuffer = eip712Utils.createEIP712Message(executeTransactionHashBuff, exchangeAddress);
- const messageHex = `0x${eip721MessageBuffer.toString('hex')}`;
+ const typedData = eip712Utils.createZeroExTransactionTypedData(executeTransactionData, exchangeAddress);
+ const eip712MessageBuffer = signTypedDataUtils.generateTypedDataHash(typedData);
+ const messageHex = `0x${eip712MessageBuffer.toString('hex')}`;
return messageHex;
}
/**