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:
prathamesh0
2022-11-03 16:49:41 +05:30
committed by GitHub
co-authored by nabarun
parent be65ca45ea
commit 266442a6d9
9 changed files with 18 additions and 13 deletions
+3 -3
View File
@@ -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;
}
}