mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 00:44:06 +00:00
Update getFullBlocks usage (#213)
* Update getFullBlocks usage to add block number arg * Add skipStateFieldsUpdate config for uniswap-watcher Co-authored-by: nabarun <nabarun@deepstacksoft.com>
This commit is contained in:
@@ -131,7 +131,7 @@ export class GraphWatcher {
|
||||
|
||||
// Check if block data is already fetched by a previous event in the same block.
|
||||
if (!this._context.block || this._context.block.blockHash !== block.hash) {
|
||||
this._context.block = await getFullBlock(this._ethClient, this._ethProvider, block.hash);
|
||||
this._context.block = await getFullBlock(this._ethClient, this._ethProvider, block.hash, block.number);
|
||||
}
|
||||
|
||||
const blockData = this._context.block;
|
||||
@@ -194,10 +194,10 @@ export class GraphWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
async handleBlock (blockHash: string) {
|
||||
async handleBlock (blockHash: string, blockNumber: number) {
|
||||
// Check if block data is already fetched in handleEvent method for the same block.
|
||||
if (!this._context.block || this._context.block.blockHash !== blockHash) {
|
||||
this._context.block = await getFullBlock(this._ethClient, this._ethProvider, blockHash);
|
||||
this._context.block = await getFullBlock(this._ethClient, this._ethProvider, blockHash, blockNumber);
|
||||
}
|
||||
|
||||
const blockData = this._context.block;
|
||||
|
||||
@@ -216,6 +216,7 @@ class ServerConfig implements ServerConfigInterface {
|
||||
filterLogs: boolean;
|
||||
maxEventsBlockRange: number;
|
||||
clearEntitiesCacheInterval: number;
|
||||
skipStateFieldsUpdate: boolean;
|
||||
|
||||
constructor () {
|
||||
this.host = '';
|
||||
@@ -230,5 +231,6 @@ class ServerConfig implements ServerConfigInterface {
|
||||
this.filterLogs = false;
|
||||
this.maxEventsBlockRange = 0;
|
||||
this.clearEntitiesCacheInterval = 0;
|
||||
this.skipStateFieldsUpdate = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user