aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-10 05:43:19 +0800
committerFabio Berger <me@fabioberger.com>2017-11-10 05:43:19 +0800
commit6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd (patch)
tree52d67e43627641af023a913b221b81f59d222c8f
parent530f5a700e6e7d8478e71736ae3e9b37a92009d6 (diff)
downloaddexon-sol-tools-6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd.tar
dexon-sol-tools-6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd.tar.gz
dexon-sol-tools-6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd.tar.bz2
dexon-sol-tools-6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd.tar.lz
dexon-sol-tools-6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd.tar.xz
dexon-sol-tools-6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd.tar.zst
dexon-sol-tools-6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd.zip
Rename MempoolEventCallback to EventWatcherCallback
-rw-r--r--src/index.ts2
-rw-r--r--src/order_watcher/event_watcher.ts6
-rw-r--r--src/order_watcher/order_state_watcher.ts4
-rw-r--r--src/types.ts6
4 files changed, 9 insertions, 9 deletions
diff --git a/src/index.ts b/src/index.ts
index ffd59fe37..7963ec43e 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -36,7 +36,7 @@ export {
FilterObject,
LogEvent,
DecodedLogEvent,
- MempoolEventCallback,
+ EventWatcherCallback,
OnOrderStateChangeCallback,
OrderStateValid,
OrderStateInvalid,
diff --git a/src/order_watcher/event_watcher.ts b/src/order_watcher/event_watcher.ts
index 7d3719282..9ace32b29 100644
--- a/src/order_watcher/event_watcher.ts
+++ b/src/order_watcher/event_watcher.ts
@@ -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,
diff --git a/src/order_watcher/order_state_watcher.ts b/src/order_watcher/order_state_watcher.ts
index 8710c5a84..e31fc962d 100644
--- a/src/order_watcher/order_state_watcher.ts
+++ b/src/order_watcher/order_state_watcher.ts
@@ -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) {
diff --git a/src/types.ts b/src/types.ts
index 246fd8641..4a0a74826 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -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: {