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

@@ -1,4 +1,14 @@
[
{
"version": "0.2.0",
"changes": [
{
"note": "Contract wrappers now accept Provider and defaults instead of our Web3Wrapper",
"pr": 501
}
],
"timestamp": 1522673609
},
{
"version": "0.1.0",
"changes": [

View File

@@ -1,4 +1,4 @@
import { ContractAbi, DataItem, TxData, TxDataPayable } from '@0xproject/types';
import { ContractAbi, DataItem, Provider, TxData, TxDataPayable } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as ethersContracts from 'ethers-contracts';
@@ -49,8 +49,8 @@ export class BaseContract {
}
return txDataWithDefaults;
}
constructor(web3Wrapper: Web3Wrapper, abi: ContractAbi, address: string) {
this._web3Wrapper = web3Wrapper;
constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) {
this._web3Wrapper = new Web3Wrapper(provider, defaults);
this.abi = abi;
this.address = address;
this._ethersInterface = new ethersContracts.Interface(abi);