Overview
The JSON-RPC schemas module provides:- Request Schemas - Validate outgoing RPC requests with method-specific parameter types
- Response Schemas - Parse and validate incoming RPC responses with proper result types
- Common Schemas - Reusable primitives for hex values, addresses, block tags, transactions
- Batch Support - Validate batched request/response arrays
- Type Inference - Full TypeScript type inference from schemas
- Effect Integration - Seamless integration with Effect pipelines
Installation
Common Schemas
Hex Primitives
JSON-RPC ID
Block Tag
Transaction Request
Log Filter
State Override Set
RPC Result Schemas
LogRpcSchema
TransactionRpcSchema
ReceiptRpcSchema
BlockRpcSchema
Method Schemas
eth_* Methods
Import via theEth namespace:
| Method | Description |
|---|---|
eth_accounts | List accounts controlled by client |
eth_blockNumber | Get current block number |
eth_chainId | Get chain ID |
eth_coinbase | Get coinbase address |
eth_syncing | Get sync status |
| Method | Description |
|---|---|
eth_gasPrice | Get current gas price |
eth_maxPriorityFeePerGas | Get suggested priority fee |
eth_blobBaseFee | Get current blob base fee (EIP-4844) |
eth_feeHistory | Get historical fee data |
eth_estimateGas | Estimate gas for transaction |
eth_createAccessList | Create EIP-2930 access list |
| Method | Description |
|---|---|
eth_getBalance | Get account balance |
eth_getCode | Get contract bytecode |
eth_getTransactionCount | Get account nonce |
eth_getStorageAt | Get storage slot value |
eth_getProof | Get Merkle proof (EIP-1186) |
| Method | Description |
|---|---|
eth_call | Execute call without transaction |
eth_sendTransaction | Send transaction (requires signer) |
eth_sendRawTransaction | Broadcast signed transaction |
eth_sign | Sign message |
eth_signTransaction | Sign transaction |
eth_getTransactionByHash | Get transaction by hash |
eth_getTransactionReceipt | Get transaction receipt |
eth_getTransactionByBlockHashAndIndex | Get tx by block hash + index |
eth_getTransactionByBlockNumberAndIndex | Get tx by block number + index |
| Method | Description |
|---|---|
eth_getBlockByNumber | Get block by number |
eth_getBlockByHash | Get block by hash |
eth_getBlockReceipts | Get all receipts in block |
eth_getBlockTransactionCountByHash | Get tx count by block hash |
eth_getBlockTransactionCountByNumber | Get tx count by block number |
eth_getUncleByBlockHashAndIndex | Get uncle by block hash + index |
eth_getUncleByBlockNumberAndIndex | Get uncle by block number + index |
eth_getUncleCountByBlockHash | Get uncle count by block hash |
eth_getUncleCountByBlockNumber | Get uncle count by block number |
| Method | Description |
|---|---|
eth_getLogs | Get logs matching filter |
eth_newFilter | Create log filter |
eth_newBlockFilter | Create block filter |
eth_newPendingTransactionFilter | Create pending tx filter |
eth_getFilterChanges | Poll filter for changes |
eth_getFilterLogs | Get all filter logs |
eth_uninstallFilter | Remove filter |
| Method | Description |
|---|---|
eth_subscribe | Subscribe to events |
eth_unsubscribe | Unsubscribe from events |
| Method | Description |
|---|---|
eth_mining | Is client mining |
eth_hashrate | Get mining hashrate |
eth_getWork | Get mining work |
eth_submitWork | Submit PoW solution |
eth_submitHashrate | Submit hashrate |
eth_protocolVersion | Get protocol version |
Example: eth_call Schema
wallet_* Methods
Import via theWallet namespace for schemas:
| Method | Description |
|---|---|
wallet_addEthereumChain | Add new chain to wallet |
wallet_switchEthereumChain | Switch active chain |
wallet_watchAsset | Add token to wallet |
wallet_requestPermissions | Request permissions |
wallet_getPermissions | Get current permissions |
wallet_revokePermissions | Revoke permissions |
wallet_registerOnboarding | Register onboarding URL |
wallet_sendCalls | Batch calls (EIP-5792) |
wallet_getCallsStatus | Get batch status |
wallet_showCallsStatus | Show batch UI |
wallet_getCapabilities | Get wallet capabilities |
net_* Methods
| Method | Description |
|---|---|
net_version | Get network ID |
net_listening | Check if node is listening |
net_peerCount | Get connected peer count |
web3_* Methods
| Method | Description |
|---|---|
web3_clientVersion | Get client version string |
web3_sha3 | Compute keccak256 hash |
txpool_* Methods
| Method | Description |
|---|---|
txpool_status | Get pending/queued tx counts |
txpool_content | Get all pending transactions |
txpool_inspect | Get transaction summaries |
anvil_* Methods
Foundry Anvil devnet methods:| Method | Description |
|---|---|
anvil_impersonateAccount | Impersonate account |
anvil_stopImpersonatingAccount | Stop impersonation |
anvil_mine | Mine blocks |
anvil_setBalance | Set account balance |
anvil_setCode | Set contract code |
anvil_setNonce | Set account nonce |
anvil_setStorageAt | Set storage slot |
anvil_snapshot | Create state snapshot |
anvil_revert | Revert to snapshot |
anvil_setBlockTimestampInterval | Set block interval |
anvil_setNextBlockTimestamp | Set next block time |
anvil_setAutomine | Toggle automine |
anvil_dropTransaction | Remove pending tx |
anvil_reset | Reset fork state |
hardhat_* Methods
Hardhat Network methods:| Method | Description |
|---|---|
hardhat_impersonateAccount | Impersonate account |
hardhat_stopImpersonatingAccount | Stop impersonation |
hardhat_mine | Mine blocks |
hardhat_setBalance | Set account balance |
hardhat_setCode | Set contract code |
hardhat_setNonce | Set account nonce |
hardhat_setStorageAt | Set storage slot |
hardhat_dropTransaction | Remove pending tx |
hardhat_reset | Reset network state |
Generic Fallback
For custom or unknown methods:Batch Requests
Batch Utilities
Utility Functions
Validation Predicates
Decode Functions
Response Handling
Effect Pipeline Integration
Type Inference
Extract TypeScript types from schemas:Related
- JsonRpcError - Error codes and error handling
- JSONRPCProvider - High-level provider abstraction
- Effect.ts Schema - Schema library documentation

