Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sdk.umbraprivacy.com/llms.txt

Use this file to discover all available pages before exploring further.

getEncryptedBalanceToPublicBalanceDirectWithdrawerFunction

Import: @umbra-privacy/sdk
function getEncryptedBalanceToPublicBalanceDirectWithdrawerFunction(
  args: GetEncryptedBalanceToPublicBalanceDirectWithdrawerFunctionArgs,
  deps?: GetEncryptedBalanceToPublicBalanceDirectWithdrawerFunctionDeps,
): EncryptedBalanceToPublicBalanceDirectWithdrawerFunction
Withdraws tokens from the caller’s encrypted balance to a public associated token account (ATA). This is the primary withdrawal path - no ZK proof required. The withdrawal queues an Arcium MPC computation; the Arcium network processes it and calls back on-chain to execute the transfer. Follows the dual-instruction pattern.

GetEncryptedBalanceToPublicBalanceDirectWithdrawerFunctionArgs

  • client: IUmbraClient

GetEncryptedBalanceToPublicBalanceDirectWithdrawerFunctionDeps

All fields are optional.
  • accountInfoProvider?: AccountInfoProviderFunction
  • getLatestBlockhash?: GetLatestBlockhash
  • transactionForwarder?: TransactionForwarder

Returns

EncryptedBalanceToPublicBalanceDirectWithdrawerFunction
type EncryptedBalanceToPublicBalanceDirectWithdrawerFunction = (
  destinationAddress: Address,
  mint: Address,
  withdrawalAmount: U64,
  options?: WithdrawOptions,
) => Promise<WithdrawResult>
  • destinationAddress: Address - The public ATA recipient. Must be an initialised token account for mint.
  • mint: Address - Token mint address.
  • withdrawalAmount: U64 - Amount in base token units to withdraw from the encrypted balance.

WithdrawOptions

  • priorityFees?: U64 - Compute unit price in micro-lamports. Default: 0n.
  • purpose?: number - Caller-defined purpose tag stored on-chain. Default: 0.
  • optionalData?: OptionalData32 - 32-byte caller metadata. Default: 32 zero bytes.
  • awaitCallback?: boolean - Whether to wait for the MPC callback. Default: true.
  • skipPreflight?: boolean - Skip Solana preflight simulation. Default: false.
  • maxRetries?: number - Max RPC retry attempts for transaction sending.
  • accountInfoCommitment?: Commitment - Per-call commitment for RPC account reads. Default: "confirmed".
  • epochInfoCommitment?: Commitment - Per-call commitment for epoch info fetches. Default: "confirmed".

WithdrawResult

interface WithdrawResult {
  queueSignature: TransactionSignature;
  callbackStatus?: "finalized" | "pruned" | "timed-out";
  callbackSignature?: TransactionSignature;
  callbackElapsedMs?: number;
  rentClaimSignature?: TransactionSignature;
  rentClaimError?: string;
}
  • queueSignature - Signature of the handler (queue computation) transaction.
  • callbackStatus - The outcome of computation monitoring: "finalized", "pruned", or "timed-out". Present when awaitCallback is true.
  • callbackSignature - Signature of the Arcium MPC callback. Present when callbackStatus is "finalized".
  • callbackElapsedMs - Milliseconds spent waiting for the callback.
  • rentClaimSignature - Signature for reclaiming rent from the computation account. Attempted regardless of callback outcome.
  • rentClaimError - Error from rent reclaim attempt, if any. The withdrawal itself still succeeded.

Errors

Throws EncryptedWithdrawalError. See Errors.

Example

import { getEncryptedBalanceToPublicBalanceDirectWithdrawerFunction } from "@umbra-privacy/sdk";

const withdraw = getEncryptedBalanceToPublicBalanceDirectWithdrawerFunction({ client });

const result = await withdraw(
  destinationAta,  // public ATA to receive tokens
  mintAddress,
  500_000n,        // amount in base units
);
console.log("Queue signature:", result.queueSignature);

EncryptedWithdrawalError

Thrown by getEncryptedBalanceToPublicBalanceDirectWithdrawerFunction. Stage values: "initialization" | "validation" | "mint-fetch" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-send" See Errors for full documentation.