Skip to content

Commit

Permalink
Update docs and work around GQL client caching in ipld-eth-client (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikugogoi authored Jul 4, 2022
1 parent c919d78 commit 4b25601
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
19 changes: 19 additions & 0 deletions packages/erc721-watcher/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```
12 changes: 8 additions & 4 deletions packages/ipld-eth-client/src/eth-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ export class EthClient {
}

async getBlockByHash (blockHash?: string): Promise<any> {
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<any> {
Expand Down
25 changes: 24 additions & 1 deletion packages/moby-mask-watcher/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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
```

0 comments on commit 4b25601

Please sign in to comment.