import { PublicKey } from "@solana/web3.js"; import type { NoteCiphers } from "../compactNote.js"; import { type InputUTXO } from "../notes/model.js"; import type { QuotedInput, SubmissionOutputNote, SubmitSpendRequest } from "../relayer/types.js"; import { type ClientProvingDeps, type ClientProvingFailure, type NoteCipherRecipient, type ResolvedNote } from "./shared.js"; /** * Turn a quote's inputs into the circuit's two inputs. * * Every quoted input must be one of the requested notes, exactly once, with a * path that proves it. A single note is padded with the circuit's disabled * zero-value input, whose path is unconstrained. */ export declare function buildQuotedInputs(quoted: QuotedInput[] | undefined, notes: ResolvedNote[], rootHex: string, mintAddress: PublicKey): [InputUTXO, InputUTXO]; export declare function cipherFor(recipient: NoteCipherRecipient, blinding: bigint, amount: bigint): { blinding: Uint8Array; amount: bigint; recipientViewPublicKey?: Uint8Array | undefined; } | { blinding: Uint8Array; amount: bigint; recipientWalletPubkey?: Uint8Array | undefined; }; export declare function toSubmissionCiphers(ciphers: NoteCiphers | null): SubmitSpendRequest["noteCiphers"]; export type SettledSubmission = { kind: "landed"; txSignature: string; data: T; } | { kind: "unconfirmed"; txSignature: string; } | { kind: "unknown" | "rejected"; failure: ClientProvingFailure; }; /** * Send a single-spend submission and say what happened to the money. * * Never throws: from here on a spend may have landed, so every outcome is a * value. Withdraw and transfer submits share the relayer path whose 500s all * precede landing, so a relayer-written 500 counts as definitive. */ export declare function settleSubmission(send: () => Promise<{ data?: T; } | undefined>): Promise>; /** An output note, as needed to encrypt it for the relayer to save. */ export interface OutputNoteData { commitment: string; blinding: bigint; amount: bigint; mintAddress: PublicKey; } /** * The account's own wallet, when its identifier is a Solana address. The * relayer saves the caller's output notes for this wallet, as the * relayer-proved routes do; an account that is not an address gets none saved. */ export declare function accountWallet(userPublicKey: string): PublicKey | null; /** * Encrypt an output note for its owner's wallet in the Blind Mailbox format the * relayer stores and the wallets' note sync decrypts. Built before sending, the * leaf index is not known yet and is 0; `finalizeOutputNotes` re-saves it. */ export declare function outputNoteFor(ownerWallet: PublicKey, note: OutputNoteData, leafIndex?: number): SubmissionOutputNote; /** * After a spend lands, replace the blobs saved before sending with ones that * carry the real leaf index. Best-effort by design: the spend already landed and * the note row's own leaf index comes from the chain, so a failure here only * leaves the placeholder inside the blob. */ export declare function finalizeOutputNotes(deps: ClientProvingDeps, quoteId: string, userPublicKey: string, notes: Array<{ owner: PublicKey; note: OutputNoteData; leafIndex: number | undefined; }>): Promise;