Lint fixes in bayc-watcher and rename database (#227)

* Lint fixes in bayc-watcher

* Rename output to bayc-watcher and set contract kind to BAYC
This commit is contained in:
nikugogoi 2022-11-14 16:38:27 +05:30 committed by GitHub
parent d1a172017d
commit 9a4a7cf018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# output # bayc-watcher
## Setup ## Setup
@ -12,7 +12,7 @@
```bash ```bash
sudo su - postgres sudo su - postgres
createdb output createdb bayc-watcher
``` ```
* If the watcher is an `active` watcher: * If the watcher is an `active` watcher:
@ -20,19 +20,19 @@
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro): Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
``` ```
createdb output-job-queue createdb bayc-watcher-job-queue
``` ```
``` ```
postgres@tesla:~$ psql -U postgres -h localhost output-job-queue postgres@tesla:~$ psql -U postgres -h localhost bayc-watcher-job-queue
Password for user postgres: Password for user postgres:
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1)) psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help. Type "help" for help.
output-job-queue=# CREATE EXTENSION pgcrypto; bayc-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION CREATE EXTENSION
output-job-queue=# exit bayc-watcher-job-queue=# exit
``` ```
* In the [config file](./environments/local.toml): * In the [config file](./environments/local.toml):

View File

@ -30,7 +30,7 @@
type = "postgres" type = "postgres"
host = "localhost" host = "localhost"
port = 5432 port = 5432
database = "output" database = "bayc-watcher"
username = "postgres" username = "postgres"
password = "postgres" password = "postgres"
synchronize = true synchronize = true
@ -47,7 +47,7 @@
deleteOnStart = false deleteOnStart = false
[jobQueue] [jobQueue]
dbConnectionString = "postgres://postgres:postgres@localhost/output-job-queue" dbConnectionString = "postgres://postgres:postgres@localhost/bayc-watcher-job-queue"
maxCompletionLagInSecs = 300 maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100 jobDelayInMilliSecs = 100
eventsInBatch = 50 eventsInBatch = 50

View File

@ -1,7 +1,7 @@
{ {
"name": "@cerc-io/output", "name": "@cerc-io/bayc-watcher",
"version": "0.1.0", "version": "0.1.0",
"description": "output", "description": "bayc-watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {

View File

@ -36,7 +36,6 @@ export const handler = async (argv: any): Promise<void> => {
const db = new Database(config.database); const db = new Database(config.database);
await db.init(); await db.init();
const jobQueueConfig = config.jobQueue; const jobQueueConfig = config.jobQueue;
assert(jobQueueConfig, 'Missing job queue config'); assert(jobQueueConfig, 'Missing job queue config');

View File

@ -56,7 +56,7 @@ import { Owner } from './entity/Owner';
const log = debug('vulcanize:indexer'); const log = debug('vulcanize:indexer');
const JSONbigNative = JSONbig({ useNativeBigInt: true }); const JSONbigNative = JSONbig({ useNativeBigInt: true });
const KIND_BOREDAPEYACHTCLUB = 'Empty'; const KIND_BOREDAPEYACHTCLUB = 'BAYC';
export class Indexer implements IndexerInterface { export class Indexer implements IndexerInterface {
_db: Database _db: Database
@ -93,7 +93,6 @@ export class Indexer implements IndexerInterface {
assert(BoredApeYachtClubStorageLayout); assert(BoredApeYachtClubStorageLayout);
this._storageLayoutMap.set(KIND_BOREDAPEYACHTCLUB, BoredApeYachtClubStorageLayout); this._storageLayoutMap.set(KIND_BOREDAPEYACHTCLUB, BoredApeYachtClubStorageLayout);
this._contractMap.set(KIND_BOREDAPEYACHTCLUB, new ethers.utils.Interface(BoredApeYachtClubABI)); this._contractMap.set(KIND_BOREDAPEYACHTCLUB, new ethers.utils.Interface(BoredApeYachtClubABI));
} }
get serverConfig (): ServerConfig { get serverConfig (): ServerConfig {
@ -801,12 +800,11 @@ export class Indexer implements IndexerInterface {
TokenOfOwnerByIndex, TokenOfOwnerByIndex,
TokenByIndex, TokenByIndex,
BaseURI, BaseURI,
Owner, Owner
]; ];
await this._baseIndexer.resetWatcherToBlock(blockNumber, entities); await this._baseIndexer.resetWatcherToBlock(blockNumber, entities);
} }
async _saveBlockAndFetchEvents ({ async _saveBlockAndFetchEvents ({
cid: blockCid, cid: blockCid,
blockHash, blockHash,

View File

@ -13,7 +13,6 @@ import { ValueResult, BlockHeight, gqlTotalQueryCount, gqlQueryCount, jsonBigInt
import { Indexer } from './indexer'; import { Indexer } from './indexer';
import { EventWatcher } from './events'; import { EventWatcher } from './events';
const log = debug('vulcanize:resolver'); const log = debug('vulcanize:resolver');
export const createResolvers = async (indexer: Indexer, eventWatcher: EventWatcher): Promise<any> => { export const createResolvers = async (indexer: Indexer, eventWatcher: EventWatcher): Promise<any> => {

View File

@ -1,4 +1,3 @@
// //
// Copyright 2021 Vulcanize, Inc. // Copyright 2021 Vulcanize, Inc.
// //