What problem does it solve?
HyperIndex has no onTransaction handler, so developers often struggle to access transaction and block data inside event handlers and hit type errors when reading fields they never selected. This Skill explains how event.transaction and event.block work and how the fields option controls exactly what data they carry.
Core Features & Use Cases
- Per-handler field selection: Declare transaction and block fields inline in indexer.onEvent or indexer.contractRegister so only requested data is fetched and typed.
- Type-safe access: Reading a field not listed in fields produces a compile-time type error, while event.block.number is always available without listing.
- Config-level fallback: Use field_selection in config.yaml to apply selections across all handlers of an event, with handler-level fields taking precedence.
- Use Case: When indexing ERC-20 Transfer events, list fields: { transaction: ["hash", "from"], block: ["timestamp"] } to record who sent each transfer and when, without fetching unused data.
Quick Start
Ask the AI to add a fields option selecting transaction hash and block timestamp to your HyperIndex Transfer event handler.