Call subgraph block handlers and fix eden-watcher dependency (#52)

* Call subgraph block handler in watchers

* Fix eden-watcher dependency for build

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
This commit is contained in:
nikugogoi 2021-11-17 20:50:35 +05:30 committed by nabarun
parent ec3a8a31a7
commit d76268e506
5 changed files with 27 additions and 2 deletions

View File

@ -35,6 +35,7 @@
"@vulcanize/ipld-eth-client": "^0.1.0",
"@vulcanize/solidity-mapper": "^0.1.0",
"@vulcanize/util": "^0.1.0",
"@vulcanize/graph-node": "^0.1.0",
"apollo-server-express": "^2.25.0",
"apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1",

View File

@ -543,6 +543,11 @@ export class Indexer implements IndexerInterface {
await this.triggerIndexingOnEvent(event);
}
async processBlock (blockHash: string): Promise<void> {
// Call subgraph handler for block.
await this._graphWatcher.handleBlock(blockHash);
}
parseEventNameAndArgs (kind: string, logObj: any): any {
let eventName = UNKNOWN_EVENT_NAME;
let eventInfo = {};

View File

@ -21,7 +21,8 @@ import {
QUEUE_IPFS,
JobQueueConfig,
DEFAULT_CONFIG_PATH,
initClients
initClients,
JOB_KIND_INDEX
} from '@vulcanize/util';
import { GraphWatcher, Database as GraphDatabase } from '@vulcanize/graph-node';
@ -57,6 +58,12 @@ export class JobRunner {
await this._baseJobRunner.processBlock(job);
const { data: { kind, blockHash } } = job;
if (kind === JOB_KIND_INDEX) {
await this._indexer.processBlock(blockHash);
}
await this._jobQueue.markComplete(job);
});
}

View File

@ -553,6 +553,11 @@ export class Indexer implements IndexerInterface {
await this.triggerIndexingOnEvent(event);
}
async processBlock (blockHash: string): Promise<void> {
// Call subgraph handler for block.
await this._graphWatcher.handleBlock(blockHash);
}
parseEventNameAndArgs (kind: string, logObj: any): any {
let eventName = UNKNOWN_EVENT_NAME;
let eventInfo = {};

View File

@ -21,7 +21,8 @@ import {
QUEUE_IPFS,
JobQueueConfig,
DEFAULT_CONFIG_PATH,
initClients
initClients,
JOB_KIND_INDEX
} from '@vulcanize/util';
import { GraphWatcher, Database as GraphDatabase } from '@vulcanize/graph-node';
@ -57,6 +58,12 @@ export class JobRunner {
await this._baseJobRunner.processBlock(job);
const { data: { kind, blockHash } } = job;
if (kind === JOB_KIND_INDEX) {
await this._indexer.processBlock(blockHash);
}
await this._jobQueue.markComplete(job);
});
}