From 0499541e114e6dd36565428f4f914e0dbdece2b8 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 24 Apr 2018 16:36:35 +0200 Subject: Move order utils to @0xproject/order-utils --- packages/0x.js/test/utils/order_factory.ts | 46 ------------------------------ 1 file changed, 46 deletions(-) delete mode 100644 packages/0x.js/test/utils/order_factory.ts (limited to 'packages/0x.js/test/utils/order_factory.ts') diff --git a/packages/0x.js/test/utils/order_factory.ts b/packages/0x.js/test/utils/order_factory.ts deleted file mode 100644 index 08f2081a4..000000000 --- a/packages/0x.js/test/utils/order_factory.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { BigNumber } from '@0xproject/utils'; -import * as _ from 'lodash'; - -import { SignedOrder, ZeroEx } from '../../src'; - -const SHOULD_ADD_PERSONAL_MESSAGE_PREFIX = false; - -export const orderFactory = { - async createSignedOrderAsync( - zeroEx: ZeroEx, - maker: string, - taker: string, - makerFee: BigNumber, - takerFee: BigNumber, - makerTokenAmount: BigNumber, - makerTokenAddress: string, - takerTokenAmount: BigNumber, - takerTokenAddress: string, - exchangeContractAddress: string, - feeRecipient: string, - expirationUnixTimestampSecIfExists?: BigNumber, - ): Promise { - const defaultExpirationUnixTimestampSec = new BigNumber(2524604400); // Close to infinite - const expirationUnixTimestampSec = _.isUndefined(expirationUnixTimestampSecIfExists) - ? defaultExpirationUnixTimestampSec - : expirationUnixTimestampSecIfExists; - const order = { - maker, - taker, - makerFee, - takerFee, - makerTokenAmount, - takerTokenAmount, - makerTokenAddress, - takerTokenAddress, - salt: ZeroEx.generatePseudoRandomSalt(), - exchangeContractAddress, - feeRecipient, - expirationUnixTimestampSec, - }; - const orderHash = ZeroEx.getOrderHashHex(order); - const ecSignature = await zeroEx.signOrderHashAsync(orderHash, maker, SHOULD_ADD_PERSONAL_MESSAGE_PREFIX); - const signedOrder: SignedOrder = _.assign(order, { ecSignature }); - return signedOrder; - }, -}; -- cgit