diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-03 21:19:38 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-04 16:56:32 +0800 |
commit | 249bf0163d8ee71b7329fd58b72e554c0324279c (patch) | |
tree | 5bfb30b082236bd089e35186220bdb02913ba128 /packages/0x.js/src/contract_wrappers | |
parent | 674e56cea69fe96ddd0071d3c4c5b5ea8ae299bf (diff) | |
download | dexon-0x-contracts-249bf0163d8ee71b7329fd58b72e554c0324279c.tar.gz dexon-0x-contracts-249bf0163d8ee71b7329fd58b72e554c0324279c.tar.zst dexon-0x-contracts-249bf0163d8ee71b7329fd58b72e554c0324279c.zip |
Move our contract templates to accept Provider instead of Web3Wrapper
Diffstat (limited to 'packages/0x.js/src/contract_wrappers')
5 files changed, 37 insertions, 12 deletions
diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts index f52dba2f1..fd39de34b 100644 --- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts @@ -191,7 +191,12 @@ export class EtherTokenWrapper extends ContractWrapper { artifacts.EtherTokenArtifact, etherTokenAddress, ); - const contractInstance = new EtherTokenContract(this._web3Wrapper, abi, address); + const contractInstance = new EtherTokenContract( + abi, + address, + this._web3Wrapper.getProvider(), + this._web3Wrapper.getContractDefaults(), + ); etherTokenContract = contractInstance; this._etherTokenContractsByAddress[etherTokenAddress] = etherTokenContract; return etherTokenContract; diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 53f32f111..378ae8111 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -170,7 +170,7 @@ export class ExchangeWrapper extends ContractWrapper { * @param shouldThrowOnInsufficientBalanceOrAllowance Whether or not you wish for the contract call to throw * if upon execution the tokens cannot be transferred. * @param takerAddress The user Ethereum address who would like to fill this order. - * Must be available via the supplied Web3.Provider + * Must be available via the supplied Provider * passed to 0x.js. * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. @@ -235,7 +235,7 @@ export class ExchangeWrapper extends ContractWrapper { * If set to false, the call will continue to fill subsequent * signedOrders even when some cannot be filled. * @param takerAddress The user Ethereum address who would like to fill these - * orders. Must be available via the supplied Web3.Provider + * orders. Must be available via the supplied Provider * passed to 0x.js. * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. @@ -335,7 +335,7 @@ export class ExchangeWrapper extends ContractWrapper { * cannot be filled. * @param takerAddress The user Ethereum address who would like to fill * these orders. Must be available via the supplied - * Web3.Provider passed to 0x.js. + * Provider passed to 0x.js. * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. */ @@ -416,7 +416,7 @@ export class ExchangeWrapper extends ContractWrapper { * signedOrder you wish to fill. * @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill. * @param takerAddress The user Ethereum address who would like to fill this order. - * Must be available via the supplied Web3.Provider passed to 0x.js. + * Must be available via the supplied Provider passed to 0x.js. * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. */ @@ -470,7 +470,7 @@ export class ExchangeWrapper extends ContractWrapper { * filled (each to the specified fillAmount) or aborted. * @param orderFillRequests An array of objects that conform to the OrderFillRequest interface. * @param takerAddress The user Ethereum address who would like to fill there orders. - * Must be available via the supplied Web3.Provider passed to 0x.js. + * Must be available via the supplied Provider passed to 0x.js. * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. */ @@ -765,7 +765,7 @@ export class ExchangeWrapper extends ContractWrapper { * signedOrder you wish to fill. * @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill. * @param takerAddress The user Ethereum address who would like to fill this order. - * Must be available via the supplied Web3.Provider passed to 0x.js. + * Must be available via the supplied Provider passed to 0x.js. */ public async validateFillOrderThrowIfInvalidAsync( signedOrder: SignedOrder, @@ -812,7 +812,7 @@ export class ExchangeWrapper extends ContractWrapper { * signedOrder you wish to fill. * @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill. * @param takerAddress The user Ethereum address who would like to fill this order. - * Must be available via the supplied Web3.Provider passed to 0x.js. + * Must be available via the supplied Provider passed to 0x.js. */ public async validateFillOrKillOrderThrowIfInvalidAsync( signedOrder: SignedOrder, @@ -920,7 +920,12 @@ export class ExchangeWrapper extends ContractWrapper { artifacts.ExchangeArtifact, this._contractAddressIfExists, ); - const contractInstance = new ExchangeContract(this._web3Wrapper, abi, address); + const contractInstance = new ExchangeContract( + abi, + address, + this._web3Wrapper.getProvider(), + this._web3Wrapper.getContractDefaults(), + ); this._exchangeContractIfExists = contractInstance; return this._exchangeContractIfExists; } diff --git a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts index e1806c6f2..c4a193264 100644 --- a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts @@ -121,7 +121,12 @@ export class TokenRegistryWrapper extends ContractWrapper { artifacts.TokenRegistryArtifact, this._contractAddressIfExists, ); - const contractInstance = new TokenRegistryContract(this._web3Wrapper, abi, address); + const contractInstance = new TokenRegistryContract( + abi, + address, + this._web3Wrapper.getProvider(), + this._web3Wrapper.getContractDefaults(), + ); this._tokenRegistryContractIfExists = contractInstance; return this._tokenRegistryContractIfExists; } diff --git a/packages/0x.js/src/contract_wrappers/token_transfer_proxy_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_transfer_proxy_wrapper.ts index 211c7dfb4..be558b5be 100644 --- a/packages/0x.js/src/contract_wrappers/token_transfer_proxy_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_transfer_proxy_wrapper.ts @@ -63,7 +63,12 @@ export class TokenTransferProxyWrapper extends ContractWrapper { artifacts.TokenTransferProxyArtifact, this._contractAddressIfExists, ); - const contractInstance = new TokenTransferProxyContract(this._web3Wrapper, abi, address); + const contractInstance = new TokenTransferProxyContract( + abi, + address, + this._web3Wrapper.getProvider(), + this._web3Wrapper.getContractDefaults(), + ); this._tokenTransferProxyContractIfExists = contractInstance; return this._tokenTransferProxyContractIfExists; } diff --git a/packages/0x.js/src/contract_wrappers/token_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_wrapper.ts index 5224d451c..194cfb5aa 100644 --- a/packages/0x.js/src/contract_wrappers/token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_wrapper.ts @@ -421,7 +421,12 @@ export class TokenWrapper extends ContractWrapper { artifacts.TokenArtifact, normalizedTokenAddress, ); - const contractInstance = new TokenContract(this._web3Wrapper, abi, address); + const contractInstance = new TokenContract( + abi, + address, + this._web3Wrapper.getProvider(), + this._web3Wrapper.getContractDefaults(), + ); tokenContract = contractInstance; this._tokenContractsByAddress[normalizedTokenAddress] = tokenContract; return tokenContract; |