diff options
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 14 | ||||
-rw-r--r-- | src/index.ts | 8 | ||||
-rw-r--r-- | src/types.ts | 6 | ||||
-rw-r--r-- | test/0x.js_test.ts | 2 | ||||
-rw-r--r-- | test/exchange_wrapper_test.ts | 3 |
5 files changed, 14 insertions, 19 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 14d633d66..4698089eb 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -14,9 +14,9 @@ import { SignedOrder, ContractEvent, ExchangeEvents, - EventEmitter, + ContractEventEmitter, SubscriptionOpts, - IndexFilterValues, + IndexedFilterValues, CreateContractEvent, ContractEventObj, ContractResponse, @@ -47,7 +47,7 @@ export class ExchangeWrapper extends ContractWrapper { [ExchangeContractErrCodes.ERROR_FILL_BALANCE_ALLOWANCE]: ExchangeContractErrs.FILL_BALANCE_ALLOWANCE_ERROR, }; private _exchangeContractIfExists?: ExchangeContract; - private _exchangeLogEventEmitters: EventEmitter[]; + private _exchangeLogEventEmitters: ContractEventEmitter[]; private _tokenWrapper: TokenWrapper; private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] { const orderAddresses: OrderAddresses = [ @@ -517,11 +517,11 @@ export class ExchangeWrapper extends ContractWrapper { * @param subscriptionOpts Subscriptions options that let you configure the subscription. * @param indexFilterValues A JS object where the keys are indexed args returned by the event and * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @return EventEmitter object + * @return ContractEventEmitter object */ public async subscribeAsync(eventName: ExchangeEvents, subscriptionOpts: SubscriptionOpts, - indexFilterValues: IndexFilterValues): - Promise<EventEmitter> { + indexFilterValues: IndexedFilterValues): + Promise<ContractEventEmitter> { const exchangeContract = await this._getExchangeContractAsync(); let createLogEvent: CreateContractEvent; switch (eventName) { @@ -561,7 +561,7 @@ export class ExchangeWrapper extends ContractWrapper { await Promise.all(stopWatchingPromises); this._exchangeLogEventEmitters = []; } - private _wrapEventEmitter(event: ContractEventObj): EventEmitter { + private _wrapEventEmitter(event: ContractEventObj): ContractEventEmitter { const zeroExEvent = { watch: event.watch.bind(event), stopWatchingAsync: async () => { diff --git a/src/index.ts b/src/index.ts index b2963aca7..48e83fc19 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,19 +8,15 @@ export { EventCallback, EventCallbackAsync, EventCallbackSync, - ContractEventObj, - CreateContractEvent, - ExchangeContractErrCodes, ExchangeContractErrs, ContractEvent, Token, ExchangeEvents, - IndexFilterValues, + IndexedFilterValues, SubscriptionOpts, BlockParam, OrderFillOrKillRequest, OrderCancellationRequest, OrderFillRequest, - DoneCallback, - EventEmitter, + ContractEventEmitter, } from './types'; diff --git a/src/types.ts b/src/types.ts index 2197fbfc3..11d3182d8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -44,7 +44,7 @@ export interface ContractEventObj { watch: (eventWatch: EventCallback) => void; stopWatching: () => void; } -export type CreateContractEvent = (indexFilterValues: IndexFilterValues, +export type CreateContractEvent = (indexFilterValues: IndexedFilterValues, subscriptionOpts: SubscriptionOpts) => ContractEventObj; export interface ExchangeContract extends ContractInstance { isValidSignature: { @@ -238,7 +238,7 @@ export const ExchangeEvents = strEnum([ ]); export type ExchangeEvents = keyof typeof ExchangeEvents; -export interface IndexFilterValues { +export interface IndexedFilterValues { [index: string]: any; } @@ -276,7 +276,7 @@ export interface Artifact { networks: {[networkId: number]: any}; } -export interface EventEmitter { +export interface ContractEventEmitter { watch: (eventCallback: EventCallback) => void; stopWatchingAsync: () => Promise<void>; } diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index 42ab46cc9..58f5c8533 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -4,7 +4,7 @@ import {chaiSetup} from './utils/chai_setup'; import 'mocha'; import * as BigNumber from 'bignumber.js'; import * as Sinon from 'sinon'; -import {ZeroEx, Order, ECSignature} from '../src'; +import {ZeroEx, Order} from '../src'; import {constants} from './utils/constants'; import {web3Factory} from './utils/web3_factory'; diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 6d927e218..28a5c719e 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -10,16 +10,15 @@ import {BlockchainLifecycle} from './utils/blockchain_lifecycle'; import { ZeroEx, Token, - Order, SignedOrder, SubscriptionOpts, ExchangeEvents, ContractEvent, - DoneCallback, ExchangeContractErrs, OrderCancellationRequest, OrderFillRequest, } from '../src'; +import {DoneCallback} from '../src/types'; import {FillScenarios} from './utils/fill_scenarios'; import {TokenUtils} from './utils/token_utils'; import {assert} from '../src/utils/assert'; |