import { Slot, UnixTimestamp } from '@solana/kit'; /** A coherent ledger snapshot: block time and slot fetched at the same commitment. */ export type LedgerInstant = { slot: Slot; blockTime: UnixTimestamp; }; /** * Public input shape for APIs that accept either the legacy slot or a pre-fetched coherent ledger instant. * Both forms may be supplied together; runtime validation then requires their slots to match. */ export type LedgerInstantInput = ({ [K in SlotKey]: Slot; } & { currentLedgerInstant?: LedgerInstant; }) | ({ [K in SlotKey]?: Slot; } & { currentLedgerInstant: LedgerInstant; }); /** * Adds an instant-only call form without changing a released, extensible legacy interface whose slot is required. */ export type LedgerInstantCompatible = T | (Omit & { currentSlot?: Slot; currentLedgerInstant: LedgerInstant; }); /** `Omit` distributed across a union, preserving the required-one-of branches in {@link LedgerInstantInput}. */ export type DistributiveOmit = T extends unknown ? Omit : never; export type ResolvedLedgerInput = { currentSlot: Slot; currentLedgerInstant?: LedgerInstant; }; /** * Normalizes a public slot/instant input without adding an RPC dependency to legacy variable-rate flows. * Fixed-term callers set `requiresLedgerInstant`; only those paths resolve block time for a legacy slot. */ export declare function resolveLedgerInput(rpc: unknown, currentSlot: Slot | undefined, currentLedgerInstant: LedgerInstant | undefined, requiresLedgerInstant: boolean, caller: string): Promise; /** * Resolves the block time for an already-selected slot. This keeps legacy `currentSlot` callers source-compatible * while production builders use one coherent {@link LedgerInstant} internally. * * Callers that already fetched a ledger instant should pass it as `currentLedgerInstant`; when both values are * supplied, their slots must match. */ export declare function resolveLedgerInstantForSlot(rpc: unknown, currentSlot: Slot | undefined, currentLedgerInstant: LedgerInstant | undefined, caller: string): Promise; /** * Returns a supplied ledger instant after checking it matches the legacy slot. Fixed-term synchronous calculation * paths cannot fetch block time themselves, so they fail closed when only a slot is supplied. */ export declare function requireMatchingLedgerInstant(currentSlot: Slot | undefined, currentLedgerInstant: LedgerInstant | undefined, caller: string): LedgerInstant; /** Normalizes the old positional `Slot` argument and the new `LedgerInstant` form used by synchronous calculations. */ export declare function normalizeLedgerInstantArgument(currentSlotOrLedgerInstant: Slot | LedgerInstant, currentLedgerInstant: LedgerInstant | undefined, caller: string): { currentSlot: Slot; currentLedgerInstant?: LedgerInstant; }; //# sourceMappingURL=ledger.d.ts.map