diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-13 23:52:06 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-13 23:52:06 +0800 |
commit | 5ebc3a4660ba347a591862288b9c908717f2e835 (patch) | |
tree | 4a001e80aad1a4aa0e0cdc1415de137e049a78f5 | |
parent | 55f4c45af1fa1609a11be53e1d9ba1cf6439e4ba (diff) | |
download | dexon-sol-tools-5ebc3a4660ba347a591862288b9c908717f2e835.tar dexon-sol-tools-5ebc3a4660ba347a591862288b9c908717f2e835.tar.gz dexon-sol-tools-5ebc3a4660ba347a591862288b9c908717f2e835.tar.bz2 dexon-sol-tools-5ebc3a4660ba347a591862288b9c908717f2e835.tar.lz dexon-sol-tools-5ebc3a4660ba347a591862288b9c908717f2e835.tar.xz dexon-sol-tools-5ebc3a4660ba347a591862288b9c908717f2e835.tar.zst dexon-sol-tools-5ebc3a4660ba347a591862288b9c908717f2e835.zip |
Rename ZeroExEvent to EventEmitter
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 24 | ||||
-rw-r--r-- | src/index.ts | 2 | ||||
-rw-r--r-- | src/types.ts | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index a617d8003..14d633d66 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -14,12 +14,11 @@ import { SignedOrder, ContractEvent, ExchangeEvents, - ZeroExEvent, + EventEmitter, SubscriptionOpts, IndexFilterValues, CreateContractEvent, ContractEventObj, - EventCallback, ContractResponse, OrderCancellationRequest, OrderFillRequest, @@ -48,7 +47,7 @@ export class ExchangeWrapper extends ContractWrapper { [ExchangeContractErrCodes.ERROR_FILL_BALANCE_ALLOWANCE]: ExchangeContractErrs.FILL_BALANCE_ALLOWANCE_ERROR, }; private _exchangeContractIfExists?: ExchangeContract; - private _exchangeLogEventObjs: ZeroExEvent[]; + private _exchangeLogEventEmitters: EventEmitter[]; private _tokenWrapper: TokenWrapper; private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] { const orderAddresses: OrderAddresses = [ @@ -71,7 +70,7 @@ export class ExchangeWrapper extends ContractWrapper { constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper) { super(web3Wrapper); this._tokenWrapper = tokenWrapper; - this._exchangeLogEventObjs = []; + this._exchangeLogEventEmitters = []; } public async invalidateContractInstanceAsync(): Promise<void> { await this.stopWatchingAllEventsAsync(); @@ -518,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 ZeroExEvent object + * @return EventEmitter object */ public async subscribeAsync(eventName: ExchangeEvents, subscriptionOpts: SubscriptionOpts, indexFilterValues: IndexFilterValues): - Promise<ZeroExEvent> { + Promise<EventEmitter> { const exchangeContract = await this._getExchangeContractAsync(); let createLogEvent: CreateContractEvent; switch (eventName) { @@ -540,9 +539,9 @@ export class ExchangeWrapper extends ContractWrapper { } const logEventObj: ContractEventObj = createLogEvent(indexFilterValues, subscriptionOpts); - const zeroExEvent = this._wrapEventAsZeroExEvent(logEventObj); - this._exchangeLogEventObjs.push(zeroExEvent); - return zeroExEvent; + const eventEmitter = this._wrapEventEmitter(logEventObj); + this._exchangeLogEventEmitters.push(eventEmitter); + return eventEmitter; } /** * Returns the ethereum address of the current exchange contract @@ -557,11 +556,12 @@ export class ExchangeWrapper extends ContractWrapper { * Stops watching for all exchange events */ public async stopWatchingAllEventsAsync(): Promise<void> { - const stopWatchingPromises = _.map(this._exchangeLogEventObjs, logEventObj => logEventObj.stopWatchingAsync()); + const stopWatchingPromises = _.map(this._exchangeLogEventEmitters, + logEventObj => logEventObj.stopWatchingAsync()); await Promise.all(stopWatchingPromises); - this._exchangeLogEventObjs = []; + this._exchangeLogEventEmitters = []; } - private _wrapEventAsZeroExEvent(event: ContractEventObj): ZeroExEvent { + private _wrapEventEmitter(event: ContractEventObj): EventEmitter { const zeroExEvent = { watch: event.watch.bind(event), stopWatchingAsync: async () => { diff --git a/src/index.ts b/src/index.ts index 2a2411456..b2963aca7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,5 +22,5 @@ export { OrderCancellationRequest, OrderFillRequest, DoneCallback, - ZeroExEvent, + EventEmitter, } from './types'; diff --git a/src/types.ts b/src/types.ts index 8edb9ce5e..2197fbfc3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -276,7 +276,7 @@ export interface Artifact { networks: {[networkId: number]: any}; } -export interface ZeroExEvent { +export interface EventEmitter { watch: (eventCallback: EventCallback) => void; stopWatchingAsync: () => Promise<void>; } |