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;
    /** Additional mempool viewers consulted when synchronizing pending transactions. */
    externalMempools?: MempoolViewer[];
    /** Maximum number of blocks beyond the current head accepted for transaction expiration. */
    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;
    /** Optional injected store for pending blocks. */
    pendingBlocksArchivist?: ArchivistInstance;
    /** Optional injected store for pending transactions. */
    pendingTransactionsArchivist?: ArchivistInstance;
    /** Interval between synchronization passes, in milliseconds. */
    syncInterval?: number;
    /** Maximum number of remote transactions imported by one synchronization pass. */
    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 {
    /** Connection kinds supported by this provider. */
    static readonly connectionTypes: readonly ["lmdb", "mongo", "memory"];
    /** Primary moniker used to resolve this provider. */
    static readonly defaultMoniker: "MempoolRunner";
    /** Provider monikers that must resolve before this provider can be created. */
    static readonly dependencies: ("FinalizationViewer" | "ChainContractViewer" | "BlockValidationViewer" | "TransactionValidationViewer")[];
    /** Provider monikers implemented by this provider class. */
    static readonly monikers: "MempoolRunner"[];
    /** Read, write, or mixed capability surface exposed by the provider. */
    static readonly surface: "node";
    /** Moniker implemented by this provider instance. */
    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;
    /** Returns the params handler result exposed by this provider. */
    static paramsHandler(params?: Partial<SimpleMempoolRunnerParams>): Promise<SimpleMempoolRunnerParams>;
    /** Creates the provider instance after its dependencies and configuration have resolved. */
    createHandler(): Promise<void>;
    /** Removes pending blocks that are finalized, expired, or otherwise no longer eligible. */
    prunePendingBlocks({ batchSize, maxPrune, maxCheck, }?: MempoolPruneOptions): Promise<[number, number]>;
    /** Removes pending transactions that are finalized, expired, or otherwise no longer eligible. */
    prunePendingTransactions({ batchSize, maxPrune, maxCheck, }?: MempoolPruneOptions): Promise<[number, number]>;
    /** Submits blocks to the backing provider. */
    submitBlocks(blocks: SignedHydratedBlock[]): Promise<Hash[]>;
    /** Submits transactions to the backing provider. */
    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