Rename MempoolEventCallback to EventWatcherCallback
This commit is contained in:
@@ -36,7 +36,7 @@ export {
|
||||
FilterObject,
|
||||
LogEvent,
|
||||
DecodedLogEvent,
|
||||
MempoolEventCallback,
|
||||
EventWatcherCallback,
|
||||
OnOrderStateChangeCallback,
|
||||
OrderStateValid,
|
||||
OrderStateInvalid,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as Web3 from 'web3';
|
||||
import * as _ from 'lodash';
|
||||
import {Web3Wrapper} from '../web3_wrapper';
|
||||
import {BlockParamLiteral, EventCallback, MempoolEventCallback} from '../types';
|
||||
import {BlockParamLiteral, EventCallback, EventWatcherCallback} from '../types';
|
||||
import {AbiDecoder} from '../utils/abi_decoder';
|
||||
import {intervalUtils} from '../utils/interval_utils';
|
||||
|
||||
@@ -12,14 +12,14 @@ export class EventWatcher {
|
||||
private _pollingIntervalMs: number;
|
||||
private _intervalId: NodeJS.Timer;
|
||||
private _lastEvents: Web3.LogEntry[] = [];
|
||||
private _callbackAsync?: MempoolEventCallback;
|
||||
private _callbackAsync?: EventWatcherCallback;
|
||||
constructor(web3Wrapper: Web3Wrapper, pollingIntervalMs: undefined|number) {
|
||||
this._web3Wrapper = web3Wrapper;
|
||||
this._pollingIntervalMs = _.isUndefined(pollingIntervalMs) ?
|
||||
DEFAULT_EVENT_POLLING_INTERVAL :
|
||||
pollingIntervalMs;
|
||||
}
|
||||
public subscribe(callback: MempoolEventCallback, numConfirmations: number): void {
|
||||
public subscribe(callback: EventWatcherCallback, numConfirmations: number): void {
|
||||
this._callbackAsync = callback;
|
||||
this._intervalId = intervalUtils.setAsyncExcludingInterval(
|
||||
this._pollForMempoolEventsAsync.bind(this, numConfirmations), this._pollingIntervalMs,
|
||||
|
||||
@@ -90,7 +90,7 @@ export class OrderStateWatcher {
|
||||
throw new Error(ZeroExError.SubscriptionAlreadyPresent);
|
||||
}
|
||||
this._callbackAsync = callback;
|
||||
this._eventWatcher.subscribe(this._onMempoolEventCallbackAsync.bind(this), numConfirmations);
|
||||
this._eventWatcher.subscribe(this._onEventWatcherCallbackAsync.bind(this), numConfirmations);
|
||||
}
|
||||
/**
|
||||
* Ends an orderStateWatcher subscription.
|
||||
@@ -100,7 +100,7 @@ export class OrderStateWatcher {
|
||||
delete this._callbackAsync;
|
||||
this._eventWatcher.unsubscribe();
|
||||
}
|
||||
private async _onMempoolEventCallbackAsync(log: LogEvent): Promise<void> {
|
||||
private async _onEventWatcherCallbackAsync(log: LogEvent): Promise<void> {
|
||||
const maybeDecodedLog = this._abiDecoder.tryToDecodeLogOrNoop(log);
|
||||
const isDecodedLog = !_.isUndefined((maybeDecodedLog as LogWithDecodedArgs<any>).event);
|
||||
if (!isDecodedLog) {
|
||||
|
||||
@@ -45,9 +45,9 @@ export type EventCallbackAsync<ArgsType> = (log: DecodedLogEvent<ArgsType>) => P
|
||||
export type EventCallbackSync<ArgsType> = (log: DecodedLogEvent<ArgsType>) => void;
|
||||
export type EventCallback<ArgsType> = EventCallbackSync<ArgsType>|EventCallbackAsync<ArgsType>;
|
||||
|
||||
export type MempoolEventCallbackSync = (log: LogEvent) => void;
|
||||
export type MempoolEventCallbackAsync = (log: LogEvent) => Promise<void>;
|
||||
export type MempoolEventCallback = MempoolEventCallbackSync|MempoolEventCallbackAsync;
|
||||
export type EventWatcherCallbackSync = (log: LogEvent) => void;
|
||||
export type EventWatcherCallbackAsync = (log: LogEvent) => Promise<void>;
|
||||
export type EventWatcherCallback = EventWatcherCallbackSync|EventWatcherCallbackAsync;
|
||||
|
||||
export interface ExchangeContract extends Web3.ContractInstance {
|
||||
isValidSignature: {
|
||||
|
||||
Reference in New Issue
Block a user