import type { Bytes, Cursor } from "../common"; export type FetchBlockRangeArgs = { startBlock: bigint; maxBlock: bigint; force: boolean; clampAllowed: boolean; filter: TFilter; }; export type FetchBlockRangeResult = { startBlock: bigint; endBlock: bigint; data: FetchBlockResult[]; }; export type FetchBlockResult = { block: TBlock | null; cursor: Cursor | undefined; endCursor: Cursor; }; export type BlockInfo = { blockNumber: bigint; blockHash: Bytes; parentBlockHash: Bytes; }; export type FetchBlockByHashArgs = { blockHash: Bytes; }; export type FetchBlockByHashResult = { data: FetchBlockResult; blockInfo: BlockInfo; }; export type FetchCursorRangeArgs = { startBlockNumber: bigint; endBlockNumber: bigint; }; export type FetchCursorArgs = | { blockTag: "latest" | "finalized"; blockNumber?: undefined; blockHash?: undefined; } | { blockTag?: undefined; blockNumber: bigint; blockHash?: undefined; } | { blockTag?: undefined; blockNumber?: undefined; blockHash: Bytes; }; export type ValidateFilterResult = | { valid: true; error?: undefined; } | { valid: false; error: string; }; export abstract class RpcStreamConfig { abstract headRefreshIntervalMs(): number; abstract finalizedRefreshIntervalMs(): number; abstract fetchCursorRange(args: FetchCursorRangeArgs): Promise; abstract fetchCursor(args: FetchCursorArgs): Promise; abstract validateFilter(filter: TFilter): ValidateFilterResult; abstract fetchBlockRange( args: FetchBlockRangeArgs, ): Promise>; abstract fetchHeaderByHash( args: FetchBlockByHashArgs, ): Promise>; }