diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-04 07:21:17 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 04:36:59 +0800 |
commit | 3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd (patch) | |
tree | 15d4c7df95fd96d6aedb712738cd18bfb213b1f1 /packages/contract-wrappers/test/ether_token_wrapper_test.ts | |
parent | 2aa73fc83962d421eae4447108a07a5d952b569d (diff) | |
download | dexon-sol-tools-3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd.tar dexon-sol-tools-3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd.tar.gz dexon-sol-tools-3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd.tar.bz2 dexon-sol-tools-3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd.tar.lz dexon-sol-tools-3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd.tar.xz dexon-sol-tools-3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd.tar.zst dexon-sol-tools-3a7bb97ad1182eb9c718797bda8dca5eb5d7f9cd.zip |
Remove artifacts from migrations package and update contract-wrappers accordingly
Diffstat (limited to 'packages/contract-wrappers/test/ether_token_wrapper_test.ts')
-rw-r--r-- | packages/contract-wrappers/test/ether_token_wrapper_test.ts | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts index c48fc224f..caf2291d4 100644 --- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts +++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts @@ -1,4 +1,5 @@ import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; +import { getContractAddresses } from '@0xproject/migrations'; import { DoneCallback } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -43,19 +44,21 @@ describe('EtherTokenWrapper', () => { const decimalPlaces = 7; let addressWithoutFunds: string; const gasPrice = new BigNumber(1); - const zeroExConfig = { - gasPrice, - networkId: constants.TESTRPC_NETWORK_ID, - }; const transferAmount = new BigNumber(42); const allowanceAmount = new BigNumber(42); const depositAmount = new BigNumber(42); const withdrawalAmount = new BigNumber(42); before(async () => { - contractWrappers = new ContractWrappers(provider, zeroExConfig); + const config = { + gasPrice, + networkId: constants.TESTRPC_NETWORK_ID, + contractAddresses: getContractAddresses(), + blockPollingIntervalMs: 10, + }; + contractWrappers = new ContractWrappers(provider, config); userAddresses = await web3Wrapper.getAvailableAddressesAsync(); addressWithETH = userAddresses[0]; - wethContractAddress = contractWrappers.etherToken.getContractAddressIfExists() as string; + wethContractAddress = getContractAddresses().etherToken; depositWeiAmount = Web3Wrapper.toWei(new BigNumber(5)); addressWithoutFunds = userAddresses[1]; }); @@ -67,7 +70,7 @@ describe('EtherTokenWrapper', () => { }); describe('#getContractAddressIfExists', async () => { it('should return contract address if connected to a known network', () => { - const contractAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists(); + const contractAddressIfExists = getContractAddresses().etherToken; expect(contractAddressIfExists).to.not.be.undefined(); }); it('should throw if connected to a private network and contract addresses are not specified', () => { @@ -172,7 +175,7 @@ describe('EtherTokenWrapper', () => { const indexFilterValues = {}; let etherTokenAddress: string; before(async () => { - etherTokenAddress = tokenUtils.getWethTokenAddress(); + etherTokenAddress = getContractAddresses().etherToken; }); afterEach(() => { contractWrappers.etherToken.unsubscribeAll(); @@ -293,7 +296,7 @@ describe('EtherTokenWrapper', () => { callbackNeverToBeCalled, ); const callbackToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(); - contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID); + contractWrappers.setProvider(provider); await contractWrappers.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH); contractWrappers.etherToken.subscribe( etherTokenAddress, @@ -341,8 +344,8 @@ describe('EtherTokenWrapper', () => { let txHash: string; before(async () => { addressWithETH = userAddresses[0]; - etherTokenAddress = tokenUtils.getWethTokenAddress(); - erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress(); + etherTokenAddress = getContractAddresses().etherToken; + erc20ProxyAddress = contractWrappers.erc20Proxy.address; // Start the block range after all migrations to avoid unexpected logs const currentBlock: number = await web3Wrapper.getBlockNumberAsync(); const fromBlock = currentBlock + 1; |