aboutsummaryrefslogtreecommitdiffstats
path: root/src/order_watcher/event_watcher.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-13 09:26:21 +0800
committerGitHub <noreply@github.com>2017-11-13 09:26:21 +0800
commit5aef16c2aacd279a8e688b4e735526bff7e4970f (patch)
treea85a712d3a478199a09ac6aebac6e43d2e3f3c3a /src/order_watcher/event_watcher.ts
parent6becf22a2f752ef7c34ce1b423efd51773cc5fde (diff)
parente512e38efbbec030add83ce2bc50f0d17862bdd6 (diff)
downloaddexon-0x-contracts-5aef16c2aacd279a8e688b4e735526bff7e4970f.tar.gz
dexon-0x-contracts-5aef16c2aacd279a8e688b4e735526bff7e4970f.tar.zst
dexon-0x-contracts-5aef16c2aacd279a8e688b4e735526bff7e4970f.zip
Merge pull request #211 from 0xProject/feature/orderWatcherLocalStateStore
Order watcher local state store
Diffstat (limited to 'src/order_watcher/event_watcher.ts')
-rw-r--r--src/order_watcher/event_watcher.ts15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/order_watcher/event_watcher.ts b/src/order_watcher/event_watcher.ts
index c9e72281c..81529a98c 100644
--- a/src/order_watcher/event_watcher.ts
+++ b/src/order_watcher/event_watcher.ts
@@ -28,10 +28,8 @@ export class EventWatcher {
private _pollingIntervalMs: number;
private _intervalIdIfExists?: NodeJS.Timer;
private _lastEvents: Web3.LogEntry[] = [];
- private _numConfirmations: number;
- constructor(web3Wrapper: Web3Wrapper, pollingIntervalMs: undefined|number, numConfirmations: number) {
+ constructor(web3Wrapper: Web3Wrapper, pollingIntervalMs: undefined|number) {
this._web3Wrapper = web3Wrapper;
- this._numConfirmations = numConfirmations;
this._pollingIntervalMs = _.isUndefined(pollingIntervalMs) ?
DEFAULT_EVENT_POLLING_INTERVAL :
pollingIntervalMs;
@@ -67,16 +65,9 @@ export class EventWatcher {
this._lastEvents = pendingEvents;
}
private async _getEventsAsync(): Promise<Web3.LogEntry[]> {
- let latestBlock: BlockParamLiteral|number;
- if (this._numConfirmations === 0) {
- latestBlock = BlockParamLiteral.Pending;
- } else {
- const currentBlock = await this._web3Wrapper.getBlockNumberAsync();
- latestBlock = currentBlock - this._numConfirmations;
- }
const eventFilter = {
- fromBlock: latestBlock,
- toBlock: latestBlock,
+ fromBlock: BlockParamLiteral.Pending,
+ toBlock: BlockParamLiteral.Pending,
};
const events = await this._web3Wrapper.getLogsAsync(eventFilter);
return events;