aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/test/ether_token_wrapper_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers/test/ether_token_wrapper_test.ts')
-rw-r--r--packages/contract-wrappers/test/ether_token_wrapper_test.ts25
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;