diff options
Diffstat (limited to 'contracts/test-utils')
-rw-r--r-- | contracts/test-utils/CHANGELOG.json | 25 | ||||
-rw-r--r-- | contracts/test-utils/CHANGELOG.md | 13 | ||||
-rw-r--r-- | contracts/test-utils/package.json | 30 | ||||
-rw-r--r-- | contracts/test-utils/src/index.ts | 1 | ||||
-rw-r--r-- | contracts/test-utils/src/transaction_factory.ts | 26 | ||||
-rw-r--r-- | contracts/test-utils/src/types.ts | 8 |
6 files changed, 65 insertions, 38 deletions
diff --git a/contracts/test-utils/CHANGELOG.json b/contracts/test-utils/CHANGELOG.json index ae1575e43..b789f2907 100644 --- a/contracts/test-utils/CHANGELOG.json +++ b/contracts/test-utils/CHANGELOG.json @@ -1,12 +1,35 @@ [ { + "version": "3.0.2", + "changes": [ + { + "note": "Fake publish to enable pinning" + } + ], + "timestamp": 1549504360 + }, + { + "timestamp": 1549452781, + "version": "3.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "version": "3.0.0", "changes": [ { "note": "Upgrade the bignumber.js to v8.0.2", "pr": 1517 + }, + { + "note": "Import `ZeroExTransaction` type instead of using type defined in this package", + "pr": 1576 } - ] + ], + "timestamp": 1549373905 }, { "timestamp": 1547747677, diff --git a/contracts/test-utils/CHANGELOG.md b/contracts/test-utils/CHANGELOG.md index 2ed0524a6..222a6a93d 100644 --- a/contracts/test-utils/CHANGELOG.md +++ b/contracts/test-utils/CHANGELOG.md @@ -5,6 +5,19 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.2 - _February 7, 2019_ + + * Fake publish to enable pinning + +## v3.0.1 - _February 6, 2019_ + + * Dependencies updated + +## v3.0.0 - _February 5, 2019_ + + * Upgrade the bignumber.js to v8.0.2 (#1517) + * Import `ZeroExTransaction` type instead of using type defined in this package (#1576) + ## v2.0.1 - _January 17, 2019_ * Dependencies updated diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json index 262b8c7cd..0b8478e05 100644 --- a/contracts/test-utils/package.json +++ b/contracts/test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-test-utils", - "version": "2.0.1", + "version": "3.0.2", "engines": { "node": ">=6.12" }, @@ -40,19 +40,19 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/abi-gen": "^1.0.22", - "@0x/dev-utils": "^1.0.24", - "@0x/order-utils": "^3.1.2", - "@0x/sol-compiler": "^2.0.2", - "@0x/sol-coverage": "^1.0.3", - "@0x/sol-profiler": "^1.0.3", - "@0x/sol-trace": "^1.0.3", - "@0x/subproviders": "^2.1.11", - "@0x/tslint-config": "^2.0.2", - "@0x/types": "^1.5.2", - "@0x/typescript-typings": "^3.0.8", - "@0x/utils": "^3.0.1", - "@0x/web3-wrapper": "^3.2.4", + "@0x/abi-gen": "^2.0.1", + "@0x/dev-utils": "^2.0.1", + "@0x/order-utils": "^6.0.0", + "@0x/sol-compiler": "^3.0.1", + "@0x/sol-coverage": "^2.0.1", + "@0x/sol-profiler": "^2.0.2", + "@0x/sol-trace": "^2.0.2", + "@0x/subproviders": "^3.0.1", + "@0x/tslint-config": "^3.0.0", + "@0x/types": "^2.0.1", + "@0x/typescript-typings": "^4.0.0", + "@0x/utils": "^4.0.2", + "@0x/web3-wrapper": "^4.0.1", "@types/bn.js": "^4.11.0", "@types/js-combinatorics": "^0.5.29", "@types/lodash": "4.14.104", @@ -62,7 +62,7 @@ "chai-as-promised": "^7.1.0", "chai-bignumber": "^3.0.0", "dirty-chai": "^2.0.1", - "ethereum-types": "^1.1.6", + "ethereum-types": "^2.0.0", "ethereumjs-util": "^5.1.1", "ethers": "~4.0.4", "js-combinatorics": "^0.5.3", diff --git a/contracts/test-utils/src/index.ts b/contracts/test-utils/src/index.ts index 7880de0bf..5ac927e47 100644 --- a/contracts/test-utils/src/index.ts +++ b/contracts/test-utils/src/index.ts @@ -31,7 +31,6 @@ export { MarketBuyOrders, MarketSellOrders, ERC721TokenIdsByOwner, - SignedTransaction, OrderStatus, AllowanceAmountScenario, AssetDataScenario, diff --git a/contracts/test-utils/src/transaction_factory.ts b/contracts/test-utils/src/transaction_factory.ts index dbab3ade4..e6cd4c23f 100644 --- a/contracts/test-utils/src/transaction_factory.ts +++ b/contracts/test-utils/src/transaction_factory.ts @@ -1,10 +1,8 @@ -import { eip712Utils, generatePseudoRandomSalt } from '@0x/order-utils'; -import { SignatureType } from '@0x/types'; -import { signTypedDataUtils } from '@0x/utils'; +import { generatePseudoRandomSalt, transactionHashUtils } from '@0x/order-utils'; +import { SignatureType, SignedZeroExTransaction } from '@0x/types'; import * as ethUtil from 'ethereumjs-util'; import { signingUtils } from './signing_utils'; -import { SignedTransaction } from './types'; export class TransactionFactory { private readonly _signerBuff: Buffer; @@ -15,23 +13,25 @@ export class TransactionFactory { this._exchangeAddress = exchangeAddress; this._signerBuff = ethUtil.privateToAddress(this._privateKey); } - public newSignedTransaction(data: string, signatureType: SignatureType = SignatureType.EthSign): SignedTransaction { + public newSignedTransaction( + data: string, + signatureType: SignatureType = SignatureType.EthSign, + ): SignedZeroExTransaction { const salt = generatePseudoRandomSalt(); const signerAddress = `0x${this._signerBuff.toString('hex')}`; - const executeTransactionData = { + const transaction = { salt, signerAddress, data, + verifyingContractAddress: this._exchangeAddress, }; - 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, + const transactionHashBuffer = transactionHashUtils.getTransactionHashBuffer(transaction); + const signature = signingUtils.signMessage(transactionHashBuffer, this._privateKey, signatureType); + const signedTransaction = { + ...transaction, signature: `0x${signature.toString('hex')}`, - ...executeTransactionData, }; - return signedTx; + return signedTransaction; } } diff --git a/contracts/test-utils/src/types.ts b/contracts/test-utils/src/types.ts index 60cb2b102..16c3a9f3d 100644 --- a/contracts/test-utils/src/types.ts +++ b/contracts/test-utils/src/types.ts @@ -107,14 +107,6 @@ export enum ContractName { BalanceThresholdFilter = 'BalanceThresholdFilter', } -export interface SignedTransaction { - exchangeAddress: string; - salt: BigNumber; - signerAddress: string; - data: string; - signature: string; -} - export interface TransferAmountsByMatchOrders { // Left Maker amountBoughtByLeftMaker: BigNumber; |