Rename to mobymask-watcher (#139)

This commit is contained in:
nikugogoi 2022-07-07 11:50:32 +05:30 committed by GitHub
parent 4b256016da
commit bd3113069a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 20 additions and 25 deletions

View File

@ -1,4 +1,4 @@
# moby-mask-watcher
# mobymask-watcher
## Setup
@ -18,7 +18,7 @@
```bash
sudo su - postgres
createdb moby-mask-watcher
createdb mobymask-watcher
```
* If the watcher is an `active` watcher:
@ -26,19 +26,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):
```
createdb moby-mask-watcher-job-queue
createdb mobymask-watcher-job-queue
```
```
postgres@tesla:~$ psql -U postgres -h localhost moby-mask-watcher-job-queue
postgres@tesla:~$ psql -U postgres -h localhost mobymask-watcher-job-queue
Password for user postgres:
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)
Type "help" for help.
moby-mask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
mobymask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION
moby-mask-watcher-job-queue=# exit
mobymask-watcher-job-queue=# exit
```
* In the [config file](./environments/local.toml):

View File

@ -51,30 +51,30 @@
sudo su - postgres
# If database already exists
# dropdb moby-mask-watcher
# dropdb mobymask-watcher
createdb moby-mask-watcher
createdb mobymask-watcher
```
* 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):
```bash
# If database already exists
# dropdb moby-mask-watcher-job-queue
# dropdb mobymask-watcher-job-queue
createdb moby-mask-watcher-job-queue
createdb mobymask-watcher-job-queue
```
```
postgres@tesla:~$ psql -U postgres -h localhost moby-mask-watcher-job-queue
postgres@tesla:~$ psql -U postgres -h localhost mobymask-watcher-job-queue
Password for user postgres:
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)
Type "help" for help.
moby-mask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
mobymask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION
moby-mask-watcher-job-queue=# exit
mobymask-watcher-job-queue=# exit
```
* In the [config file](./environments/local.toml) update the `database` connection settings.
@ -86,7 +86,7 @@
yarn && yarn build
```
* Change directory to `packages/moby-mask-watcher/` and run the watcher:
* Change directory to `packages/mobymask-watcher/` and run the watcher:
```bash
yarn server
@ -217,7 +217,7 @@
* The events should be visible in the subscription at GQL endpoint. Note down the event blockHash from result.
* The isMember and isPhisher lists should be indexed. Check the database (moby-mask-watcher) tables `is_phisher` and `is_member`, there should be entries at the event blockHash and the value should be true. The data is indexed in `handleEvent` method in the [hooks file](./src/hooks.ts).
* The isMember and isPhisher lists should be indexed. Check the database (mobymask-watcher) tables `is_phisher` and `is_member`, there should be entries at the event blockHash and the value should be true. The data is indexed in `handleEvent` method in the [hooks file](./src/hooks.ts).
* Update the the previous query with event blockHash and check isPhisher and isMember in GraphQL playground

View File

@ -16,7 +16,7 @@
type = "postgres"
host = "localhost"
port = 5432
database = "moby-mask-watcher"
database = "mobymask-watcher"
username = "postgres"
password = "postgres"
synchronize = true
@ -26,7 +26,7 @@
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
blockDelayInMilliSecs = 2000
blockDelayInMilliSecs = 60000
[upstream.cache]
name = "requests"
@ -34,7 +34,7 @@
deleteOnStart = false
[jobQueue]
dbConnectionString = "postgres://postgres:postgres@localhost/moby-mask-watcher-job-queue"
dbConnectionString = "postgres://postgres:postgres@localhost/mobymask-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100
eventsInBatch = 50

View File

@ -1,7 +1,7 @@
{
"name": "@vulcanize/moby-mask-watcher",
"name": "@vulcanize/mobymask-watcher",
"version": "0.1.0",
"description": "moby-mask-watcher",
"description": "mobymask-watcher",
"private": true,
"main": "dist/index.js",
"scripts": {

View File

@ -103,11 +103,6 @@ export const createResolvers = async (indexer: Indexer, eventWatcher: EventWatch
eventsInRange: async (_: any, { fromBlockNumber, toBlockNumber }: { fromBlockNumber: number, toBlockNumber: number }) => {
log('eventsInRange', fromBlockNumber, toBlockNumber);
const { expected, actual } = await indexer.getProcessedBlockCountForRange(fromBlockNumber, toBlockNumber);
if (expected !== actual) {
throw new Error(`Range not available, expected ${expected}, got ${actual} blocks in range`);
}
const events = await indexer.getEventsInRange(fromBlockNumber, toBlockNumber);
return events.map(event => indexer.getResultEvent(event));
},