mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 00:44:06 +00:00
Update subgraph watcher demo readme (#480)
* Update subgraph watcher demo readme * Pass extra block data required in subgraph block handler (#486) * Use codegen config directory name instead of file path * Get block data from extra event data * Add extra event data in processBlockAfterEvents --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com> * Update example subgraph mapping code for graph-cli upgrade * Return 0 value for block size in ipld-eth-client --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com> Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
@@ -238,7 +238,7 @@ export class GraphWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
async handleBlock (blockHash: string, blockNumber: number) {
|
||||
async handleBlock (blockHash: string, blockNumber: number, extraData: ExtraEventData) {
|
||||
// Clear transactions map on handling new block.
|
||||
this._transactionsMap.clear();
|
||||
|
||||
@@ -258,11 +258,10 @@ export class GraphWatcher {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Use extraData full block
|
||||
// // 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, blockNumber);
|
||||
// }
|
||||
// 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(extraData.ethFullBlock);
|
||||
}
|
||||
|
||||
const blockData = this._context.block;
|
||||
assert(blockData);
|
||||
|
||||
Reference in New Issue
Block a user