aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-09-25 19:32:20 +0800
committerFabio Berger <me@fabioberger.com>2018-09-25 19:32:20 +0800
commitfc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64 (patch)
tree5dabb3c01e1f4a3bfeb1538bdefb174f4461ccd3 /packages/order-watcher/src
parenta05530f821b2550ff14a0e359c27650d4ba03130 (diff)
downloaddexon-sol-tools-fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64.tar
dexon-sol-tools-fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64.tar.gz
dexon-sol-tools-fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64.tar.bz2
dexon-sol-tools-fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64.tar.lz
dexon-sol-tools-fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64.tar.xz
dexon-sol-tools-fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64.tar.zst
dexon-sol-tools-fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64.zip
Fix lint issues
Diffstat (limited to 'packages/order-watcher/src')
-rw-r--r--packages/order-watcher/src/order_watcher/event_watcher.ts20
1 files changed, 9 insertions, 11 deletions
diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts
index e73e1f9f9..9ea301815 100644
--- a/packages/order-watcher/src/order_watcher/event_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/event_watcher.ts
@@ -20,7 +20,6 @@ enum LogEventState {
*/
export class EventWatcher {
private readonly _web3Wrapper: Web3Wrapper;
- private readonly _stateLayer: BlockParamLiteral;
private readonly _isVerbose: boolean;
private _blockAndLogStreamerIfExists: BlockAndLogStreamer<Block, Log> | undefined;
private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer;
@@ -35,7 +34,6 @@ export class EventWatcher {
) {
this._isVerbose = isVerbose;
this._web3Wrapper = new Web3Wrapper(provider);
- this._stateLayer = stateLayer;
this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs)
? DEFAULT_EVENT_POLLING_INTERVAL_MS
: pollingIntervalIfExistsMs;
@@ -82,31 +80,31 @@ export class EventWatcher {
this._onLogStateChangedAsync.bind(this, callback, isRemoved),
);
}
- /// This method only exists in order to comply with the expected interface of Blockstream's constructor
+ // This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _blockstreamGetBlockOrNullAsync(hash: string): Promise<Block | null> {
const shouldIncludeTransactionData = false;
- const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({
+ const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({
method: 'eth_getBlockByHash',
params: [hash, shouldIncludeTransactionData],
});
- return blockOrNull as Block;
+ return blockOrNull;
}
// This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _blockstreamGetLatestBlockOrNullAsync(): Promise<Block | null> {
const shouldIncludeTransactionData = false;
- const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({
+ const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({
method: 'eth_getBlockByNumber',
params: [BlockParamLiteral.Latest, shouldIncludeTransactionData],
});
- return blockOrNull as Block;
+ return blockOrNull;
}
// This method only exists in order to comply with the expected interface of Blockstream's constructor
- private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise<Log[]> {
- const logs = await this._web3Wrapper.sendRawPayloadAsync({
+ private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise<RawLogEntry[]> {
+ const logs = await this._web3Wrapper.sendRawPayloadAsync<RawLogEntry[]>({
method: 'eth_getLogs',
params: [filterOptions],
});
- return logs as Log[];
+ return logs as RawLogEntry[];
}
private _stopBlockAndLogStream(): void {
if (_.isUndefined(this._blockAndLogStreamerIfExists)) {
@@ -134,7 +132,7 @@ export class EventWatcher {
// We need to coerce to Block type cause Web3.Block includes types for mempool blocks
if (!_.isUndefined(this._blockAndLogStreamerIfExists)) {
// If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined
- await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockOrNull as any) as Block);
+ await this._blockAndLogStreamerIfExists.reconcileNewBlock(latestBlockOrNull);
}
}
private async _emitDifferencesAsync(