From 95e9f33f6aa5fa7849279062b008afa763a465d8 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 13 Jul 2018 17:45:25 +0200 Subject: Migrate order-watcher to v2 --- packages/order-watcher/src/order_watcher/event_watcher.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'packages/order-watcher/src/order_watcher/event_watcher.ts') diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index 08ecf81cb..68c043dfe 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -1,6 +1,6 @@ -import { BlockParamLiteral, LogEntry } from '@0xproject/types'; import { intervalUtils, logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { BlockParamLiteral, LogEntry, Provider } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; @@ -19,22 +19,22 @@ enum LogEventState { * depth. */ export class EventWatcher { - private _web3Wrapper: Web3Wrapper; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _pollingIntervalMs: number; + private readonly _stateLayer: BlockParamLiteral; + private readonly _isVerbose: boolean; private _blockAndLogStreamerIfExists: BlockAndLogStreamer | undefined; private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer; private _onLogAddedSubscriptionToken: string | undefined; private _onLogRemovedSubscriptionToken: string | undefined; - private _pollingIntervalMs: number; - private _stateLayer: BlockParamLiteral; - private _isVerbose: boolean; constructor( - web3Wrapper: Web3Wrapper, + provider: Provider, pollingIntervalIfExistsMs: undefined | number, stateLayer: BlockParamLiteral = BlockParamLiteral.Latest, isVerbose: boolean, ) { this._isVerbose = isVerbose; - this._web3Wrapper = web3Wrapper; + this._web3Wrapper = new Web3Wrapper(provider); this._stateLayer = stateLayer; this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs) ? DEFAULT_EVENT_POLLING_INTERVAL_MS -- cgit v1.2.3