From 4b256016da035d69a50f55eeacd6e42085654992 Mon Sep 17 00:00:00 2001 From: nikugogoi Date: Mon, 4 Jul 2022 15:36:47 +0530 Subject: [PATCH] Update docs and work around GQL client caching in ipld-eth-client (#138) --- packages/erc721-watcher/demo.md | 19 ++++++++++++++++ packages/ipld-eth-client/src/eth-client.ts | 12 +++++++---- packages/moby-mask-watcher/demo.md | 25 +++++++++++++++++++++- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/packages/erc721-watcher/demo.md b/packages/erc721-watcher/demo.md index 3327f2ea..ec2834bb 100644 --- a/packages/erc721-watcher/demo.md +++ b/packages/erc721-watcher/demo.md @@ -90,6 +90,13 @@ * In the [config file](./environments/local.toml) update the `database` connection settings. +* In `graph-watcher` repo, follow the instructions in [Setup](../../README.md#setup) for installing and building packages. + + ```bash + # After setup + yarn && yarn build + ``` + * Run the watcher: ```bash @@ -380,3 +387,15 @@ * Open IPFS WebUI http://127.0.0.1:5001/webui and search for IPLDBlocks using their CIDs. * The state should have auto indexed data and also custom property `transferCount` according to code in [hooks](./src/hooks.ts) file `handleEvent` method. + +## Reset / Clean up + +* To close down services in stack-orchestrator, hit `ctrl + c` in the terminal where it was run. + +* To stop and remove stack-orchestrator services running in background run: + + ```bash + cd stack-orchestrator + + docker-compose -f ./docker/latest/docker-compose-db-sharding.yml down -v --remove-orphans + ``` diff --git a/packages/ipld-eth-client/src/eth-client.ts b/packages/ipld-eth-client/src/eth-client.ts index 9203c030..de5e99e8 100644 --- a/packages/ipld-eth-client/src/eth-client.ts +++ b/packages/ipld-eth-client/src/eth-client.ts @@ -102,11 +102,15 @@ export class EthClient { } async getBlockByHash (blockHash?: string): Promise { - const { block } = await this._graphqlClient.query(ethQueries.getBlockByHash, { blockHash }); - block.number = parseInt(block.number, 16); - block.timestamp = parseInt(block.timestamp, 16); + const result = await this._graphqlClient.query(ethQueries.getBlockByHash, { blockHash }); - return { block }; + return { + block: { + ...result.block, + number: parseInt(result.block.number, 16), + timestamp: parseInt(result.block.timestamp, 16) + } + }; } async getLogs (vars: Vars): Promise { diff --git a/packages/moby-mask-watcher/demo.md b/packages/moby-mask-watcher/demo.md index 1b42d6d9..91619a20 100644 --- a/packages/moby-mask-watcher/demo.md +++ b/packages/moby-mask-watcher/demo.md @@ -79,9 +79,10 @@ * In the [config file](./environments/local.toml) update the `database` connection settings. -* In `graph-watcher` repo, install and build packages: +* In `graph-watcher` repo, follow the instructions in [Setup](../../README.md#setup) for installing and building packages. ```bash + # After setup yarn && yarn build ``` @@ -247,3 +248,25 @@ ``` The data is fetched from watcher database as it is already indexed. + +## Reset / Clean up + +* Reset and clear deployments in MobyMask repo: + + ```bash + cd packages/hardhat + + # Remove previous deployments in local network if any + cd deployments + git clean -xdf + ``` + +* To close down services in stack-orchestrator, hit `ctrl + c` in the terminal where it was run. + +* To stop and remove stack-orchestrator services running in background run: + + ```bash + cd stack-orchestrator + + docker-compose -f ./docker/latest/docker-compose-db-sharding.yml down -v --remove-orphans + ```