import { Keypair, PublicKey, VersionedTransaction } from "@solana/web3.js"; import type { CloakOrderStatus, CloakOrderTransaction, CloakPartnerStatus, CloakTxVersion } from "./types.js"; /** True for a terminal public status or a status response carrying one. */ export declare function isFinalCloakStatus(value: CloakPartnerStatus | Pick): boolean; /** * An unsigned Cloak deposit: the API's base64 string, its decoded bytes, or the * order / refresh response carrying it. When the object form includes * `transactionVersion`, it must agree with the bytes. */ export type CloakTransactionInput = string | Uint8Array | (Pick & Partial>); /** * A decoded unsigned Cloak deposit. * * - `version: 0` also carries a web3.js `VersionedTransaction`, for wallet * layers that sign web3.js objects. * - `version: 1` carries bytes only. web3.js 1.x cannot sign or serialize a v1 * transaction (1.99 decodes it but throws on `serialize()`; 1.98 and earlier * cannot decode it), so sign the raw bytes: `signCloakTransaction` with a * `Keypair`, a Wallet Standard `solana:signTransaction` call with * `transaction: bytes`, or `getCloakTransactionMessage` + * `addCloakTransactionSignature` for a detached signer (KMS/HSM). */ export type CloakUnsignedTransaction = { version: 0; bytes: Uint8Array; transaction: VersionedTransaction; } | { version: 1; bytes: Uint8Array; }; /** Decode the API's base64 transaction to wire bytes, whatever its version. */ export declare function decodeCloakTransaction(value: CloakTransactionInput): Uint8Array; /** * Version of a Cloak deposit, read from the bytes (a v1 transaction starts with * 0x81). Authoritative even when a response omits `transactionVersion`. */ export declare function getCloakTransactionVersion(value: CloakTransactionInput): CloakTxVersion; /** Decode a Cloak deposit of either version. See `CloakUnsignedTransaction`. */ export declare function parseCloakTransaction(value: CloakTransactionInput): CloakUnsignedTransaction; /** * Deserialize a **v0** Cloak deposit into a web3.js `VersionedTransaction`. * * Throws for a v1 transaction instead of returning an object web3.js cannot * sign or serialize. Use `parseCloakTransaction` to handle both versions, or * request `txVersion: 0` if your wallet layer only signs web3.js objects. */ export declare function deserializeCloakTransaction(value: CloakTransactionInput): VersionedTransaction; /** * Sign a Cloak deposit with a local keypair (the sender). Works for v0 and v1 * and returns signed wire bytes; send them with `encodeCloakTransaction` and a * base64 `sendTransaction`. The input is not modified. */ export declare function signCloakTransaction(value: CloakTransactionInput, signer: Keypair): Uint8Array; /** The exact message bytes the sender's Ed25519 signature covers, for either version. */ export declare function getCloakTransactionMessage(value: CloakTransactionInput): Uint8Array; /** * Insert a detached signature (e.g. from a KMS) into a Cloak deposit. The * signature is verified against the message first, so a wrong key or message * fails here rather than at the RPC. Returns new wire bytes. */ export declare function addCloakTransactionSignature(value: CloakTransactionInput, publicKey: PublicKey, signature: Uint8Array): Uint8Array; /** Base64 for a JSON-RPC `sendTransaction` with `{ encoding: "base64" }`. */ export declare function encodeCloakTransaction(bytes: Uint8Array): string;