Move our contract templates to accept Provider instead of Web3Wrapper

This commit is contained in:
Leonid Logvinov
2018-04-03 16:19:38 +03:00
parent 674e56cea6
commit 249bf0163d
85 changed files with 791 additions and 719 deletions

View File

@@ -9,7 +9,7 @@ import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
import { web3, web3Wrapper } from './utils/web3_wrapper';
import { provider, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -26,7 +26,7 @@ describe('EtherToken', () => {
const etherToken = await deployer.deployAsync(ContractName.EtherToken);
etherTokenAddress = etherToken.address;
zeroEx = new ZeroEx(web3.currentProvider, {
zeroEx = new ZeroEx(provider, {
gasPrice,
networkId: constants.TESTRPC_NETWORK_ID,
});
@@ -51,7 +51,7 @@ describe('EtherToken', () => {
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
const ethToDeposit = new BigNumber(web3.toWei(1, 'ether'));
const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
const txHash = await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
@@ -76,7 +76,7 @@ describe('EtherToken', () => {
});
it('should convert ether tokens to ether with sufficient balance', async () => {
const ethToDeposit = new BigNumber(web3.toWei(1, 'ether'));
const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);