Add method in watchers to cache contract and fixes for running tests

This commit is contained in:
nabarun 2021-12-13 13:28:00 +05:30
parent cb2fe2aa45
commit ba890e7d9a
6 changed files with 20 additions and 4 deletions

View File

@ -140,3 +140,10 @@ If the watcher uses a job queue, start the job runner in another terminal:
```bash
yarn job-runner
```
## Known Issues
* When authenticating to github packages for the first time, yarn install throws Unauthorized error in [graph-watcher-ts](https://github.com/vulcanize/graph-watcher-ts) repo even after setup.
To overcome this we need to run yarn install in `packages/graph-node` directory of graph-watcher repo. After this yarn install for graph-watcher-ts works properly even from root of the repo.

View File

@ -75,7 +75,7 @@
yarn server
```
GQL console: http://localhost:3008/graphql
GQL console: http://localhost:3012/graphql
* If the watcher is an `active` watcher:

View File

@ -824,6 +824,10 @@ export class Indexer implements IndexerInterface {
return this._baseIndexer.watchContract(address, kind, checkpoint, startingBlock);
}
cacheContract (contract: Contract): void {
return this._baseIndexer.cacheContract(contract);
}
async saveEventEntity (dbEvent: Event): Promise<Event> {
return this._baseIndexer.saveEventEntity(dbEvent);
}

View File

@ -425,6 +425,10 @@ export class Indexer implements IndexerInterface {
return this._baseIndexer.watchContract(address, kind, checkpoint, startingBlock);
}
cacheContract (contract: Contract): void {
return this._baseIndexer.cacheContract(contract);
}
async saveEventEntity (dbEvent: Event): Promise<Event> {
return this._baseIndexer.saveEventEntity(dbEvent);
}

View File

@ -6,7 +6,7 @@ import { Contract, ethers, Signer } from 'ethers';
import assert from 'assert';
import {
getConfig, getResetConfig, JobQueue
getConfig, initClients, JobQueue
} from '@vulcanize/util';
import {
deployWETH9Token,
@ -57,7 +57,7 @@ const main = async () => {
assert(host, 'Missing host.');
assert(port, 'Missing port.');
const { ethClient, postgraphileClient, ethProvider } = await getResetConfig(config);
const { ethClient, postgraphileClient, ethProvider } = await initClients(config);
// Initialize uniClient.
const endpoint = `http://${host}:${port}/graphql`;

View File

@ -166,7 +166,8 @@ export const insertDummyBlock = async (db: DatabaseInterface, parentBlock: any):
blockNumber,
blockHash,
blockTimestamp,
parentHash
parentHash,
cid: ''
};
await db.updateSyncStatusChainHead(dbTx, blockHash, blockNumber);