Skip to content

Commit

Permalink
Update codegen templates
Browse files Browse the repository at this point in the history
  • Loading branch information
prathamesh0 committed Sep 16, 2024
1 parent 190580f commit 85ca9e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/codegen/src/templates/config-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
# Flag to specify whether RPC endpoint supports block hash as block tag parameter
rpcSupportsBlockHashParam = true

# Enable ETH JSON RPC server at /rpc
enableEthRPCServer = true

# Server GQL config
[server.gql]
path = "/graphql"
Expand Down
6 changes: 6 additions & 0 deletions packages/codegen/src/templates/database-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ export class Database implements DatabaseInterface {
return this._baseDatabase.getEventsInRange(repo, fromBlockNumber, toBlockNumber);
}

async getEvents (options: FindManyOptions<Event>): Promise<Array<Event>> {
const repo = this._conn.getRepository(Event);

return this._baseDatabase.getEvents(repo, options);
}

async saveEventEntity (queryRunner: QueryRunner, entity: Event): Promise<Event> {
const repo = queryRunner.manager.getRepository(Event);
return this._baseDatabase.saveEventEntity(repo, entity);
Expand Down
8 changes: 8 additions & 0 deletions packages/codegen/src/templates/indexer-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export class Indexer implements IndexerInterface {
return this._storageLayoutMap;
}

get contractMap (): Map<string, ethers.utils.Interface> {
return this._contractMap;
}

{{#if (subgraphPath)}}
get graphWatcher (): GraphWatcher {
return this._graphWatcher;
Expand Down Expand Up @@ -671,6 +675,10 @@ export class Indexer implements IndexerInterface {
return this._baseIndexer.getEventsInRange(fromBlockNumber, toBlockNumber, this._serverConfig.gql.maxEventsBlockRange);
}

async getEvents (options: FindManyOptions<Event>): Promise<Array<Event>> {
return this._db.getEvents(options);
}

async getSyncStatus (): Promise<SyncStatus | undefined> {
return this._baseIndexer.getSyncStatus();
}
Expand Down

0 comments on commit 85ca9e3

Please sign in to comment.