aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-10 09:25:14 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-10 09:25:14 +0800
commit2bd8cbb80cadc922ca13582a1f15d63815118205 (patch)
treef81ae5e91e720fe228d83b0e8af0fc676f35b7c5 /packages/contracts/test/utils
parent941448d65cc42870a93e0430158bfd7ab52fd2cd (diff)
parentafb34da72978b5272cfb5a235498e483c72556bc (diff)
downloaddexon-0x-contracts-2bd8cbb80cadc922ca13582a1f15d63815118205.tar
dexon-0x-contracts-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.gz
dexon-0x-contracts-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.bz2
dexon-0x-contracts-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.lz
dexon-0x-contracts-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.xz
dexon-0x-contracts-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.zst
dexon-0x-contracts-2bd8cbb80cadc922ca13582a1f15d63815118205.zip
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/redux-styles-container
Diffstat (limited to 'packages/contracts/test/utils')
-rw-r--r--packages/contracts/test/utils/transaction_factory.ts22
1 files changed, 6 insertions, 16 deletions
diff --git a/packages/contracts/test/utils/transaction_factory.ts b/packages/contracts/test/utils/transaction_factory.ts
index 8465a6a30..9ed4c5a31 100644
--- a/packages/contracts/test/utils/transaction_factory.ts
+++ b/packages/contracts/test/utils/transaction_factory.ts
@@ -1,19 +1,11 @@
-import { EIP712Schema, EIP712Types, eip712Utils, generatePseudoRandomSalt } from '@0xproject/order-utils';
+import { eip712Utils, generatePseudoRandomSalt } from '@0xproject/order-utils';
import { SignatureType } from '@0xproject/types';
+import { signTypedDataUtils } from '@0xproject/utils';
import * as ethUtil from 'ethereumjs-util';
import { signingUtils } from './signing_utils';
import { SignedTransaction } from './types';
-const EIP712_ZEROEX_TRANSACTION_SCHEMA: EIP712Schema = {
- name: 'ZeroExTransaction',
- parameters: [
- { name: 'salt', type: EIP712Types.Uint256 },
- { name: 'signerAddress', type: EIP712Types.Address },
- { name: 'data', type: EIP712Types.Bytes },
- ],
-};
-
export class TransactionFactory {
private readonly _signerBuff: Buffer;
private readonly _exchangeAddress: string;
@@ -31,12 +23,10 @@ export class TransactionFactory {
signerAddress,
data,
};
- const executeTransactionHashBuff = eip712Utils.structHash(
- EIP712_ZEROEX_TRANSACTION_SCHEMA,
- executeTransactionData,
- );
- const txHash = eip712Utils.createEIP712Message(executeTransactionHashBuff, this._exchangeAddress);
- const signature = signingUtils.signMessage(txHash, this._privateKey, signatureType);
+
+ const typedData = eip712Utils.createZeroExTransactionTypedData(executeTransactionData, this._exchangeAddress);
+ const eip712MessageBuffer = signTypedDataUtils.generateTypedDataHash(typedData);
+ const signature = signingUtils.signMessage(eip712MessageBuffer, this._privateKey, signatureType);
const signedTx = {
exchangeAddress: this._exchangeAddress,
signature: `0x${signature.toString('hex')}`,