mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-09 09:14:06 +00:00
Ensuring chronological execution of hooks and checkpointing (#264)
* Subscribe to hooks queue in existing watchers * Change naming strategy for generated get and save functions * Push checkpointing job after post-block hook job completed * Using hooks status to ensure their chronological execution * Add default indices to IPLDBlock table * Add kind parameter to getState GQL API * Add checkpoint CLI * Add blockHash arg to checkpoint CLI and update codegen docs * Print out block hash for checkpoint CLI * Use log from debug for logging * Filter using contract at start in hierarchical query * Make kind argument to prepare IPLDBlock required
This commit is contained in:
@@ -73,6 +73,8 @@
|
||||
|
||||
* Create the databases configured in `environments/local.toml`.
|
||||
|
||||
* Update the derived state checkpoint settings in `environments/local.toml`.
|
||||
|
||||
### Customize
|
||||
|
||||
* Indexing on an event:
|
||||
@@ -81,6 +83,8 @@
|
||||
|
||||
* Edit the custom hook function `handleBlock` (triggered on a block) in `src/hooks.ts` to save `IPLDBlock`s using the `Indexer` object.
|
||||
|
||||
* Edit the custom hook function `genesisHook` (triggered on watch-contract) in `src/hooks.ts` to save a genesis checkpoint `IPLDBlock` using the `Indexer` object.
|
||||
|
||||
* The existing example hooks in `src/hooks.ts` are for an `ERC20` contract.
|
||||
|
||||
### Run
|
||||
@@ -114,7 +118,13 @@
|
||||
* To fill a block range:
|
||||
|
||||
```bash
|
||||
yarn fill --startBlock <from-block> --endBlock <to-block>
|
||||
yarn fill --start-block <from-block> --end-block <to-block>
|
||||
```
|
||||
|
||||
* To create a checkpoint for a contract:
|
||||
|
||||
```bash
|
||||
yarn checkpoint --address <contract-address> --block-hash [block-hash]
|
||||
```
|
||||
|
||||
## Known Issues
|
||||
|
||||
Reference in New Issue
Block a user