import { type Context } from 'hono'; import { Hex } from 'ox'; import * as z from 'zod/mini'; import type * as App from '../../../App.js'; import * as Response from '../../../internal/Response.js'; import * as Schema from '../../../internal/Schema.js'; /** The EVM block tags accepted by the `:block` selector. */ declare const blockTags: readonly ['latest', 'finalized']; /** Zod schemas owned by the block handlers. */ export declare namespace schema { /** The verbatim JSON-RPC payloads, surfaced under each resource's `rpc` field. */ namespace Rpc { /** A JSON-RPC block, passed through verbatim. */ const Block: z.ZodMiniObject<{ baseFeePerGas: z.ZodMiniOptional>>; difficulty: z.ZodMiniOptional>; extraData: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; gasLimit: z.ZodMiniTemplateLiteral<`0x${string}`>; gasUsed: z.ZodMiniTemplateLiteral<`0x${string}`>; hash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; logsBloom: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; miner: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; mixHash: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; nonce: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; number: z.ZodMiniNullable>; parentHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; receiptsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; sha3Uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; size: z.ZodMiniTemplateLiteral<`0x${string}`>; stateRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; timestamp: z.ZodMiniTemplateLiteral<`0x${string}`>; totalDifficulty: z.ZodMiniOptional>; transactions: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; withdrawals: z.ZodMiniOptional>>; withdrawalsRoot: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; }, z.core.$loose>; } /** * Metadata for a block: the verbatim JSON-RPC block (always present). Held in * a `meta` envelope so future opt-in `include` resources (e.g. embedded * transactions) can layer in without breaking the response shape. */ const BlockMeta: z.ZodMiniObject<{ rpc: z.ZodMiniObject<{ baseFeePerGas: z.ZodMiniOptional>>; difficulty: z.ZodMiniOptional>; extraData: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; gasLimit: z.ZodMiniTemplateLiteral<`0x${string}`>; gasUsed: z.ZodMiniTemplateLiteral<`0x${string}`>; hash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; logsBloom: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; miner: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; mixHash: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; nonce: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; number: z.ZodMiniNullable>; parentHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; receiptsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; sha3Uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; size: z.ZodMiniTemplateLiteral<`0x${string}`>; stateRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; timestamp: z.ZodMiniTemplateLiteral<`0x${string}`>; totalDifficulty: z.ZodMiniOptional>; transactions: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; withdrawals: z.ZodMiniOptional>>; withdrawalsRoot: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; }, z.core.$loose>; }, z.core.$strip>; /** * A humanized block: decimal-string amounts, ISO 8601 timestamps, and plain * numbers for block fields. The verbatim JSON-RPC payload is always * available under `meta.rpc`. Transactions are omitted from the response; * clients filter `GET /v1/transactions` to this block number. */ const Block: z.ZodMiniObject<{ baseFeePerGas: z.ZodMiniNullable>; gasLimit: z.ZodMiniNumber; gasUsed: z.ZodMiniNumber; hash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; id: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; meta: z.ZodMiniObject<{ rpc: z.ZodMiniObject<{ baseFeePerGas: z.ZodMiniOptional>>; difficulty: z.ZodMiniOptional>; extraData: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; gasLimit: z.ZodMiniTemplateLiteral<`0x${string}`>; gasUsed: z.ZodMiniTemplateLiteral<`0x${string}`>; hash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; logsBloom: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; miner: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; mixHash: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; nonce: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; number: z.ZodMiniNullable>; parentHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; receiptsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; sha3Uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; size: z.ZodMiniTemplateLiteral<`0x${string}`>; stateRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; timestamp: z.ZodMiniTemplateLiteral<`0x${string}`>; totalDifficulty: z.ZodMiniOptional>; transactions: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; withdrawals: z.ZodMiniOptional>>; withdrawalsRoot: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; }, z.core.$loose>; }, z.core.$strip>; miner: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; number: z.ZodMiniNumber; parentHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; size: z.ZodMiniNumber; timestamp: z.ZodMiniISODateTime; transactionCount: z.ZodMiniNumber; }, z.core.$strip>; /** * A lightweight block row, returned by the `/blocks` list endpoint. Full * fields (parentHash, miner, gasUsed/gasLimit, …) would require one RPC * roundtrip per row; the list endpoint stays cheap and clients fetch * `/blocks/:block` for individual blocks they care about. The block hash is * selected from the index so `id` stays tied to the resolved block identity. */ const BlockSummary: z.ZodMiniObject<{ hash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; id: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; number: z.ZodMiniNumber; timestamp: z.ZodMiniISODateTime; transactionCount: z.ZodMiniNumber; }, z.core.$strip>; /** Schemas for the getBlocks operation. */ namespace getBlocks { /** Query parameters for `GET /blocks`. */ const Query: z.ZodMiniObject<{ chainId: z.ZodMiniOptional, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>>; cursor: z.ZodMiniOptional>; limit: z.ZodMiniDefault, z.ZodMiniTransform>>; order: z.ZodMiniDefault>; page: z.ZodMiniOptional>; }, z.core.$strict>; /** Page of lightweight block rows, including empty blocks. */ const Response: z.ZodMiniObject<{ data: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; id: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; number: z.ZodMiniNumber; timestamp: z.ZodMiniISODateTime; transactionCount: z.ZodMiniNumber; }, z.core.$strip>>; nextCursor: z.ZodMiniNullable>; }, z.core.$strip>; } /** Schemas for the getBlock operation. */ namespace getBlock { /** * Path parameter for block requests. Resolves a single block from any of: * a block tag (`latest`, `finalized`); a decimal or `0x`-prefixed hex block * number; a `0x`-prefixed 32-byte block hash; or an ISO 8601 timestamp * (`2023-11-14T22:13:20Z`), which resolves to the first block at or after * that instant. */ const Params: z.ZodMiniObject<{ block: z.ZodMiniUnion, z.ZodMiniString, z.ZodMiniISODateTime]>; }, z.core.$strip>; /** Query parameters for `GET /blocks/:block`. */ const Query: z.ZodMiniObject<{ chainId: z.ZodMiniOptional, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>>; }, z.core.$strict>; /** A humanized block, with the verbatim JSON-RPC payload under `meta.rpc`. */ const Response: z.ZodMiniObject<{ baseFeePerGas: z.ZodMiniNullable>; gasLimit: z.ZodMiniNumber; gasUsed: z.ZodMiniNumber; hash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; id: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; meta: z.ZodMiniObject<{ rpc: z.ZodMiniObject<{ baseFeePerGas: z.ZodMiniOptional>>; difficulty: z.ZodMiniOptional>; extraData: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>; gasLimit: z.ZodMiniTemplateLiteral<`0x${string}`>; gasUsed: z.ZodMiniTemplateLiteral<`0x${string}`>; hash: z.ZodMiniNullable, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; logsBloom: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; miner: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; mixHash: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; nonce: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, string>>>>; number: z.ZodMiniNullable>; parentHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; receiptsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; sha3Uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; size: z.ZodMiniTemplateLiteral<`0x${string}`>; stateRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; timestamp: z.ZodMiniTemplateLiteral<`0x${string}`>; totalDifficulty: z.ZodMiniOptional>; transactions: z.ZodMiniArray, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; transactionsRoot: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; uncles: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>>; withdrawals: z.ZodMiniOptional>>; withdrawalsRoot: z.ZodMiniOptional, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>>; }, z.core.$loose>; }, z.core.$strip>; miner: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; number: z.ZodMiniNumber; parentHash: z.ZodMiniPipe, z.ZodMiniTransform<`0x${string}`, `0x${string}`>>; size: z.ZodMiniNumber; timestamp: z.ZodMiniISODateTime; transactionCount: z.ZodMiniNumber; }, z.core.$strip>; } /** * Schemas for the legacy `getBlockByTimestamp` compatibility operation * (`GET /chains/:chainId/blocks/by-timestamp`). Hidden from the docs; kept to * keep pre-existing clients of the prior Tempo API working unchanged. */ namespace getBlockByTimestamp { /** Path parameters: the numeric Tempo chain id. */ const Params: z.ZodMiniObject<{ chainId: z.ZodMiniPipe, z.ZodMiniTransform<4217 | 42431, "mainnet" | "testnet">>, z.ZodMiniPipe, z.ZodMiniTransform>]>, z.ZodMiniNumber>; }, z.core.$strip>; /** Query parameters: a required unix timestamp and the search direction. */ const Query: z.ZodMiniObject<{ closest: z.ZodMiniDefault>; timestamp: z.ZodMiniNumber; }, z.core.$strict>; /** The legacy response envelope: `{ block: { blockNumber, blockTimestamp } }`. */ const Response: z.ZodMiniObject<{ block: z.ZodMiniObject<{ blockNumber: z.ZodMiniNumber; blockTimestamp: z.ZodMiniNumber; }, z.core.$strip>; }, z.core.$strip>; } } /** Creates block handlers. */ export declare function blocks(): import("hono/hono-base").HonoBase; /** * Mounts the hidden legacy `GET /chains/:chainId/blocks/by-timestamp` * compatibility route at the app root. The prior Tempo API exposed this shape * (chain id in the path, a required unix `timestamp`, and a `closest` direction) * and returned `{ block: { blockNumber, blockTimestamp } }`; this preserves it * so existing clients keep working while the canonical surface is * `GET /v1/blocks/:block` with an ISO 8601 selector. * * Like the original it searches a ±{@link byTimestampWindowSeconds}s window and * returns `404` when no indexed block falls within it. A local supported-chain * check keeps standalone composition safe. */ export declare function blocksByTimestampCompat(): import("hono/hono-base").HonoBase; export declare namespace findBlockByTimestamp { type Options = { chainId: z.output; closest: 'before' | 'after'; timestamp: number; }; } /** * Parses a `:block` path parameter, dispatching by shape. Returns the * discriminated identifier, or `undefined` when the input matches no known * shape (the schema should have caught this earlier; this guards the type at * the use site). * * Selectors are unambiguous by shape: a block tag is a fixed keyword; the * 66-char `0x`-prefixed length identifies a 32-byte hash; any other * `0x`-prefixed hex (or plain decimal) is a block number; and an ISO 8601 * timestamp (validated with the same {@link blockTimestamp} schema as the * route) is resolved to its UTC instant. */ export declare function parseBlockIdentifier(value: string): parseBlockIdentifier.Result | undefined; export declare namespace parseBlockIdentifier { /** An EVM block tag accepted by the `:block` selector. */ type BlockTag = (typeof blockTags)[number]; /** A parsed block identifier, dispatching by shape. */ type Result = { kind: 'tag'; tag: BlockTag; } | { kind: 'hash'; hash: Hex.Hex; } | { kind: 'number'; number: bigint; } | { kind: 'timestamp'; iso: string; }; } /** * Lists blocks from the indexer. Reads every block from the `blocks` table * (so empty blocks are included) and resolves transaction counts via a * second narrow `txs` query keyed to the page's block numbers. */ export declare function listBlocks(c: Context, options: listBlocks.Options): Promise<{ data: { hash: `0x${string}`; id: `0x${string}`; number: number; timestamp: string; transactionCount: number; }[]; nextCursor: string | null; }>; export declare namespace listBlocks { type Options = { chainId: z.output; /** Opaque keyset cursor anchoring the page; omit for the head page. */ cursor?: string | undefined; limit: number; /** 1-indexed page number (positional pagination; exclusive with `cursor`). */ page?: number | undefined; order: 'asc' | 'desc'; }; } export {}; //# sourceMappingURL=blocks.d.ts.map