/**
 * MidnightNodeProvider, Substrate RPC WebSocket Client
 *
 * Connects directly to a Midnight Node via Substrate JSON-RPC 2.0 over WebSocket.
 * Primary data source for the active crawler. Independent of the hosted Midnight Indexer.
 *
 * Protocol: JSON-RPC 2.0 over WebSocket (ws://node:9944)
 * Reference: Polkadot/Substrate RPC specification
 */
export interface NodeProviderConfig {
    nodeUrl: string;
    requestTimeout?: number;
    reconnectInterval?: number;
    maxReconnectAttempts?: number;
}
export interface BlockHeader {
    parentHash: string;
    number: string;
    stateRoot: string;
    extrinsicsRoot: string;
    digest: {
        logs: string[];
    };
}
export interface SignedBlock {
    block: {
        header: BlockHeader;
        extrinsics: string[];
    };
    justifications: any;
}
export interface RuntimeVersion {
    specName: string;
    implName: string;
    specVersion: number;
    implVersion: number;
    transactionVersion: number;
}
export declare class MidnightNodeProvider {
    private ws;
    private requestId;
    private pendingRequests;
    private subscriptions;
    private connected;
    private reconnecting;
    private reconnectAttempts;
    private config;
    private onReconnectCallback;
    private reconnectTimer;
    constructor(config: NodeProviderConfig);
    connect(): Promise<void>;
    disconnect(): Promise<void>;
    isConnected(): boolean;
    /**
     * Register a callback to invoke after successful reconnect.
     * Used by the Crawler to re-establish subscriptions.
     */
    setOnReconnect(callback: () => Promise<void>): void;
    private attemptReconnect;
    rpc(method: string, params?: unknown[]): Promise<any>;
    /**
     * Send multiple RPCs in a single JSON-RPC 2.0 batch request.
     *
     * One WSS frame out, one frame in. The server processes the calls in
     * parallel internally and returns a response array; we resolve each
     * caller's promise as the matching id arrives in `handleMessage`.
     *
     * Returns results in the SAME ORDER as the input requests. Throws if any
     * single sub-request errors out (matches the rpc() semantics).
     */
    rpcBatch(requests: Array<{
        method: string;
        params?: unknown[];
    }>): Promise<any[]>;
    private handleMessage;
    private handleSingleMessage;
    private rejectAllPending;
    /**
     * Get the latest block header
     */
    getLatestHeader(): Promise<BlockHeader>;
    /**
     * Get a block header by hash
     */
    getHeader(hash?: string): Promise<BlockHeader>;
    /**
     * Get a full signed block by hash
     */
    getBlock(hash: string): Promise<SignedBlock>;
    /**
     * Get the block hash for a given height
     */
    getBlockHash(height: number): Promise<string>;
    /**
     * Get the finalized block head hash
     */
    getFinalizedHead(): Promise<string>;
    /**
     * Query runtime storage at a given key (optionally at a specific block)
     */
    getStorage(key: string, blockHash?: string): Promise<string | null>;
    /**
     * Get the runtime version
     */
    getRuntimeVersion(blockHash?: string): Promise<RuntimeVersion>;
    /**
     * Get runtime metadata (SCALE-encoded)
     */
    getMetadata(blockHash?: string): Promise<string>;
    /**
     * Get node health status
     */
    health(): Promise<{
        peers: number;
        isSyncing: boolean;
        shouldHavePeers: boolean;
    }>;
    /**
     * Get the chain name
     */
    chain(): Promise<string>;
    /**
     * Get the node name
     */
    name(): Promise<string>;
    /**
     * Get the node version
     */
    version(): Promise<string>;
    /**
     * Subscribe to new block headers (finalized)
     */
    subscribeNewHeads(callback: (header: BlockHeader) => void): Promise<string>;
    /**
     * Subscribe to finalized block headers
     */
    subscribeFinalizedHeads(callback: (header: BlockHeader) => void): Promise<string>;
    /**
     * Unsubscribe from new heads
     */
    unsubscribeNewHeads(subscriptionId: string): Promise<boolean>;
    /**
     * Unsubscribe from finalized heads
     */
    unsubscribeFinalizedHeads(subscriptionId: string): Promise<boolean>;
    /**
     * Parse a hex-encoded block number to integer
     */
    static parseBlockNumber(hex: string): number;
    /**
     * Get pending request count (for health monitoring)
     */
    getPendingRequestCount(): number;
    /**
     * Get active subscription count
     */
    getSubscriptionCount(): number;
}
