import { type Hash } from '@ariestools/sdk';
import type { ArchivistInstance } from '@xyo-network/sdk';
import type { BlockValidationViewer, ChainContractViewer, DeadLetterQueueRunner, FinalizationViewer, MempoolPruneOptions, MempoolRunner, MempoolViewer, SignedHydratedBlock, SignedHydratedTransaction, TransactionValidationViewer } from '@xyo-network/xl1-protocol/protocol-lib';
import type { ArchivistConnectionBinding } from '../../Archivists/index.js';
import type { CreatableProviderParams } from '../../CreatableProvider/index.js';
import { AbstractCreatableProvider } from '../../CreatableProvider/index.js';
/** Parameters for SimpleMempoolRunner. */
export interface SimpleMempoolRunnerParams extends CreatableProviderParams {
    /** Connection the mempool stores self-provision from when archivists are not injected. */
    connection?: ArchivistConnectionBinding;
    externalMempools?: MempoolViewer[];
    maxExpAhead?: number;
    /**
     * Maximum number of pending transactions allowed in the pool. When exceeded after
     * `submitTransactions` or `prunePendingTransactions`, the runner evicts the excess —
     * demoted transactions first (when the resolved viewer supports it), then oldest
     * by sequence. `0` (default) disables the cap.
     */
    maxPendingTransactions?: number;
    pendingBlocksArchivist?: ArchivistInstance;
    pendingTransactionsArchivist?: ArchivistInstance;
    syncInterval?: number;
    syncLimit?: number;
    /**
     * When true (default), `submitTransactions` runs full `{ value: true, state: true }`
     * validation against `transactionValidationViewer` before insert and throws on
     * any failure (insufficient balance for gas + base + transfer, signature
     * problems, etc.) — closing the admission-time gap that previously let
     * underfunded transactions sit in the pool until the prune sweep evicted
     * them. Set to false in unit tests that wire a minimally-configured
     * `TransactionValidationViewer` and want to assert other behavior (exp
     * filter, prune flow) without state-validation getting in the way.
     */
    validateOnSubmit?: boolean;
}
/** SimpleMempoolRunner implementation. */
export declare class SimpleMempoolRunner extends AbstractCreatableProvider<SimpleMempoolRunnerParams> implements MempoolRunner {
    static readonly connectionTypes: readonly ["lmdb", "mongo", "memory"];
    static readonly defaultMoniker: "MempoolRunner";
    static readonly dependencies: ("FinalizationViewer" | "ChainContractViewer" | "BlockValidationViewer" | "TransactionValidationViewer")[];
    static readonly monikers: "MempoolRunner"[];
    static readonly surface: "node";
    moniker: "MempoolRunner";
    protected _blockValidationViewer: BlockValidationViewer;
    protected _chainContractViewer: ChainContractViewer;
    protected _deadLetterQueueRunner?: DeadLetterQueueRunner;
    protected _finalizationViewer: FinalizationViewer;
    protected _mempoolViewer?: MempoolViewer;
    protected _transactionValidationViewer: TransactionValidationViewer;
    private _syncMutex;
    private _syncTimerId;
    protected get blockValidationViewer(): BlockValidationViewer;
    protected get chainContractViewer(): ChainContractViewer;
    protected get externalMempools(): MempoolViewer[];
    protected get finalizationViewer(): FinalizationViewer;
    protected get maxExpAhead(): number;
    protected get maxPendingTransactions(): number;
    protected get pendingBlocksArchivist(): ArchivistInstance;
    protected get pendingTransactionsArchivist(): ArchivistInstance;
    protected get syncInterval(): number;
    protected get syncLimit(): number;
    protected get transactionValidationViewer(): TransactionValidationViewer;
    protected get validateOnSubmit(): boolean;
    static paramsHandler(params?: Partial<SimpleMempoolRunnerParams>): Promise<SimpleMempoolRunnerParams>;
    createHandler(): Promise<void>;
    prunePendingBlocks({ batchSize, maxPrune, maxCheck, }?: MempoolPruneOptions): Promise<[number, number]>;
    prunePendingTransactions({ batchSize, maxPrune, maxCheck, }?: MempoolPruneOptions): Promise<[number, number]>;
    submitBlocks(blocks: SignedHydratedBlock[]): Promise<Hash[]>;
    submitTransactions(transactions: SignedHydratedTransaction[]): Promise<Hash[]>;
    protected startHandler(): Promise<void>;
    protected stopHandler(): Promise<void>;
    private collectAllPendingTransactionBundles;
    private enforceCap;
    private finalizePruneTransactionsResult;
    private forgetBundleHashes;
    private orderForEviction;
    private routeRejectedTransaction;
    private simpleBlockValidationCheck;
    private simpleTransactionValidationCheck;
    private syncBlocksFrom;
    private syncFromExternal;
    private syncTransactionsFrom;
}
//# sourceMappingURL=SimpleMempoolRunner.d.ts.map