aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-10-09 19:13:10 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-10-09 19:13:10 +0800
commit7d2c975d7335155b85a7549c25b953d0afacf5cf (patch)
tree01a364d769f3eede04f4bd1e4a743784d39eea91 /packages/contracts/test/utils
parente5153737d8386380675f28dd7cda70deeb1ea37c (diff)
parent024bcf492ddbdceb033466aeadef220adc145332 (diff)
downloaddexon-sol-tools-7d2c975d7335155b85a7549c25b953d0afacf5cf.tar
dexon-sol-tools-7d2c975d7335155b85a7549c25b953d0afacf5cf.tar.gz
dexon-sol-tools-7d2c975d7335155b85a7549c25b953d0afacf5cf.tar.bz2
dexon-sol-tools-7d2c975d7335155b85a7549c25b953d0afacf5cf.tar.lz
dexon-sol-tools-7d2c975d7335155b85a7549c25b953d0afacf5cf.tar.xz
dexon-sol-tools-7d2c975d7335155b85a7549c25b953d0afacf5cf.tar.zst
dexon-sol-tools-7d2c975d7335155b85a7549c25b953d0afacf5cf.zip
Merge branch 'development'
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')}`,