diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-13 23:45:25 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-13 23:45:25 +0800 |
commit | 95e9f33f6aa5fa7849279062b008afa763a465d8 (patch) | |
tree | 085b1303c0576a1bafe471191253a416cbd939d2 /packages/order-watcher/src/order_watcher/event_watcher.ts | |
parent | c599a20b34331c6481318d3cd3b01855444f339d (diff) | |
download | dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.gz dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.bz2 dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.lz dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.xz dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.zst dexon-sol-tools-95e9f33f6aa5fa7849279062b008afa763a465d8.zip |
Migrate order-watcher to v2
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 |