import { BlockHash, Header } from '@dedot/codecs'; import { HexString } from '@dedot/utils'; import type { BlockExplorer, BlockInfo } from '../../types.js'; import type { LegacyClient } from '../LegacyClient.js'; /** * @name LegacyBlockExplorer * @description Block explorer implementation for LegacyClient using legacy JSON-RPC methods * Optimized to share RPC subscriptions across multiple subscribers using Signal pattern */ export declare class LegacyBlockExplorer implements BlockExplorer { #private; constructor(client: LegacyClient); /** * Convert PinnedBlock to BlockInfo format */ private toBlockInfo; /** * Fill missing blocks when a gap is detected * Fetches and emits all missing blocks between lastNumber and currentNumber */ private fillMissingBlocks; /** * Start the shared best block subscription if not already active */ private ensureBestBlockSubscription; private hasNewRuntime; /** * Start the shared finalized block subscription if not already active */ private ensureFinalizedBlockSubscription; /** * Clean up best block subscription when no more listeners */ private cleanupBestBlockSubscription; /** * Clean up finalized block subscription when no more listeners */ private cleanupFinalizedBlockSubscription; private calculateBlockHash; /** * Get the best block */ best(): Promise; /** * Subscribe to the best block * Multiple subscribers will share a single RPC subscription * New subscribers immediately receive the current best block if available */ best(callback: (block: BlockInfo) => void): () => void; /** * Get the finalized block */ finalized(): Promise; /** * Subscribe to the finalized block * Multiple subscribers will share a single RPC subscription * New subscribers immediately receive the current finalized block if available */ finalized(callback: (block: BlockInfo) => void): () => void; /** * Get the header of a block by number or hash */ header(hash: BlockHash): Promise
; /** * Get the body (transactions) of a block by number or hash */ body(hash: BlockHash): Promise; }