import { PublicKey, type Connection } from "@solana/web3.js"; import type { TransactionProofBuilder } from "../proofs/types.js"; import { type ClientProductOpen } from "../relayer/types.js"; import { type ClientProvingDeps, type ClientProvingFailure, type ClientProvingNote, type ClientProvingOutputNote, type ClientSpendRecovery, type NoteCipherRecipient } from "./shared.js"; export interface ProductOpenWithClientProofParams { connection: Connection; product: ClientProductOpen; /** One or two USDC notes. Merge down first with `consolidateNotes`. */ notes: ClientProvingNote[]; /** USDC base units the ephemeral wallet receives. The relayer fee comes out of the notes on top. */ depositAmount: bigint; /** The ephemeral wallet the open funds; it is both ExtData recipient and claimant. */ claimant: PublicKey; /** 32 bytes (or up to 64 hex). Seeds the product slot; derive a fresh one per open. */ withdrawalId: Uint8Array | string; /** MetaDAO Launch address. Required for `metadao-commit`. */ launch?: PublicKey; userPublicKey: string; /** Who can decrypt the change note from chain data. */ changeCipherRecipient: NoteCipherRecipient; /** Owner key of the change note. Defaults to the first input note's key. */ changeOwnerPrivateKey?: bigint; /** Refuse any quote whose fee exceeds this. */ maxFee?: bigint; /** See `SwapWithClientProofParams.allowWithoutNoteCiphers`. Default false. */ allowWithoutNoteCiphers?: boolean; /** Awaited before proving; if it throws, nothing is submitted. */ persistRecovery(recovery: ClientSpendRecovery): Promise | void; prover?: TransactionProofBuilder; indexTimeoutMs?: number; } interface ProductOpenResultBase { quoteId: string; product: ClientProductOpen; fee: bigint; /** Null when the notes are spent exactly. */ changeNote: ClientProvingOutputNote | null; recovery: ClientSpendRecovery; } /** Same outcome semantics as `ClientWithdrawResult`. */ export type ClientProductOpenResult = (ProductOpenResultBase & { status: "landed"; txSignature: string; noteCiphersIncluded: boolean; }) | (ProductOpenResultBase & { status: "unconfirmed"; txSignature: string; }) | (ProductOpenResultBase & { status: "unknown"; error: ClientProvingFailure; }) | (ProductOpenResultBase & { status: "rejected"; error: ClientProvingFailure; }); /** * Fund an ephemeral wallet for a private prediction, a card or a MetaDAO commit, * with a proof generated on this device. * * The three products consume the same on-chain instruction, so the relayer pins * which one a quote is for; this checks that pin along with everything the * proof binds. Throws only while nothing has been submitted. */ export declare function productOpenWithClientProof(params: ProductOpenWithClientProofParams): Promise; /** @internal */ export declare function runProductOpenWithClientProof(params: ProductOpenWithClientProofParams, deps: ClientProvingDeps): Promise; export {};