import type { Hash } from '@ariestools/sdk';
import type { Payload, WithHashMeta } from '@xyo-network/sdk';
import type { BlockRate, BlockViewer, ChainId, SignedHydratedBlockWithHashMeta, SingleTimeConfig, TimeDurations, XL1BlockNumber, XL1BlockRange } from '@xyo-network/xl1-protocol/protocol-lib';
import { LruCacheMap } from '../driver-memory/index.js';
import type { CreatableProviderParams } from '../protocol-sdk/index.js';
import { AbstractCreatableProvider } from '../protocol-sdk/index.js';
/** Parameters for RestBlockViewer. */
export interface RestBlockViewerParams extends CreatableProviderParams {
    /**
     * Base URL serving the mutable chain state (the head pointer, `chain/head.json`) when it
     * lives in a separate bucket/domain from the finalized files. Defaults to `finalizedBaseUrl`.
     */
    chainStateBaseUrl?: string;
    /** Optional fetch override (custom agents, auth headers, tests). Defaults to the global fetch. */
    fetchFn?: typeof globalThis.fetch;
    /** Base URL of the finalized (immutable) static chain files (e.g. a public R2 bucket or CDN domain). */
    finalizedBaseUrl: string;
    headPollIntervalMs?: number;
    /**
     * Base URL serving the chain index files (the step-summary families) when the index lives in
     * its own bucket/domain. Defaults to `finalizedBaseUrl`.
     */
    indexBaseUrl?: string;
}
/**
 * A BlockViewer over a statically generated REST file layout (see `@xyo-network/xl1-network-model`).
 *
 * Reads are anonymous HTTP GETs against immutable files, so everything except the head
 * pointer is cached aggressively. The head pointer is read from `chainStateBaseUrl` when
 * the chain state and finalized files live in separate buckets/domains, and reused for
 * `CURRENT_BLOCK_CACHE_TTL_MS` so a burst of concurrent `currentBlock()` callers share one
 * fetch instead of each issuing their own. `blocksByStep` serves only completed steps — the
 * in-flight tail step has no static file and returns [].
 */
export declare class RestBlockViewer extends AbstractCreatableProvider<RestBlockViewerParams, BlockViewer['eventData']> implements BlockViewer {
    static readonly connectionTypes: readonly ["rest"];
    static readonly defaultMoniker: "BlockViewer";
    static readonly dependencies: never[];
    static readonly monikers: "BlockViewer"[];
    static readonly surface: "node";
    moniker: "BlockViewer";
    protected blockByHashCache: LruCacheMap<import("@ariestools/sdk").BrandedHash, [{
        schema: "network.xyo.boundwitness" & {
            readonly __schema: true;
        };
        addresses: (import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }))[];
        payload_hashes: import("@ariestools/sdk").BrandedHash[];
        payload_schemas: import("@xyo-network/sdk").BrandedSchema<string>[];
        previous_hashes: (import("@ariestools/sdk").BrandedHash | null)[];
        $signatures: import("@ariestools/sdk").BrandedHex[];
        block: XL1BlockNumber;
        chain: import("@ariestools/sdk").BrandedHex;
        previous: import("@ariestools/sdk").BrandedHash | null;
        $epoch: number;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
        $destination?: import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }) | undefined;
        $sourceQuery?: import("@ariestools/sdk").BrandedHash | undefined;
        protocol?: number | undefined;
        step_hashes?: import("@ariestools/sdk").BrandedHash[] | undefined;
    }, {
        [x: string]: unknown;
        schema: import("@xyo-network/sdk").BrandedSchema<string>;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
    }[]], () => void>;
    protected blockByHashInFlight: Map<import("@ariestools/sdk").BrandedHash, Promise<[{
        schema: "network.xyo.boundwitness" & {
            readonly __schema: true;
        };
        addresses: (import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }))[];
        payload_hashes: import("@ariestools/sdk").BrandedHash[];
        payload_schemas: import("@xyo-network/sdk").BrandedSchema<string>[];
        previous_hashes: (import("@ariestools/sdk").BrandedHash | null)[];
        $signatures: import("@ariestools/sdk").BrandedHex[];
        block: XL1BlockNumber;
        chain: import("@ariestools/sdk").BrandedHex;
        previous: import("@ariestools/sdk").BrandedHash | null;
        $epoch: number;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
        $destination?: import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }) | undefined;
        $sourceQuery?: import("@ariestools/sdk").BrandedHash | undefined;
        protocol?: number | undefined;
        step_hashes?: import("@ariestools/sdk").BrandedHash[] | undefined;
    }, {
        [x: string]: unknown;
        schema: import("@xyo-network/sdk").BrandedSchema<string>;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
    }[]] | null>>;
    protected blockByNumberCache: LruCacheMap<XL1BlockNumber, [{
        schema: "network.xyo.boundwitness" & {
            readonly __schema: true;
        };
        addresses: (import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }))[];
        payload_hashes: import("@ariestools/sdk").BrandedHash[];
        payload_schemas: import("@xyo-network/sdk").BrandedSchema<string>[];
        previous_hashes: (import("@ariestools/sdk").BrandedHash | null)[];
        $signatures: import("@ariestools/sdk").BrandedHex[];
        block: XL1BlockNumber;
        chain: import("@ariestools/sdk").BrandedHex;
        previous: import("@ariestools/sdk").BrandedHash | null;
        $epoch: number;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
        $destination?: import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }) | undefined;
        $sourceQuery?: import("@ariestools/sdk").BrandedHash | undefined;
        protocol?: number | undefined;
        step_hashes?: import("@ariestools/sdk").BrandedHash[] | undefined;
    }, {
        [x: string]: unknown;
        schema: import("@xyo-network/sdk").BrandedSchema<string>;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
    }[]], () => void>;
    protected blockByNumberInFlight: Map<XL1BlockNumber, Promise<[{
        schema: "network.xyo.boundwitness" & {
            readonly __schema: true;
        };
        addresses: (import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }))[];
        payload_hashes: import("@ariestools/sdk").BrandedHash[];
        payload_schemas: import("@xyo-network/sdk").BrandedSchema<string>[];
        previous_hashes: (import("@ariestools/sdk").BrandedHash | null)[];
        $signatures: import("@ariestools/sdk").BrandedHex[];
        block: XL1BlockNumber;
        chain: import("@ariestools/sdk").BrandedHex;
        previous: import("@ariestools/sdk").BrandedHash | null;
        $epoch: number;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
        $destination?: import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }) | undefined;
        $sourceQuery?: import("@ariestools/sdk").BrandedHash | undefined;
        protocol?: number | undefined;
        step_hashes?: import("@ariestools/sdk").BrandedHash[] | undefined;
    }, {
        [x: string]: unknown;
        schema: import("@xyo-network/sdk").BrandedSchema<string>;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
    }[]] | null>>;
    protected currentBlockCache: LruCacheMap<string, Promise<[{
        schema: "network.xyo.boundwitness" & {
            readonly __schema: true;
        };
        addresses: (import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }))[];
        payload_hashes: import("@ariestools/sdk").BrandedHash[];
        payload_schemas: import("@xyo-network/sdk").BrandedSchema<string>[];
        previous_hashes: (import("@ariestools/sdk").BrandedHash | null)[];
        $signatures: import("@ariestools/sdk").BrandedHex[];
        block: XL1BlockNumber;
        chain: import("@ariestools/sdk").BrandedHex;
        previous: import("@ariestools/sdk").BrandedHash | null;
        $epoch: number;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
        $destination?: import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }) | undefined;
        $sourceQuery?: import("@ariestools/sdk").BrandedHash | undefined;
        protocol?: number | undefined;
        step_hashes?: import("@ariestools/sdk").BrandedHash[] | undefined;
    }, {
        [x: string]: unknown;
        schema: import("@xyo-network/sdk").BrandedSchema<string>;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
    }[]]>, () => void>;
    protected payloadCache: LruCacheMap<import("@ariestools/sdk").BrandedHash, WithHashMeta<Payload>, () => void>;
    protected stepCache: LruCacheMap<string, [{
        schema: "network.xyo.boundwitness" & {
            readonly __schema: true;
        };
        addresses: (import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }))[];
        payload_hashes: import("@ariestools/sdk").BrandedHash[];
        payload_schemas: import("@xyo-network/sdk").BrandedSchema<string>[];
        previous_hashes: (import("@ariestools/sdk").BrandedHash | null)[];
        $signatures: import("@ariestools/sdk").BrandedHex[];
        block: XL1BlockNumber;
        chain: import("@ariestools/sdk").BrandedHex;
        previous: import("@ariestools/sdk").BrandedHash | null;
        $epoch: number;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
        $destination?: import("@xyo-network/sdk").XyoQuantAddress | (Lowercase<string> & {
            readonly __hex: true;
        } & {
            readonly __address: true;
        }) | undefined;
        $sourceQuery?: import("@ariestools/sdk").BrandedHash | undefined;
        protocol?: number | undefined;
        step_hashes?: import("@ariestools/sdk").BrandedHash[] | undefined;
    }, {
        [x: string]: unknown;
        schema: import("@xyo-network/sdk").BrandedSchema<string>;
        _hash: import("@ariestools/sdk").BrandedHash;
        _dataHash: import("@ariestools/sdk").BrandedHash;
    }[]][], () => void>;
    private _headPollHash?;
    private _headPollInProgress;
    private _headPollTimer;
    get chainStateBaseUrl(): string;
    get finalizedBaseUrl(): string;
    get indexBaseUrl(): string;
    protected get fetchFn(): typeof globalThis.fetch;
    protected get headPollIntervalMs(): number | undefined;
    static paramsHandler(params: Partial<RestBlockViewerParams>): Promise<{
        chainStateBaseUrl: string | undefined;
        fetchFn: typeof fetch | undefined;
        finalizedBaseUrl: string;
        headPollIntervalMs: number | undefined;
        indexBaseUrl: string | undefined;
        context: import('../protocol-sdk/index.js').CreatableProviderContextType;
        name?: import("@ariestools/sdk").CreatableName;
        statusReporter?: import("@ariestools/sdk").CreatableStatusReporter<void> | undefined;
        logger?: import("@ariestools/sdk").Logger;
        meterProvider?: import("@opentelemetry/api").MeterProvider;
        traceProvider?: import("@opentelemetry/api").TracerProvider;
    }>;
    blockByHash(hash: Hash): Promise<SignedHydratedBlockWithHashMeta | null>;
    blockByNumber(blockNumber: XL1BlockNumber): Promise<SignedHydratedBlockWithHashMeta | null>;
    blocksByHash(hash: Hash, limit?: number): Promise<SignedHydratedBlockWithHashMeta[]>;
    blocksByNumber(blockNumber: XL1BlockNumber, limit?: number): Promise<SignedHydratedBlockWithHashMeta[]>;
    blocksByStep(stepLevel: number, stepIndex: number): Promise<SignedHydratedBlockWithHashMeta[]>;
    chainId(): Promise<ChainId>;
    chainId(blockNumber: XL1BlockNumber): Promise<ChainId>;
    chainId(blockNumber: 'latest'): Promise<ChainId>;
    currentBlock(): Promise<SignedHydratedBlockWithHashMeta>;
    currentBlockHash(): Promise<Hash>;
    currentBlockNumber(): Promise<XL1BlockNumber>;
    payloadByHash(hash: Hash): Promise<WithHashMeta<Payload> | null>;
    payloadsByHash(hashes: Hash[]): Promise<WithHashMeta<Payload>[]>;
    rate(range: XL1BlockRange, timeUnit?: keyof TimeDurations): Promise<BlockRate>;
    stepSizeRate(start: XL1BlockNumber, stepIndex: number, count?: number, timeUnit?: keyof TimeDurations): Promise<BlockRate>;
    timeDurationRate(timeConfig: SingleTimeConfig, startBlockNumber?: XL1BlockNumber, timeUnit?: keyof TimeDurations, toleranceMs?: number, maxAttempts?: number): Promise<BlockRate>;
    protected startHandler(): Promise<void>;
    protected stopHandler(): Promise<void>;
    /** Validates a parsed block file and populates both block caches. */
    private cacheBlock;
    private fetchCurrentBlock;
    private fetchJson;
    private pollHead;
    private startHeadPolling;
    private stopHeadPolling;
}
//# sourceMappingURL=RestBlockViewer.d.ts.map