aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-10 05:41:57 +0800
committerFabio Berger <me@fabioberger.com>2017-11-10 05:41:57 +0800
commit441c1f9ab77bbbaef7186bf52964cbfdf7c12208 (patch)
tree5ea8a11a36eee8b6cbebf30b7cf66ff7b65946fb
parent6aa91d89e0fd02601f7e4df86e8499edc00316ce (diff)
downloaddexon-sol-tools-441c1f9ab77bbbaef7186bf52964cbfdf7c12208.tar
dexon-sol-tools-441c1f9ab77bbbaef7186bf52964cbfdf7c12208.tar.gz
dexon-sol-tools-441c1f9ab77bbbaef7186bf52964cbfdf7c12208.tar.bz2
dexon-sol-tools-441c1f9ab77bbbaef7186bf52964cbfdf7c12208.tar.lz
dexon-sol-tools-441c1f9ab77bbbaef7186bf52964cbfdf7c12208.tar.xz
dexon-sol-tools-441c1f9ab77bbbaef7186bf52964cbfdf7c12208.tar.zst
dexon-sol-tools-441c1f9ab77bbbaef7186bf52964cbfdf7c12208.zip
rename folder to order_watcher
-rw-r--r--src/0x.ts2
-rw-r--r--src/order_watcher/event_watcher.ts (renamed from src/mempool/event_watcher.ts)14
-rw-r--r--src/order_watcher/order_state_watcher.ts (renamed from src/mempool/order_state_watcher.ts)4
3 files changed, 10 insertions, 10 deletions
diff --git a/src/0x.ts b/src/0x.ts
index 51744d2d6..75a154930 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -17,7 +17,7 @@ import {TokenRegistryWrapper} from './contract_wrappers/token_registry_wrapper';
import {EtherTokenWrapper} from './contract_wrappers/ether_token_wrapper';
import {TokenWrapper} from './contract_wrappers/token_wrapper';
import {TokenTransferProxyWrapper} from './contract_wrappers/token_transfer_proxy_wrapper';
-import {OrderStateWatcher} from './mempool/order_state_watcher';
+import {OrderStateWatcher} from './order_watcher/order_state_watcher';
import {OrderStateUtils} from './utils/order_state_utils';
import {
ECSignature,
diff --git a/src/mempool/event_watcher.ts b/src/order_watcher/event_watcher.ts
index 3f40606e7..205885f96 100644
--- a/src/mempool/event_watcher.ts
+++ b/src/order_watcher/event_watcher.ts
@@ -5,18 +5,18 @@ import {BlockParamLiteral, EventCallback, MempoolEventCallback} from '../types';
import {AbiDecoder} from '../utils/abi_decoder';
import {intervalUtils} from '../utils/interval_utils';
-const DEFAULT_MEMPOOL_POLLING_INTERVAL = 200;
+const DEFAULT_EVENT_POLLING_INTERVAL = 200;
export class EventWatcher {
private _web3Wrapper: Web3Wrapper;
private _pollingIntervalMs: number;
private _intervalId: NodeJS.Timer;
- private _lastMempoolEvents: Web3.LogEntry[] = [];
+ private _lastEvents: Web3.LogEntry[] = [];
private _callbackAsync?: MempoolEventCallback;
constructor(web3Wrapper: Web3Wrapper, pollingIntervalMs: undefined|number) {
this._web3Wrapper = web3Wrapper;
this._pollingIntervalMs = _.isUndefined(pollingIntervalMs) ?
- DEFAULT_MEMPOOL_POLLING_INTERVAL :
+ DEFAULT_EVENT_POLLING_INTERVAL :
pollingIntervalMs;
}
public subscribe(callback: MempoolEventCallback, numConfirmations: number): void {
@@ -27,7 +27,7 @@ export class EventWatcher {
}
public unsubscribe(): void {
delete this._callbackAsync;
- this._lastMempoolEvents = [];
+ this._lastEvents = [];
intervalUtils.clearAsyncExcludingInterval(this._intervalId);
}
private async _pollForMempoolEventsAsync(numConfirmations: number): Promise<void> {
@@ -38,13 +38,13 @@ export class EventWatcher {
// that's why we just ignore those cases.
return;
}
- const removedEvents = _.differenceBy(this._lastMempoolEvents, pendingEvents, JSON.stringify);
- const newEvents = _.differenceBy(pendingEvents, this._lastMempoolEvents, JSON.stringify);
+ const removedEvents = _.differenceBy(this._lastEvents, pendingEvents, JSON.stringify);
+ const newEvents = _.differenceBy(pendingEvents, this._lastEvents, JSON.stringify);
let isRemoved = true;
await this._emitDifferencesAsync(removedEvents, isRemoved);
isRemoved = false;
await this._emitDifferencesAsync(newEvents, isRemoved);
- this._lastMempoolEvents = pendingEvents;
+ this._lastEvents = pendingEvents;
}
private async _getMempoolEventsAsync(numConfirmations: number): Promise<Web3.LogEntry[]> {
let fromBlock: BlockParamLiteral|number;
diff --git a/src/mempool/order_state_watcher.ts b/src/order_watcher/order_state_watcher.ts
index d0bf5d89c..8710c5a84 100644
--- a/src/mempool/order_state_watcher.ts
+++ b/src/order_watcher/order_state_watcher.ts
@@ -41,12 +41,12 @@ export class OrderStateWatcher {
private _orderStateUtils: OrderStateUtils;
constructor(
web3Wrapper: Web3Wrapper, abiDecoder: AbiDecoder, orderStateUtils: OrderStateUtils,
- mempoolPollingIntervalMs?: number) {
+ eventPollingIntervalMs?: number) {
this._web3Wrapper = web3Wrapper;
this._orders = {};
this._dependentOrderHashes = {};
this._eventWatcher = new EventWatcher(
- this._web3Wrapper, mempoolPollingIntervalMs,
+ this._web3Wrapper, eventPollingIntervalMs,
);
this._abiDecoder = abiDecoder;
this._orderStateUtils = orderStateUtils;