From 249bf0163d8ee71b7329fd58b72e554c0324279c Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 3 Apr 2018 16:19:38 +0300 Subject: Move our contract templates to accept Provider instead of Web3Wrapper --- packages/0x.js/test/utils/fill_scenarios.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/0x.js/test') diff --git a/packages/0x.js/test/utils/fill_scenarios.ts b/packages/0x.js/test/utils/fill_scenarios.ts index 8b1308298..7d0e8c501 100644 --- a/packages/0x.js/test/utils/fill_scenarios.ts +++ b/packages/0x.js/test/utils/fill_scenarios.ts @@ -36,7 +36,12 @@ export class FillScenarios { for (const token of this._tokens) { if (token.symbol !== 'ZRX' && token.symbol !== 'WETH') { const defaults = {}; - const dummyToken = new DummyTokenContract(web3Wrapper, artifacts.DummyTokenArtifact.abi, token.address); + const dummyToken = new DummyTokenContract( + artifacts.DummyTokenArtifact.abi, + token.address, + web3Wrapper.getProvider(), + web3Wrapper.getContractDefaults(), + ); const tokenSupply = ZeroEx.toBaseUnitAmount(INITIAL_COINBASE_TOKEN_SUPPLY_IN_UNITS, token.decimals); const txHash = await dummyToken.setBalance.sendTransactionAsync(this._coinbase, tokenSupply, { from: this._coinbase, -- cgit v1.2.3 From 59edca41666851dc84a32330f1d978772818da9d Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 5 Apr 2018 13:06:16 +0200 Subject: Call static functions as static --- packages/0x.js/test/ether_token_wrapper_test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/0x.js/test') diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts index 6237ccf23..23592f92e 100644 --- a/packages/0x.js/test/ether_token_wrapper_test.ts +++ b/packages/0x.js/test/ether_token_wrapper_test.ts @@ -59,7 +59,7 @@ describe('EtherTokenWrapper', () => { userAddresses = await zeroEx.getAvailableAddressesAsync(); addressWithETH = userAddresses[0]; wethContractAddress = zeroEx.etherToken.getContractAddressIfExists() as string; - depositWeiAmount = (zeroEx as any)._web3Wrapper.toWei(new BigNumber(5)); + depositWeiAmount = Web3Wrapper.toWei(new BigNumber(5)); decimalPlaces = 7; addressWithoutFunds = userAddresses[1]; }); @@ -105,7 +105,7 @@ describe('EtherTokenWrapper', () => { it('should throw if user has insufficient ETH balance for deposit', async () => { const preETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); - const extraETHBalance = (zeroEx as any)._web3Wrapper.toWei(5, 'ether'); + const extraETHBalance = Web3Wrapper.toWei(5, 'ether'); const overETHBalanceinWei = preETHBalance.add(extraETHBalance); return expect( -- cgit v1.2.3 From b99c797945dacae09be1e1e2d58f806423fedffa Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 5 Apr 2018 13:19:14 +0200 Subject: Fix tests --- packages/0x.js/test/ether_token_wrapper_test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/0x.js/test') diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts index 23592f92e..644101dc7 100644 --- a/packages/0x.js/test/ether_token_wrapper_test.ts +++ b/packages/0x.js/test/ether_token_wrapper_test.ts @@ -1,5 +1,6 @@ import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import 'mocha'; import * as Web3 from 'web3'; @@ -105,7 +106,7 @@ describe('EtherTokenWrapper', () => { it('should throw if user has insufficient ETH balance for deposit', async () => { const preETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); - const extraETHBalance = Web3Wrapper.toWei(5, 'ether'); + const extraETHBalance = Web3Wrapper.toWei(new BigNumber(5)); const overETHBalanceinWei = preETHBalance.add(extraETHBalance); return expect( -- cgit v1.2.3