From 2bd7b0f66bd28792281ba025cf005c666e7f767e Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 4 Oct 2018 14:40:58 -0700 Subject: update contract_wrappers to use new artifacts and abi-gen wrappers packages --- .../src/contract_wrappers/exchange_wrapper.ts | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts') 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( - eventName: wrappers.ExchangeEvents, + public subscribe( + eventName: ExchangeEvents, indexFilterValues: IndexedFilterValues, callback: EventCallback, 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( 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( - eventName: wrappers.ExchangeEvents, + public async getLogsAsync( + eventName: ExchangeEvents, blockRange: BlockRange, indexFilterValues: IndexedFilterValues, ): Promise>> { - 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( @@ -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 { + private async _getExchangeContractAsync(): Promise { if (!_.isUndefined(this._exchangeContractIfExists)) { return this._exchangeContractIfExists; } - const contractInstance = new wrappers.ExchangeContract( + const contractInstance = new ExchangeContract( this.abi, this.address, this._web3Wrapper.getProvider(), -- cgit v1.2.3