diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-05 05:40:58 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 04:36:59 +0800 |
commit | 2bd7b0f66bd28792281ba025cf005c666e7f767e (patch) | |
tree | 228f2797a772a4ba828d6b71e5c85c78a708ed21 /packages/contract-wrappers/src/contract_wrappers | |
parent | 8f0ceaf1d8261e9779213276372f4690cdf3426c (diff) | |
download | dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.gz dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.bz2 dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.lz dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.xz dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.zst dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.zip |
update contract_wrappers to use new artifacts and abi-gen wrappers packages
Diffstat (limited to 'packages/contract-wrappers/src/contract_wrappers')
8 files changed, 80 insertions, 72 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts index 31b3b6755..205a5ed10 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { ERC20ProxyContract } from '@0xproject/abi-gen-wrappers'; +import { ERC20Proxy } from '@0xproject/contract-artifacts'; import { AssetProxyId } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { ContractAbi } from 'ethereum-types'; @@ -12,9 +13,9 @@ import { ContractWrapper } from './contract_wrapper'; * This class includes the functionality related to interacting with the ERC20Proxy contract. */ export class ERC20ProxyWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.ERC20Proxy.compilerOutput.abi; + public abi: ContractAbi = ERC20Proxy.compilerOutput.abi; public address: string; - private _erc20ProxyContractIfExists?: wrappers.ERC20ProxyContract; + private _erc20ProxyContractIfExists?: ERC20ProxyContract; /** * Instantiate ERC20ProxyWrapper * @param web3Wrapper Web3Wrapper instance to use @@ -62,11 +63,11 @@ export class ERC20ProxyWrapper extends ContractWrapper { private _invalidateContractInstance(): void { delete this._erc20ProxyContractIfExists; } - private _getERC20ProxyContract(): wrappers.ERC20ProxyContract { + private _getERC20ProxyContract(): ERC20ProxyContract { if (!_.isUndefined(this._erc20ProxyContractIfExists)) { return this._erc20ProxyContractIfExists; } - const contractInstance = new wrappers.ERC20ProxyContract( + const contractInstance = new ERC20ProxyContract( this.abi, this.address, this._web3Wrapper.getProvider(), diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts index 53cda5d08..68928e71f 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { ERC20TokenContract, ERC20TokenEventArgs, ERC20TokenEvents } from '@0xproject/abi-gen-wrappers'; +import { ERC20Token } from '@0xproject/contract-artifacts'; import { schemas } from '@0xproject/json-schemas'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -29,9 +30,9 @@ const removeUndefinedProperties = _.pickBy; * to the 0x ERC20 Proxy smart contract. */ export class ERC20TokenWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.ERC20Token.compilerOutput.abi; + public abi: ContractAbi = ERC20Token.compilerOutput.abi; public UNLIMITED_ALLOWANCE_IN_BASE_UNITS = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; - private _tokenContractsByAddress: { [address: string]: wrappers.ERC20TokenContract }; + private _tokenContractsByAddress: { [address: string]: ERC20TokenContract }; private _erc20ProxyWrapper: ERC20ProxyWrapper; /** * Instantiate ERC20TokenWrapper @@ -350,15 +351,15 @@ export class ERC20TokenWrapper extends ContractWrapper { * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) * @return Subscription token used later to unsubscribe */ - public subscribe<ArgsType extends wrappers.ERC20TokenEventArgs>( + public subscribe<ArgsType extends ERC20TokenEventArgs>( tokenAddress: string, - eventName: wrappers.ERC20TokenEvents, + eventName: ERC20TokenEvents, indexFilterValues: IndexedFilterValues, callback: EventCallback<ArgsType>, isVerbose: boolean = false, ): string { assert.isETHAddressHex('tokenAddress', tokenAddress); - assert.doesBelongToStringEnum('eventName', eventName, wrappers.ERC20TokenEvents); + assert.doesBelongToStringEnum('eventName', eventName, ERC20TokenEvents); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); assert.isFunction('callback', callback); const normalizedTokenAddress = tokenAddress.toLowerCase(); @@ -366,7 +367,7 @@ export class ERC20TokenWrapper extends ContractWrapper { normalizedTokenAddress, eventName, indexFilterValues, - artifacts.ERC20Token.compilerOutput.abi, + ERC20Token.compilerOutput.abi, callback, isVerbose, ); @@ -395,14 +396,14 @@ export class ERC20TokenWrapper extends ContractWrapper { * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` * @return Array of logs that match the parameters */ - public async getLogsAsync<ArgsType extends wrappers.ERC20TokenEventArgs>( + public async getLogsAsync<ArgsType extends ERC20TokenEventArgs>( tokenAddress: string, - eventName: wrappers.ERC20TokenEvents, + eventName: ERC20TokenEvents, blockRange: BlockRange, indexFilterValues: IndexedFilterValues, ): Promise<Array<LogWithDecodedArgs<ArgsType>>> { assert.isETHAddressHex('tokenAddress', tokenAddress); - assert.doesBelongToStringEnum('eventName', eventName, wrappers.ERC20TokenEvents); + assert.doesBelongToStringEnum('eventName', eventName, ERC20TokenEvents); assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); const normalizedTokenAddress = tokenAddress.toLowerCase(); @@ -411,7 +412,7 @@ export class ERC20TokenWrapper extends ContractWrapper { eventName, blockRange, indexFilterValues, - artifacts.ERC20Token.compilerOutput.abi, + ERC20Token.compilerOutput.abi, ); return logs; } @@ -422,7 +423,7 @@ export class ERC20TokenWrapper extends ContractWrapper { this.unsubscribeAll(); this._tokenContractsByAddress = {}; } - private async _getTokenContractAsync(tokenAddress: string): Promise<wrappers.ERC20TokenContract> { + private async _getTokenContractAsync(tokenAddress: string): Promise<ERC20TokenContract> { const normalizedTokenAddress = tokenAddress.toLowerCase(); let tokenContract = this._tokenContractsByAddress[normalizedTokenAddress]; if (!_.isUndefined(tokenContract)) { @@ -434,7 +435,7 @@ export class ERC20TokenWrapper extends ContractWrapper { if (!doesContractExist) { throw new Error(ContractWrappersError.ERC20TokenContractDoesNotExist); } - const contractInstance = new wrappers.ERC20TokenContract( + const contractInstance = new ERC20TokenContract( this.abi, normalizedTokenAddress, this._web3Wrapper.getProvider(), diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts index 2472d512b..963d5b40f 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { ERC721ProxyContract } from '@0xproject/abi-gen-wrappers'; +import { ERC721Proxy } from '@0xproject/contract-artifacts'; import { AssetProxyId } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { ContractAbi } from 'ethereum-types'; @@ -12,9 +13,9 @@ import { ContractWrapper } from './contract_wrapper'; * This class includes the functionality related to interacting with the ERC721Proxy contract. */ export class ERC721ProxyWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.ERC20Proxy.compilerOutput.abi; + public abi: ContractAbi = ERC721Proxy.compilerOutput.abi; public address: string; - private _erc721ProxyContractIfExists?: wrappers.ERC721ProxyContract; + private _erc721ProxyContractIfExists?: ERC721ProxyContract; /** * Instantiate ERC721ProxyWrapper * @param web3Wrapper Web3Wrapper instance to use @@ -62,11 +63,11 @@ export class ERC721ProxyWrapper extends ContractWrapper { private _invalidateContractInstance(): void { delete this._erc721ProxyContractIfExists; } - private _getERC721ProxyContract(): wrappers.ERC721ProxyContract { + private _getERC721ProxyContract(): ERC721ProxyContract { if (!_.isUndefined(this._erc721ProxyContractIfExists)) { return this._erc721ProxyContractIfExists; } - const contractInstance = new wrappers.ERC721ProxyContract( + const contractInstance = new ERC721ProxyContract( this.abi, this.address, this._web3Wrapper.getProvider(), diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts index 7fcd74eaf..3d58908d8 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { ERC721TokenContract, ERC721TokenEventArgs, ERC721TokenEvents } from '@0xproject/abi-gen-wrappers'; +import { ERC721Token } from '@0xproject/contract-artifacts'; import { schemas } from '@0xproject/json-schemas'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -29,8 +30,8 @@ const removeUndefinedProperties = _.pickBy; * to the 0x ERC721 Proxy smart contract. */ export class ERC721TokenWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.ERC721Token.compilerOutput.abi; - private _tokenContractsByAddress: { [address: string]: wrappers.ERC721TokenContract }; + public abi: ContractAbi = ERC721Token.compilerOutput.abi; + private _tokenContractsByAddress: { [address: string]: ERC721TokenContract }; private _erc721ProxyWrapper: ERC721ProxyWrapper; /** * Instantiate ERC721TokenWrapper @@ -377,15 +378,15 @@ export class ERC721TokenWrapper extends ContractWrapper { * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) * @return Subscription token used later to unsubscribe */ - public subscribe<ArgsType extends wrappers.ERC721TokenEventArgs>( + public subscribe<ArgsType extends ERC721TokenEventArgs>( tokenAddress: string, - eventName: wrappers.ERC721TokenEvents, + eventName: ERC721TokenEvents, indexFilterValues: IndexedFilterValues, callback: EventCallback<ArgsType>, isVerbose: boolean = false, ): string { assert.isETHAddressHex('tokenAddress', tokenAddress); - assert.doesBelongToStringEnum('eventName', eventName, wrappers.ERC721TokenEvents); + assert.doesBelongToStringEnum('eventName', eventName, ERC721TokenEvents); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); assert.isFunction('callback', callback); const normalizedTokenAddress = tokenAddress.toLowerCase(); @@ -393,7 +394,7 @@ export class ERC721TokenWrapper extends ContractWrapper { normalizedTokenAddress, eventName, indexFilterValues, - artifacts.ERC721Token.compilerOutput.abi, + ERC721Token.compilerOutput.abi, callback, isVerbose, ); @@ -422,14 +423,14 @@ export class ERC721TokenWrapper extends ContractWrapper { * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` * @return Array of logs that match the parameters */ - public async getLogsAsync<ArgsType extends wrappers.ERC721TokenEventArgs>( + public async getLogsAsync<ArgsType extends ERC721TokenEventArgs>( tokenAddress: string, - eventName: wrappers.ERC721TokenEvents, + eventName: ERC721TokenEvents, blockRange: BlockRange, indexFilterValues: IndexedFilterValues, ): Promise<Array<LogWithDecodedArgs<ArgsType>>> { assert.isETHAddressHex('tokenAddress', tokenAddress); - assert.doesBelongToStringEnum('eventName', eventName, wrappers.ERC721TokenEvents); + assert.doesBelongToStringEnum('eventName', eventName, ERC721TokenEvents); assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); const normalizedTokenAddress = tokenAddress.toLowerCase(); @@ -438,7 +439,7 @@ export class ERC721TokenWrapper extends ContractWrapper { eventName, blockRange, indexFilterValues, - artifacts.ERC721Token.compilerOutput.abi, + ERC721Token.compilerOutput.abi, ); return logs; } @@ -449,7 +450,7 @@ export class ERC721TokenWrapper extends ContractWrapper { this.unsubscribeAll(); this._tokenContractsByAddress = {}; } - private async _getTokenContractAsync(tokenAddress: string): Promise<wrappers.ERC721TokenContract> { + private async _getTokenContractAsync(tokenAddress: string): Promise<ERC721TokenContract> { const normalizedTokenAddress = tokenAddress.toLowerCase(); let tokenContract = this._tokenContractsByAddress[normalizedTokenAddress]; if (!_.isUndefined(tokenContract)) { @@ -461,7 +462,7 @@ export class ERC721TokenWrapper extends ContractWrapper { if (!doesContractExist) { throw new Error(ContractWrappersError.ERC721TokenContractDoesNotExist); } - const contractInstance = new wrappers.ERC721TokenContract( + const contractInstance = new ERC721TokenContract( this.abi, normalizedTokenAddress, this._web3Wrapper.getProvider(), diff --git a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts index 526324abd..a6f2fd81e 100644 --- a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { WETH9Contract, WETH9EventArgs, WETH9Events } from '@0xproject/abi-gen-wrappers'; +import { WETH9 } from '@0xproject/contract-artifacts'; import { schemas } from '@0xproject/json-schemas'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -18,9 +19,9 @@ const removeUndefinedProperties = _.pickBy; * The caller can convert ETH into the equivalent number of wrapped ETH ERC20 tokens and back. */ export class EtherTokenWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.WETH9.compilerOutput.abi; + public abi: ContractAbi = WETH9.compilerOutput.abi; private _etherTokenContractsByAddress: { - [address: string]: wrappers.WETH9Contract; + [address: string]: WETH9Contract; } = {}; private _erc20TokenWrapper: ERC20TokenWrapper; /** @@ -120,15 +121,15 @@ export class EtherTokenWrapper extends ContractWrapper { * the value is the value you are interested in. E.g `{_owner: aUserAddressHex}` * @return Array of logs that match the parameters */ - public async getLogsAsync<ArgsType extends wrappers.WETH9EventArgs>( + public async getLogsAsync<ArgsType extends WETH9EventArgs>( etherTokenAddress: string, - eventName: wrappers.WETH9Events, + eventName: WETH9Events, blockRange: BlockRange, indexFilterValues: IndexedFilterValues, ): Promise<Array<LogWithDecodedArgs<ArgsType>>> { assert.isETHAddressHex('etherTokenAddress', etherTokenAddress); const normalizedEtherTokenAddress = etherTokenAddress.toLowerCase(); - assert.doesBelongToStringEnum('eventName', eventName, wrappers.WETH9Events); + assert.doesBelongToStringEnum('eventName', eventName, WETH9Events); assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); const logs = await this._getLogsAsync<ArgsType>( @@ -136,7 +137,7 @@ export class EtherTokenWrapper extends ContractWrapper { eventName, blockRange, indexFilterValues, - artifacts.WETH9.compilerOutput.abi, + WETH9.compilerOutput.abi, ); return logs; } @@ -150,23 +151,23 @@ export class EtherTokenWrapper extends ContractWrapper { * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) * @return Subscription token used later to unsubscribe */ - public subscribe<ArgsType extends wrappers.WETH9EventArgs>( + public subscribe<ArgsType extends WETH9EventArgs>( etherTokenAddress: string, - eventName: wrappers.WETH9Events, + eventName: WETH9Events, indexFilterValues: IndexedFilterValues, callback: EventCallback<ArgsType>, isVerbose: boolean = false, ): string { assert.isETHAddressHex('etherTokenAddress', etherTokenAddress); const normalizedEtherTokenAddress = etherTokenAddress.toLowerCase(); - assert.doesBelongToStringEnum('eventName', eventName, wrappers.WETH9Events); + assert.doesBelongToStringEnum('eventName', eventName, WETH9Events); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); assert.isFunction('callback', callback); const subscriptionToken = this._subscribe<ArgsType>( normalizedEtherTokenAddress, eventName, indexFilterValues, - artifacts.WETH9.compilerOutput.abi, + WETH9.compilerOutput.abi, callback, isVerbose, ); @@ -191,7 +192,7 @@ export class EtherTokenWrapper extends ContractWrapper { this.unsubscribeAll(); this._etherTokenContractsByAddress = {}; } - private async _getEtherTokenContractAsync(etherTokenAddress: string): Promise<wrappers.WETH9Contract> { + private async _getEtherTokenContractAsync(etherTokenAddress: string): Promise<WETH9Contract> { let etherTokenContract = this._etherTokenContractsByAddress[etherTokenAddress]; if (!_.isUndefined(etherTokenContract)) { return etherTokenContract; @@ -203,7 +204,7 @@ export class EtherTokenWrapper extends ContractWrapper { if (!doesContractExist) { throw new Error(ContractWrappersError.EtherTokenContractDoesNotExist); } - const contractInstance = new wrappers.WETH9Contract( + const contractInstance = new WETH9Contract( this.abi, etherTokenAddress, this._web3Wrapper.getProvider(), diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index b65baee55..6b3694bc5 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { ExchangeContract, ExchangeEventArgs, ExchangeEvents } from '@0xproject/abi-gen-wrappers'; +import { Exchange } from '@0xproject/contract-artifacts'; import { schemas } from '@0xproject/json-schemas'; import { assetDataUtils, @@ -40,10 +41,10 @@ import { ERC721TokenWrapper } from './erc721_token_wrapper'; * events of the 0x V2 Exchange smart contract. */ export class ExchangeWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.Exchange.compilerOutput.abi; + public abi: ContractAbi = Exchange.compilerOutput.abi; public address: string; public zrxTokenAddress: string; - private _exchangeContractIfExists?: wrappers.ExchangeContract; + private _exchangeContractIfExists?: ExchangeContract; private _erc721TokenWrapper: ERC721TokenWrapper; private _erc20TokenWrapper: ERC20TokenWrapper; /** @@ -1039,20 +1040,20 @@ export class ExchangeWrapper extends ContractWrapper { * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) * @return Subscription token used later to unsubscribe */ - public subscribe<ArgsType extends wrappers.ExchangeEventArgs>( - eventName: wrappers.ExchangeEvents, + public subscribe<ArgsType extends ExchangeEventArgs>( + eventName: ExchangeEvents, indexFilterValues: IndexedFilterValues, callback: EventCallback<ArgsType>, isVerbose: boolean = false, ): string { - assert.doesBelongToStringEnum('eventName', eventName, wrappers.ExchangeEvents); + assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); assert.isFunction('callback', callback); const subscriptionToken = this._subscribe<ArgsType>( this.address, eventName, indexFilterValues, - artifacts.Exchange.compilerOutput.abi, + Exchange.compilerOutput.abi, callback, isVerbose, ); @@ -1079,12 +1080,12 @@ export class ExchangeWrapper extends ContractWrapper { * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` * @return Array of logs that match the parameters */ - public async getLogsAsync<ArgsType extends wrappers.ExchangeEventArgs>( - eventName: wrappers.ExchangeEvents, + public async getLogsAsync<ArgsType extends ExchangeEventArgs>( + eventName: ExchangeEvents, blockRange: BlockRange, indexFilterValues: IndexedFilterValues, ): Promise<Array<LogWithDecodedArgs<ArgsType>>> { - assert.doesBelongToStringEnum('eventName', eventName, wrappers.ExchangeEvents); + assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents); assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); const logs = await this._getLogsAsync<ArgsType>( @@ -1092,7 +1093,7 @@ export class ExchangeWrapper extends ContractWrapper { eventName, blockRange, indexFilterValues, - artifacts.Exchange.compilerOutput.abi, + Exchange.compilerOutput.abi, ); return logs; } @@ -1178,11 +1179,11 @@ export class ExchangeWrapper extends ContractWrapper { delete this._exchangeContractIfExists; } // tslint:enable:no-unused-variable - private async _getExchangeContractAsync(): Promise<wrappers.ExchangeContract> { + private async _getExchangeContractAsync(): Promise<ExchangeContract> { if (!_.isUndefined(this._exchangeContractIfExists)) { return this._exchangeContractIfExists; } - const contractInstance = new wrappers.ExchangeContract( + const contractInstance = new ExchangeContract( this.abi, this.address, this._web3Wrapper.getProvider(), diff --git a/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts index cd8f9ece9..22fc916e2 100644 --- a/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { ForwarderContract } from '@0xproject/abi-gen-wrappers'; +import { Forwarder } from '@0xproject/contract-artifacts'; import { schemas } from '@0xproject/json-schemas'; import { AssetProxyId, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; @@ -21,11 +22,11 @@ import { ContractWrapper } from './contract_wrapper'; * This class includes the functionality related to interacting with the Forwarder contract. */ export class ForwarderWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.Forwarder.compilerOutput.abi; + public abi: ContractAbi = Forwarder.compilerOutput.abi; public address: string; public zrxTokenAddress: string; public etherTokenAddress: string; - private _forwarderContractIfExists?: wrappers.ForwarderContract; + private _forwarderContractIfExists?: ForwarderContract; // TODO(albrow): Make addresses optional? constructor(web3Wrapper: Web3Wrapper, address: string, zrxTokenAddress: string, etherTokenAddress: string) { super(web3Wrapper); @@ -215,11 +216,11 @@ export class ForwarderWrapper extends ContractWrapper { private _invalidateContractInstance(): void { delete this._forwarderContractIfExists; } - private async _getForwarderContractAsync(): Promise<wrappers.ForwarderContract> { + private async _getForwarderContractAsync(): Promise<ForwarderContract> { if (!_.isUndefined(this._forwarderContractIfExists)) { return this._forwarderContractIfExists; } - const contractInstance = new wrappers.ForwarderContract( + const contractInstance = new ForwarderContract( this.abi, this.address, this._web3Wrapper.getProvider(), diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index 23e0d42c1..cb67d57f7 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -1,4 +1,5 @@ -import { artifacts, wrappers } from '@0xproject/contracts'; +import { OrderValidatorContract } from '@0xproject/abi-gen-wrappers'; +import { OrderValidator } from '@0xproject/contract-artifacts'; import { schemas } from '@0xproject/json-schemas'; import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; @@ -15,9 +16,9 @@ import { ContractWrapper } from './contract_wrapper'; * This class includes the functionality related to interacting with the OrderValidator contract. */ export class OrderValidatorWrapper extends ContractWrapper { - public abi: ContractAbi = artifacts.OrderValidator.compilerOutput.abi; + public abi: ContractAbi = OrderValidator.compilerOutput.abi; public address: string; - private _orderValidatorContractIfExists?: wrappers.OrderValidatorContract; + private _orderValidatorContractIfExists?: OrderValidatorContract; /** * Instantiate OrderValidatorWrapper * @param web3Wrapper Web3Wrapper instance to use. @@ -172,11 +173,11 @@ export class OrderValidatorWrapper extends ContractWrapper { private _invalidateContractInstance(): void { delete this._orderValidatorContractIfExists; } - private async _getOrderValidatorContractAsync(): Promise<wrappers.OrderValidatorContract> { + private async _getOrderValidatorContractAsync(): Promise<OrderValidatorContract> { if (!_.isUndefined(this._orderValidatorContractIfExists)) { return this._orderValidatorContractIfExists; } - const contractInstance = new wrappers.OrderValidatorContract( + const contractInstance = new OrderValidatorContract( this.abi, this.address, this._web3Wrapper.getProvider(), |