nikugogoi
05bfd57278
* Remove block number param from job-queue reset CLI in readme * Add isPruned flag to erc721-watcher custom transferCount entity |
||
---|---|---|
.github/workflows | ||
.husky | ||
packages | ||
.dockerignore | ||
.gitignore | ||
.npmrc | ||
Dockerfile | ||
lerna.json | ||
LICENSE | ||
Makefile | ||
package.json | ||
README.md | ||
yarn.lock |
watcher-ts
Setup
There are packages used from github so we need to follow the following steps to install them:
-
Create a github PAT (personal access token) if it does not already exist.
-
Configure the PAT with scopes mentioned in https://docs.github.com/en/packages/learn-github-packages/about-permissions-for-github-packages#about-scopes-and-permissions-for-package-registries. This is required to install or publish github packages.
-
Follow the steps in https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token to authenticate to github packages. We can also run the follwing to authenticate by logging in to npm.
$ npm login --scope=@cerc-io --registry=https://npm.pkg.github.com > Username: USERNAME > Password: TOKEN > Email: PUBLIC-EMAIL-ADDRESS
Replace with the following:
USERNAME
: GitHub usernameTOKEN
: Personal access token (configured above)PUBLIC-EMAIL-ADDRESS
: Email address
-
When authenticating to github packages for the first time, yarn install may throw Unauthorized error. To overcome this we need to run yarn install in
packages/graph-node
directory. After this yarn install for watcher-ts works properly even from root of the repo.
This project uses yarn workspaces.
Install packages (Node.JS v16.13.1):
yarn
Build packages:
yarn build
Tests
Demos
Services
The default config files used by the watchers assume the following services are setup and running on localhost:
vulcanize/go-ethereum
on port 8545vulcanize/ipld-eth-server
with native GQL API enabled, on port 8082
Note
-
In
vulcanize/ipld-eth-server
, add the following statement to[ethereum]
section inenvironments/config.toml
:chainConfig = "./chain.json" # ETH_CHAIN_CONFIG
Watchers
Databases
Note: Requires postgres12
.
Login as the postgres user:
sudo su - postgres
Create the databases for the watchers:
createdb erc20-watcher
createdb address-watcher
Create the databases for the job queues and enable the pgcrypto
extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
createdb erc20-watcher-job-queue
createdb address-watcher-job-queue
postgres@tesla:~$ psql -U postgres -h localhost erc20-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.
erc20-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION
erc20-watcher-job-queue=# exit
postgres@tesla:~$ psql -U postgres -h localhost address-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.
address-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION
address-watcher-job-queue=# exit
Reset
Reset the databases used by the watchers:
yarn db:reset
Run
Build the files in packages:
yarn build
# To watch for changes and build (used in development).
yarn build:watch
To run any watcher, cd
into their package folder and run:
yarn server
If the watcher uses a job queue, start the job runner in another terminal:
yarn job-runner