aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/transaction_factory.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/utils/transaction_factory.ts')
-rw-r--r--packages/contracts/src/utils/transaction_factory.ts16
1 files changed, 3 insertions, 13 deletions
diff --git a/packages/contracts/src/utils/transaction_factory.ts b/packages/contracts/src/utils/transaction_factory.ts
index 1c1029d62..7aaf3691c 100644
--- a/packages/contracts/src/utils/transaction_factory.ts
+++ b/packages/contracts/src/utils/transaction_factory.ts
@@ -1,14 +1,9 @@
-import { crypto, generatePseudoRandomSalt } from '@0xproject/order-utils';
+import { crypto, EIP712Schema, EIP712Utils, generatePseudoRandomSalt } from '@0xproject/order-utils';
import { SignatureType } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
import * as ethUtil from 'ethereumjs-util';
-import * as _ from 'lodash';
-import { crypto } from './crypto';
-import { EIP712Utils } from './eip712_utils';
-import { orderUtils } from './order_utils';
import { signingUtils } from './signing_utils';
-import { EIP712Schema, SignatureType, SignedTransaction } from './types';
+import { SignedTransaction } from './types';
const EIP712_EXECUTE_TRANSACTION_SCHEMA: EIP712Schema = {
name: 'ExecuteTransaction',
@@ -30,20 +25,15 @@ export class TransactionFactory {
}
public newSignedTransaction(data: string, signatureType: SignatureType = SignatureType.EthSign): SignedTransaction {
const executeTransactionSchemaHashBuff = EIP712Utils.compileSchema(EIP712_EXECUTE_TRANSACTION_SCHEMA);
-
const salt = generatePseudoRandomSalt();
const dataHash = crypto.solSHA3([ethUtil.toBuffer(data)]);
-
const executeTransactionDataHash = crypto.solSHA3([
executeTransactionSchemaHashBuff,
salt,
EIP712Utils.pad32Buffer(this._signerBuff),
dataHash,
]);
-
- const executeTransactionMessageHex = `0x${executeTransactionDataHash.toString('hex')}`;
-
- const txHash = EIP712Utils.createEIP712Message(executeTransactionMessageHex, this._exchangeAddress);
+ const txHash = EIP712Utils.createEIP712Message(executeTransactionDataHash, this._exchangeAddress);
const signature = signingUtils.signMessage(txHash, this._privateKey, signatureType);
const signedTx = {
exchangeAddress: this._exchangeAddress,