import type { Hash } from '@ariestools/sdk';
import type { Payload, ReadArchivist, WithHashMeta } from '@xyo-network/sdk';
import type { BlockContextRead, BlockRate, BlocksStepSummary, BlockViewer, ChainContextRead, ChainId, FinalizationViewer, MapType, SignedHydratedBlockWithHashMeta, SignedHydratedBlockWithStorageMeta, SingleTimeConfig, TimeDurations, XL1BlockNumber, XL1BlockRange } from '@xyo-network/xl1-protocol/protocol-lib';
import { LruCacheMap } from '../../../driver-memory/index.js';
import type { ArchivistConnectionBinding } from '../../Archivists/index.js';
import type { CreatableProviderParams } from '../../CreatableProvider/index.js';
import { AbstractCreatableProvider } from '../../CreatableProvider/index.js';
import type { ChainStoreRead } from '../../model/index.js';
import { HydratedCache } from '../../utils/index.js';
/** Parameters for SimpleBlockViewer. */
export interface SimpleBlockViewerParams extends CreatableProviderParams {
    /**
     * Optional backing store for cached per-step block summaries used by `blocksByStep`. Omit to use
     * an in-memory LRU; inject a persistent (large-object capable) map for production.
     */
    blocksSummaryMap?: MapType<string, BlocksStepSummary>;
    /** Connection the chain store self-provisions from when finalizedArchivist is not injected. */
    connection?: ArchivistConnectionBinding;
    /** finalized Archivist configuration or state exposed by this contract. */
    finalizedArchivist?: ReadArchivist;
    /** head Poll Interval Ms configuration or state exposed by this contract. */
    headPollIntervalMs?: number;
}
/** SimpleBlockViewer implementation. */
export declare class SimpleBlockViewer extends AbstractCreatableProvider<SimpleBlockViewerParams, BlockViewer['eventData']> implements BlockViewer {
    /** Connection kinds supported by this provider. */
    static readonly connectionTypes: readonly ["lmdb", "mongo", "memory"];
    /** Primary moniker used to resolve this provider. */
    static readonly defaultMoniker: "BlockViewer";
    /** Provider monikers that must resolve before this provider can be created. */
    static readonly dependencies: "FinalizationViewer"[];
    /** Provider monikers implemented by this provider class. */
    static readonly monikers: "BlockViewer"[];
    /** Read, write, or mixed capability surface exposed by the provider. */
    static readonly surface: "node";
    /** Moniker implemented by this provider instance. */
    moniker: "BlockViewer";
    protected _store?: ChainStoreRead;
    protected finalizationViewer: FinalizationViewer;
    protected payloadCache: LruCacheMap<import("@ariestools/sdk").BrandedHash, WithHashMeta<Payload>, () => void>;
    protected signedHydratedBlockWithHashMetaCache: 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>;
    private _blockStepSemaphores;
    private _blocksSummaryMap?;
    private _headPollHash?;
    private _headPollInProgress;
    private _headPollTimer;
    private _signedHydratedBlockCache;
    /** Finalizes  archivist. */
    get finalizedArchivist(): ReadArchivist;
    protected get blocksSummaryMap(): MapType<string, BlocksStepSummary>;
    protected get headPollIntervalMs(): number | undefined;
    protected get hydratedBlockCache(): HydratedCache<SignedHydratedBlockWithStorageMeta>;
    protected get store(): ChainStoreRead;
    /** Returns the params handler result exposed by this provider. */
    static paramsHandler(params: Partial<SimpleBlockViewerParams>): Promise<{
        blocksSummaryMap: MapType<string, BlocksStepSummary> | undefined;
        finalizedArchivist: ReadArchivist<Payload, import("@ariestools/sdk").BrandedHash, import("@xyo-network/sdk").Sequence>;
        headPollIntervalMs: number | undefined;
        context: import('../../model/CreatableProviderContext.zod.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;
    }>;
    /** Returns the block by hash result exposed by this provider. */
    blockByHash(hash: Hash): Promise<SignedHydratedBlockWithHashMeta | null>;
    /** Returns the block by number result exposed by this provider. */
    blockByNumber(blockNumber: XL1BlockNumber): Promise<SignedHydratedBlockWithHashMeta | null>;
    /** Returns the blocks by hash result exposed by this provider. */
    blocksByHash(hash: Hash, limit?: number): Promise<SignedHydratedBlockWithHashMeta[]>;
    /**
     * Walks descending from `blockNumber` following `block - 1` until `limit`
     * blocks are collected or block 0 is reached, so the returned window is
     * `[blockNumber - limit + 1 … blockNumber]`, newest first.
     */
    blocksByNumber(blockNumber: XL1BlockNumber, limit?: number): Promise<SignedHydratedBlockWithHashMeta[]>;
    /** Returns the blocks by step result exposed by this provider. */
    blocksByStep(stepLevel: number, stepIndex: number): Promise<SignedHydratedBlockWithHashMeta[]>;
    /** Returns the chain id result exposed by this provider. */
    chainId(): Promise<ChainId>;
    /** Returns the chain id result exposed by this provider. */
    chainId(blockNumber: XL1BlockNumber): Promise<ChainId>;
    /** Returns the chain id result exposed by this provider. */
    chainId(blockNumber: 'latest'): Promise<ChainId>;
    /** Creates the provider instance after its dependencies and configuration have resolved. */
    createHandler(): Promise<void>;
    /** Returns block. */
    currentBlock(): Promise<SignedHydratedBlockWithHashMeta>;
    /** Returns block hash. */
    currentBlockHash(): Promise<Hash>;
    /** Returns block number. */
    currentBlockNumber(): Promise<XL1BlockNumber>;
    /** Returns the payload by hash result exposed by this provider. */
    payloadByHash(hash: Hash): Promise<WithHashMeta<Payload> | null>;
    /** Returns the payloads by hash result exposed by this provider. */
    payloadsByHash(hashes: Hash[]): Promise<WithHashMeta<Payload>[]>;
    /** Returns the rate result exposed by this provider. */
    rate(range: XL1BlockRange, timeUnit?: keyof TimeDurations): Promise<BlockRate>;
    /** Returns the step size rate result exposed by this provider. */
    stepSizeRate(start: XL1BlockNumber, stepIndex: number, count?: number, timeUnit?: keyof TimeDurations): Promise<BlockRate>;
    /** Returns the time duration rate result exposed by this provider. */
    timeDurationRate(timeConfig: SingleTimeConfig, startBlockNumber?: XL1BlockNumber, timeUnit?: keyof TimeDurations, toleranceMs?: number, maxAttempts?: number): Promise<BlockRate>;
    protected getBlockContextRead(): BlockContextRead;
    protected getChainContextRead(): Promise<ChainContextRead>;
    protected startHandler(): Promise<void>;
    protected stopHandler(): Promise<void>;
    private blockByNumberWithContext;
    private pollHead;
    private startHeadPolling;
    private stopHeadPolling;
}
//# sourceMappingURL=SimpleBlockViewer.d.ts.map