diff --git a/packages/blocks-watcher/src/indexer.ts b/packages/blocks-watcher/src/indexer.ts index bc66bb9..c2ae91c 100644 --- a/packages/blocks-watcher/src/indexer.ts +++ b/packages/blocks-watcher/src/indexer.ts @@ -651,7 +651,18 @@ export class Indexer implements IndexerInterface { assert(blockHash); assert(blockNumber); - const { events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(blockHash, blockNumber, this.eventSignaturesMap, this.parseEventNameAndArgs.bind(this)); + let dbEvents: DeepPartial[] = []; + let transactions: EthFullTransaction[] = []; + + // Fetch events and txs only if subgraph config has any event handlers + if (this._graphWatcher.eventHandlerExists) { + ({ events: dbEvents, transactions } = await this._baseIndexer.fetchEvents( + blockHash, + blockNumber, + this.eventSignaturesMap, + this.parseEventNameAndArgs.bind(this) + )); + } const dbTx = await this._db.createTransactionRunner(); try { diff --git a/packages/route-processor-watcher/src/indexer.ts b/packages/route-processor-watcher/src/indexer.ts index 006737e..b5c7ed7 100644 --- a/packages/route-processor-watcher/src/indexer.ts +++ b/packages/route-processor-watcher/src/indexer.ts @@ -657,7 +657,18 @@ export class Indexer implements IndexerInterface { assert(blockHash); assert(blockNumber); - const { events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(blockHash, blockNumber, this.eventSignaturesMap, this.parseEventNameAndArgs.bind(this)); + let dbEvents: DeepPartial[] = []; + let transactions: EthFullTransaction[] = []; + + // Fetch events and txs only if subgraph config has any event handlers + if (this._graphWatcher.eventHandlerExists) { + ({ events: dbEvents, transactions } = await this._baseIndexer.fetchEvents( + blockHash, + blockNumber, + this.eventSignaturesMap, + this.parseEventNameAndArgs.bind(this) + )); + } const dbTx = await this._db.createTransactionRunner(); try { diff --git a/packages/sushiswap-watcher/src/indexer.ts b/packages/sushiswap-watcher/src/indexer.ts index b7174d1..3ff1f5b 100644 --- a/packages/sushiswap-watcher/src/indexer.ts +++ b/packages/sushiswap-watcher/src/indexer.ts @@ -1165,7 +1165,18 @@ export class Indexer implements IndexerInterface { assert(blockHash); assert(blockNumber); - const { events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(blockHash, blockNumber, this.eventSignaturesMap, this.parseEventNameAndArgs.bind(this)); + let dbEvents: DeepPartial[] = []; + let transactions: EthFullTransaction[] = []; + + // Fetch events and txs only if subgraph config has any event handlers + if (this._graphWatcher.eventHandlerExists) { + ({ events: dbEvents, transactions } = await this._baseIndexer.fetchEvents( + blockHash, + blockNumber, + this.eventSignaturesMap, + this.parseEventNameAndArgs.bind(this) + )); + } const dbTx = await this._db.createTransactionRunner(); try { diff --git a/packages/v2-watcher/src/indexer.ts b/packages/v2-watcher/src/indexer.ts index 46dd0a3..ea328ec 100644 --- a/packages/v2-watcher/src/indexer.ts +++ b/packages/v2-watcher/src/indexer.ts @@ -1040,7 +1040,18 @@ export class Indexer implements IndexerInterface { assert(blockHash); assert(blockNumber); - const { events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(blockHash, blockNumber, this.eventSignaturesMap, this.parseEventNameAndArgs.bind(this)); + let dbEvents: DeepPartial[] = []; + let transactions: EthFullTransaction[] = []; + + // Fetch events and txs only if subgraph config has any event handlers + if (this._graphWatcher.eventHandlerExists) { + ({ events: dbEvents, transactions } = await this._baseIndexer.fetchEvents( + blockHash, + blockNumber, + this.eventSignaturesMap, + this.parseEventNameAndArgs.bind(this) + )); + } const dbTx = await this._db.createTransactionRunner(); try { diff --git a/packages/v3-watcher/src/indexer.ts b/packages/v3-watcher/src/indexer.ts index ad49cd2..70ec71e 100644 --- a/packages/v3-watcher/src/indexer.ts +++ b/packages/v3-watcher/src/indexer.ts @@ -1424,7 +1424,18 @@ export class Indexer implements IndexerInterface { assert(blockHash); assert(blockNumber); - const { events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(blockHash, blockNumber, this.eventSignaturesMap, this.parseEventNameAndArgs.bind(this)); + let dbEvents: DeepPartial[] = []; + let transactions: EthFullTransaction[] = []; + + // Fetch events only if subgraph config has any event handlers + if (this._graphWatcher.eventHandlerExists) { + ({ events: dbEvents, transactions } = await this._baseIndexer.fetchEvents( + blockHash, + blockNumber, + this.eventSignaturesMap, + this.parseEventNameAndArgs.bind(this) + )); + } const dbTx = await this._db.createTransactionRunner(); try {