Rough draft alpha 23 migration#898
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughUpdates HyperIndex v3 docs to reflect Alpha v3 unified ChangesV3 Migration & ClickHouse Storage Documentation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/HyperIndex/migrate-to-v3.md`:
- Around line 1020-1023: Add a short, temporary cross-doc warning at the top of
the "Migrate to the unified `indexer` API" section that tells readers that
legacy handler exports like `Contract.Event.handler` and `.contractRegister` are
still shown elsewhere and links back to this migration section; explicitly
recommend using `indexer.onEvent`, `indexer.contractRegister`, or
`indexer.onBlock` instead, and add the same one-line warning to the other
migration area that mirrors this content so copy-pasted legacy patterns won't
break readers.
- Around line 1066-1073: The snippet is incomplete because it uses
indexer.contractRegister without showing how to obtain the indexer instance;
update the “After” example to include a preceding import/initialization of the
indexer (so the indexer variable referenced by indexer.contractRegister exists),
e.g., show importing or creating the indexer instance (using the project's
indexer factory or createIndexer entrypoint) before calling
indexer.contractRegister, and ensure the snippet demonstrates a ready-to-use
indexer variable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9798c664-33a2-4a82-b23f-3f3c420091c9
📒 Files selected for processing (1)
docs/HyperIndex/migrate-to-v3.md
| **Migrate to the unified `indexer` API:** | ||
|
|
||
| All contract-specific handler exports (`ERC20.Transfer.handler`, `Greeter.NewGreeting.contractRegister`, etc.) have been removed. Register every handler through `indexer.onEvent`, `indexer.contractRegister`, or `indexer.onBlock`. | ||
|
|
There was a problem hiding this comment.
Add a temporary cross-doc warning while legacy tutorials are still published.
This guide says the old handler API is hard removed, but other docs in-repo still show legacy Contract.Event.handler / .contractRegister patterns. Please add a short warning here linking users back to this migration section until those pages are updated, to avoid copy-paste failures.
Also applies to: 639-643
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/HyperIndex/migrate-to-v3.md` around lines 1020 - 1023, Add a short,
temporary cross-doc warning at the top of the "Migrate to the unified `indexer`
API" section that tells readers that legacy handler exports like
`Contract.Event.handler` and `.contractRegister` are still shown elsewhere and
links back to this migration section; explicitly recommend using
`indexer.onEvent`, `indexer.contractRegister`, or `indexer.onBlock` instead, and
add the same one-line warning to the other migration area that mirrors this
content so copy-pasted legacy patterns won't break readers.
| **Event handlers** with `indexer.onEvent`: | ||
|
|
||
| ```typescript | ||
| import { indexer } from "generated"; |
There was a problem hiding this comment.
| import { indexer } from "generated"; | |
| import { indexer } from "envio"; |
| **Dynamic contracts** with `indexer.contractRegister`: | ||
|
|
||
| ```typescript | ||
| import { indexer } from "generated"; |
There was a problem hiding this comment.
| import { indexer } from "generated"; | |
| import { indexer } from "envio"; |
| **Block handlers** with `indexer.onBlock` consolidate across chains in a single call: | ||
|
|
||
| ```typescript | ||
| import { indexer } from "generated"; |
There was a problem hiding this comment.
| import { indexer } from "generated"; | |
| import { indexer } from "envio"; |
|
|
||
| ```typescript | ||
| import { ERC20 } from "generated"; | ||
| import { indexer } from "generated"; |
There was a problem hiding this comment.
| import { indexer } from "generated"; | |
| import { indexer } from "envio"; |
| where: () => ({ | ||
| params: [ | ||
| { from: ZERO_ADDRESS, to: addressesFromServer }, | ||
| { from: addressesFromServer, to: ZERO_ADDRESS }, | ||
| ], | ||
| }), |
There was a problem hiding this comment.
| where: () => ({ | |
| params: [ | |
| { from: ZERO_ADDRESS, to: addressesFromServer }, | |
| { from: addressesFromServer, to: ZERO_ADDRESS }, | |
| ], | |
| }), | |
| where: { | |
| params: [ | |
| { from: ZERO_ADDRESS, to: addressesFromServer }, | |
| { from: addressesFromServer, to: ZERO_ADDRESS }, | |
| ], | |
| }, |
| console.log(context.chain.id); // 1 - The chain id of the event | ||
| console.log(context.chain.isLive); // true - Whether the event chain is indexing at the head | ||
| }); | ||
| import { indexer } from "generated"; |
There was a problem hiding this comment.
| import { indexer } from "generated"; | |
| import { indexer } from "envio"; |
| { contract: "ERC20", event: "Approval" }, | ||
| async ({ context }) => { | ||
| console.log(context.chain.id); // 1 - The chain id of the event | ||
| console.log(context.chain.isLive); // true - Whether the event chain is indexing at the head |
There was a problem hiding this comment.
| console.log(context.chain.isLive); // true - Whether the event chain is indexing at the head | |
| console.log(context.chain.isRealtime); // true - Whether the indexer entered realtime mode |
| async ({ event, context }) => { | ||
| // ... your handler logic | ||
| }, | ||
| import { indexer } from "generated"; |
There was a problem hiding this comment.
| import { indexer } from "generated"; | |
| import { indexer } from "envio"; |
| clickhouse: true | ||
| ``` | ||
|
|
||
| Then configure the ClickHouse connection with environment variables: `ENVIO_CLICKHOUSE_SINK_HOST`, `ENVIO_CLICKHOUSE_SINK_DATABASE`, `ENVIO_CLICKHOUSE_SINK_USERNAME`, `ENVIO_CLICKHOUSE_SINK_PASSWORD`. Currently supported only on Dedicated Plan. |
There was a problem hiding this comment.
The env vars without SINK now. Also remove sync mention, it is just a clickhouse storage.
|
|
||
| ```bash | ||
| pnpx envio@3.0.0-alpha.21 init svm | ||
| pnpx envio@3.0.0-alpha.23 init svm |
There was a problem hiding this comment.
| pnpx envio@3.0.0-alpha.23 init svm | |
| pnpx envio@3.0.0-alpha.24 init svm |
* docs: apply PR review fixes to v3 migration guide - Switch indexer imports from "generated" to "envio" - Use static where object in top-level await snippet - Rename context.chain.isLive to isRealtime (and chains[].isLive) - Drop SINK from ClickHouse env vars and reframe as storage, not sink - Bump alpha version 23 -> 24 in init/package.json snippets and release list * docs: rename RPC source mode from live to realtime The `for: live` config option was renamed to `for: realtime`. Update both the migration guide and the LLM doc bundle. * docs: cover v3.0.0-alpha.24 release in migration guide - Switch remaining V3 example imports from "generated" to "envio" (test indexer, type imports, MockDb diff, capitalized entity types) - Document removal of the local "generated" package and the new envio-env.d.ts / .envio types layout - Note the "output" config flag removal and TUI_OFF -> ENVIO_TUI=false breaking change, with checklist entries - Add new feature blurbs for "envio metrics" and continue-on-config-change * docs: clarify realtime RPC mode promotes the source to primary * docs: cover remaining v3.0.0-alpha.23 release notes - Expand ClickHouse Storage section with auto-launch dev container and rename of the early-V3 Sink feature - Add new feature sections: optimized envio codegen, -88MB package size, no hard pnpm requirement, Bun support, --package-manager flag on init, named-field tuple params, throttled multichain backfill, indexer state restored from DB, ReScript v12 / TypeScript v6 - Note ENVIO_PG_HOST and S.nullable fixes under Fixes * docs: tighten ClickHouse coverage and Indexer State section - Drop the early-V3 Sink reference from the migration ClickHouse blurb - Update the ClickHouse blog and the LLM doc bundle to use the new ENVIO_CLICKHOUSE_* env vars and config.yaml storage block, and bump the init command to alpha.24 - Fold the DB-restored indexer state note into the Indexer State & Config section instead of standing alone - Add types: ["node"] to the suggested tsconfig * docs: rename ClickHouse Sink to ClickHouse Storage in blog - Rephrase every "Sink"/"sink" usage to "Storage"/"ClickHouse Storage" in the dedicated blog post and rename the file/slug accordingly - Update the dev-update blog link to the new slug - Drop "now" from the indexer-state DB-restore note in migration guide - Bump suggested package.json devDependencies to add @types/node and vitest pins and bring TypeScript to 6.0.3 * docs: rename ClickHouse cover image to clickhouse-storage.png * docs: rename Solana onBlock handler to onSlot Solana uses slots rather than blocks, so the handler is exposed as indexer.onSlot. Update the Solana page (frontmatter, supported list, notes) and the LLM doc bundle, and add a one-line note in the V3 migration guide's Solana Support section. * docs: rename remaining 'live' RPC mode references to 'realtime' * docs: add explicit Envio Dev/Start Update sections side by side --------- Co-authored-by: Claude <noreply@anthropic.com>
WIP: still working on cross checking the new snippet generated by claude
Summary by CodeRabbit
where) and start-block overrides, ESM + top-level await examples, and updated testing/import guidance.