From ef0302e23d8eb8daab45069e52686f8a2a651a00 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Tue, 25 Jun 2024 19:32:48 +0530 Subject: [PATCH] Fix parsing event topic in graph-node watcher --- packages/graph-node/src/watcher.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/graph-node/src/watcher.ts b/packages/graph-node/src/watcher.ts index 169aa778..c2d3217f 100644 --- a/packages/graph-node/src/watcher.ts +++ b/packages/graph-node/src/watcher.ts @@ -216,9 +216,20 @@ export class GraphWatcher { const { instance, contractInterface } = this._dataSourceMap[dataSource.name]; assert(instance); const { exports: instanceExports } = instance; + let eventTopic: string; + + try { + eventTopic = contractInterface.getEventTopic(eventSignature); + } catch (err) { + // Continue loop only if no matching event found + if (!((err as Error).message.includes('no matching event'))) { + throw err; + } + + continue; + } // Get event handler based on event topic (from event signature). - const eventTopic = contractInterface.getEventTopic(eventSignature); const eventHandler = dataSource.mapping.eventHandlers.find((eventHandler: any) => { // The event signature we get from logDescription is different than that given in the subgraph yaml file. // For eg. event in subgraph.yaml: Stake(indexed address,uint256); from logDescription: Stake(address,uint256)