aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/test/utils
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-24 22:36:35 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-02 20:10:24 +0800
commit0499541e114e6dd36565428f4f914e0dbdece2b8 (patch)
tree6d4740f4343f4516a9ecafc4795b68aed0865c75 /packages/0x.js/test/utils
parentf08738e13379ea86a33ad9be9f7579e637e69acb (diff)
downloaddexon-sol-tools-0499541e114e6dd36565428f4f914e0dbdece2b8.tar
dexon-sol-tools-0499541e114e6dd36565428f4f914e0dbdece2b8.tar.gz
dexon-sol-tools-0499541e114e6dd36565428f4f914e0dbdece2b8.tar.bz2
dexon-sol-tools-0499541e114e6dd36565428f4f914e0dbdece2b8.tar.lz
dexon-sol-tools-0499541e114e6dd36565428f4f914e0dbdece2b8.tar.xz
dexon-sol-tools-0499541e114e6dd36565428f4f914e0dbdece2b8.tar.zst
dexon-sol-tools-0499541e114e6dd36565428f4f914e0dbdece2b8.zip
Move order utils to @0xproject/order-utils
Diffstat (limited to 'packages/0x.js/test/utils')
-rw-r--r--packages/0x.js/test/utils/fill_scenarios.ts4
-rw-r--r--packages/0x.js/test/utils/order_factory.ts46
-rw-r--r--packages/0x.js/test/utils/web3_wrapper.ts3
3 files changed, 2 insertions, 51 deletions
diff --git a/packages/0x.js/test/utils/fill_scenarios.ts b/packages/0x.js/test/utils/fill_scenarios.ts
index 7d0e8c501..5a82a56d2 100644
--- a/packages/0x.js/test/utils/fill_scenarios.ts
+++ b/packages/0x.js/test/utils/fill_scenarios.ts
@@ -1,10 +1,10 @@
+import { orderFactory } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { SignedOrder, Token, ZeroEx } from '../../src';
import { artifacts } from '../../src/artifacts';
import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
-import { orderFactory } from '../utils/order_factory';
import { constants } from './constants';
@@ -164,7 +164,7 @@ export class FillScenarios {
]);
const signedOrder = await orderFactory.createSignedOrderAsync(
- this._zeroEx,
+ this._zeroEx.getProvider(),
makerAddress,
takerAddress,
makerFee,
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<SignedOrder> {
- 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;
- },
-};
diff --git a/packages/0x.js/test/utils/web3_wrapper.ts b/packages/0x.js/test/utils/web3_wrapper.ts
index b7b3f0b7f..b0ccfa546 100644
--- a/packages/0x.js/test/utils/web3_wrapper.ts
+++ b/packages/0x.js/test/utils/web3_wrapper.ts
@@ -1,9 +1,6 @@
import { devConstants, web3Factory } from '@0xproject/dev-utils';
import { Provider } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
-import * as Web3 from 'web3';
-
-import { constants } from './constants';
const web3 = web3Factory.create({ shouldUseInProcessGanache: true });
const provider: Provider = web3.currentProvider;