mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 16:54:08 +00:00
Implement remaining graph-node host APIs for templates (#475)
* Implement createWithContext graph-node dataSource host API * Parse individual context entries * Implement graph-node dataSource context host API * Handle array type fields and refactor code * Resolve all values when parsing an array field * Fix wasm entity creation with array type fields * Required codegen changes
This commit is contained in:
@@ -26,6 +26,13 @@ columns:
|
||||
pgType: integer
|
||||
tsType: number
|
||||
columnType: Column
|
||||
- name: context
|
||||
pgType: jsonb
|
||||
tsType: 'Record<string, { data: any, type: number }>'
|
||||
columnType: Column
|
||||
columnOptions:
|
||||
- option: nullable
|
||||
value: true
|
||||
imports:
|
||||
- toImport:
|
||||
- Entity
|
||||
|
||||
@@ -229,10 +229,10 @@ export class Database implements DatabaseInterface {
|
||||
return this._baseDatabase.saveBlockProgress(repo, block);
|
||||
}
|
||||
|
||||
async saveContract (queryRunner: QueryRunner, address: string, kind: string, checkpoint: boolean, startingBlock: number): Promise<Contract> {
|
||||
async saveContract (queryRunner: QueryRunner, address: string, kind: string, checkpoint: boolean, startingBlock: number, context?: any): Promise<Contract> {
|
||||
const repo = queryRunner.manager.getRepository(Contract);
|
||||
|
||||
return this._baseDatabase.saveContract(repo, address, kind, checkpoint, startingBlock);
|
||||
return this._baseDatabase.saveContract(repo, address, kind, checkpoint, startingBlock, context);
|
||||
}
|
||||
|
||||
async updateSyncStatusIndexedBlock (queryRunner: QueryRunner, blockHash: string, blockNumber: number, force = false): Promise<SyncStatus> {
|
||||
|
||||
@@ -32,7 +32,7 @@ export class {{className}} {{~#if implements}} implements {{implements}} {{~/if}
|
||||
{{~#unless @last}},{{/unless}}
|
||||
{{~/each}} }
|
||||
{{~/if}})
|
||||
{{column.name}}!: {{column.tsType}};
|
||||
{{column.name}}!: {{{column.tsType}}};
|
||||
{{~#unless @last}}
|
||||
|
||||
{{/unless}}
|
||||
|
||||
@@ -595,8 +595,8 @@ export class Indexer implements IndexerInterface {
|
||||
}
|
||||
|
||||
{{/if}}
|
||||
async watchContract (address: string, kind: string, checkpoint: boolean, startingBlock: number): Promise<void> {
|
||||
return this._baseIndexer.watchContract(address, kind, checkpoint, startingBlock);
|
||||
async watchContract (address: string, kind: string, checkpoint: boolean, startingBlock: number, context?: any): Promise<void> {
|
||||
return this._baseIndexer.watchContract(address, kind, checkpoint, startingBlock, context);
|
||||
}
|
||||
|
||||
updateStateStatusMap (address: string, stateStatus: StateStatus): void {
|
||||
|
||||
Reference in New Issue
Block a user