import type { NoteCipherVersion } from "./migrationTelemetry.js"; /** Minimal local record needed to plan a v1 -> v2 self-transfer. */ export interface LegacySweepCandidate { commitment: string; amount: bigint; mint: string; treeId: number; cipherVersion: NoteCipherVersion; spent?: boolean; } export interface LegacySweepBatch { inputCommitments: string[]; outputAmount: bigint; mint: string; treeId: number; outputCipherVersion: "view-v2"; } export interface PendingLegacySweep { operationId: string; inputCommitments: string[]; outputAmount: string; mint: string; treeId: number; outputCipherVersion: "view-v2"; txSignature?: string; } /** JSON-safe state. Persist it before signing and after every transition. */ export interface LegacySweepState { schemaVersion: 1; completedCommitments: string[]; pending: PendingLegacySweep | null; } export declare function createLegacySweepState(): LegacySweepState; /** * Select at most two compatible legacy inputs, deterministically. * * The function never signs, submits, or mutates state. v2 and spent notes are * ignored. A pending operation blocks new work until it is reconciled. */ export declare function planNextLegacySweep(candidates: LegacySweepCandidate[], state: LegacySweepState): LegacySweepBatch | null; /** Persist this transition before asking a wallet to sign. */ export declare function beginLegacySweep(state: LegacySweepState, batch: LegacySweepBatch, operationId: string): LegacySweepState; /** Persist the signature immediately after submission, before confirmation. */ export declare function markLegacySweepSubmitted(state: LegacySweepState, operationId: string, txSignature: string): LegacySweepState; /** Call only after the submitted transaction is finalized on chain. */ export declare function confirmLegacySweep(state: LegacySweepState, operationId: string): LegacySweepState; /** * Clear a prepared operation that was never submitted. Submitted operations * must first be reconciled with chain state to prevent an accidental double * spend/retry race. */ export declare function abandonUnsubmittedLegacySweep(state: LegacySweepState, operationId: string): LegacySweepState;