From ef7ac6ac2df34cc45bce461bbbf0e83be5187aed Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 1 Jun 2017 14:53:26 +0200 Subject: Rename order to order_factory --- test/utils/order.ts | 38 -------------------------------------- test/utils/order_factory.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 test/utils/order.ts create mode 100644 test/utils/order_factory.ts (limited to 'test/utils') diff --git a/test/utils/order.ts b/test/utils/order.ts deleted file mode 100644 index 8a7d8430e..000000000 --- a/test/utils/order.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {SignedOrder, Token} from '../../src/types'; -import * as BigNumber from 'bignumber.js'; -import * as _ from 'lodash'; -import {ZeroEx} from '../../src/0x.js'; -import {constants} from './constants'; -import * as ExchangeArtifacts from '../../src/artifacts/Exchange.json'; - -export const orderFactory = { - async createSignedOrderAsync( - zeroEx: ZeroEx, - networkId: number, - maker: string, - makerTokenAmount: BigNumber.BigNumber|number, - makerTokenAddress: string, - takerTokenAmount: BigNumber.BigNumber|number, - takerTokenAddress: string): Promise { - // TODO refactor and check - const exchangeAddress: string = (ExchangeArtifacts as any).networks[networkId].address; - const INF_TIMESTAMP = 2524604400; - const order = { - maker, - taker: undefined, - makerFee: new BigNumber(0), - takerFee: new BigNumber(0), - makerTokenAmount: _.isNumber(makerTokenAmount) ? new BigNumber(makerTokenAmount) : makerTokenAmount, - takerTokenAmount: _.isNumber(takerTokenAmount) ? new BigNumber(takerTokenAmount) : takerTokenAmount, - makerTokenAddress, - takerTokenAddress, - salt: ZeroEx.generatePseudoRandomSalt(), - feeRecipient: constants.NULL_ADDRESS, - expirationUnixTimestampSec: new BigNumber(INF_TIMESTAMP), - }; - const orderHash = ZeroEx.getOrderHashHex(exchangeAddress, order); - const ecSignature = await zeroEx.signOrderHashAsync(orderHash); - const signedOrder: SignedOrder = _.assign(order, {ecSignature}); - return signedOrder; - } -} diff --git a/test/utils/order_factory.ts b/test/utils/order_factory.ts new file mode 100644 index 000000000..8a7d8430e --- /dev/null +++ b/test/utils/order_factory.ts @@ -0,0 +1,38 @@ +import {SignedOrder, Token} from '../../src/types'; +import * as BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; +import {ZeroEx} from '../../src/0x.js'; +import {constants} from './constants'; +import * as ExchangeArtifacts from '../../src/artifacts/Exchange.json'; + +export const orderFactory = { + async createSignedOrderAsync( + zeroEx: ZeroEx, + networkId: number, + maker: string, + makerTokenAmount: BigNumber.BigNumber|number, + makerTokenAddress: string, + takerTokenAmount: BigNumber.BigNumber|number, + takerTokenAddress: string): Promise { + // TODO refactor and check + const exchangeAddress: string = (ExchangeArtifacts as any).networks[networkId].address; + const INF_TIMESTAMP = 2524604400; + const order = { + maker, + taker: undefined, + makerFee: new BigNumber(0), + takerFee: new BigNumber(0), + makerTokenAmount: _.isNumber(makerTokenAmount) ? new BigNumber(makerTokenAmount) : makerTokenAmount, + takerTokenAmount: _.isNumber(takerTokenAmount) ? new BigNumber(takerTokenAmount) : takerTokenAmount, + makerTokenAddress, + takerTokenAddress, + salt: ZeroEx.generatePseudoRandomSalt(), + feeRecipient: constants.NULL_ADDRESS, + expirationUnixTimestampSec: new BigNumber(INF_TIMESTAMP), + }; + const orderHash = ZeroEx.getOrderHashHex(exchangeAddress, order); + const ecSignature = await zeroEx.signOrderHashAsync(orderHash); + const signedOrder: SignedOrder = _.assign(order, {ecSignature}); + return signedOrder; + } +} -- cgit v1.2.3