Fetch event logs for a block range in a single upstream call (#433)

* Support fetching logs for a block range in rpc-eth-client

* Add a method to fetch block events for multiple blocks at once

* Add a method to save blocks with fetched events in a block range

* Fix transactions destructuring

* Fix get logs call args

* Add a separate ETH client method to get logs in a block range

* Codegen changes
This commit is contained in:
prathamesh0
2023-10-23 16:10:09 +05:30
committed by GitHub
parent 45b7489115
commit e8d8476bef
8 changed files with 201 additions and 25 deletions
@@ -16,6 +16,9 @@ columns:
pgType: varchar
tsType: string
columnType: Column
columnOptions:
- option: nullable
value: true
- name: blockHash
pgType: varchar
tsType: string
@@ -625,6 +625,10 @@ export class Indexer implements IndexerInterface {
return this._baseIndexer.getBlocksAtHeight(height, isPruned);
}
async fetchEventsAndSaveBlocks (blocks: DeepPartial<BlockProgress>[]): Promise<{ blockProgress: BlockProgress, events: DeepPartial<Event>[] }[]> {
return this._baseIndexer.fetchEventsAndSaveBlocks(blocks, this.parseEventNameAndArgs.bind(this))
}
async saveBlockAndFetchEvents (block: DeepPartial<BlockProgress>): Promise<[BlockProgress, DeepPartial<Event>[]]> {
return this._saveBlockAndFetchEvents(block);
}