This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
Type System
All JSON-RPC types are auto-generated from the ethereum/execution-apis OpenRPC specification, ensuring they stay in sync with the official Ethereum JSON-RPC API.
Auto-Generation from OpenRPC
Types are auto-generated from the official OpenRPC spec.
Source: ethereum/execution-apis OpenRPC specification
Format: OpenRPC JSON-RPC API description
Total methods: 65 across 3 namespaces (eth, debug, engine)
Type Hierarchy
Namespace Organization
Important: All files except types/ are auto-generated and should not be edited manually.
Base Types
Core types used throughout the JSON-RPC API:
These types are hand-written in jsonrpc/types/ and used by generated method definitions.
Branded Primitives Integration
Generated types use Voltaire’s branded primitive system:
Benefits:
- Type-safe at compile time
- Zero runtime overhead (just Uint8Array/string)
- Can’t mix Address and Hash accidentally
- IDE autocomplete and refactoring
Method Type Structure
Each generated method includes:
Response Type
All methods return the same Response<T> structure:
This enforces error checking before accessing results.
Type Safety Examples
Compile-Time Validation
Type Inference
TypeScript infers return types automatically:
Discriminated Unions
After checking for errors, TypeScript narrows types:
TypeScript and Zig Interop
Types are generated for both TypeScript and Zig:
Version Compatibility
Generated types match the version of ethereum/execution-apis used during generation.
Current version: Based on latest execution-apis main branch
Update frequency: Regenerate types when new RPC methods or parameters are added to the spec
Breaking changes: Rare, but follow Ethereum’s JSON-RPC versioning (e.g., engine_newPayloadV1 → V2 → V3)
Custom Types
While most types are generated, you can extend them for application-specific needs:
Specifications