diff options
Diffstat (limited to 'packages/order-watcher/src/order_watcher/event_watcher.ts')
-rw-r--r-- | packages/order-watcher/src/order_watcher/event_watcher.ts | 14 |
1 files changed, 7 insertions, 7 deletions
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<Block, Log> | 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 |