Overview
Thewithdraw operation is the reverse of a deposit. It moves tokens from a user’s encrypted balance back to their public Associated Token Account (ATA).
Usage
Parameters
The Solana address to receive the withdrawn tokens. This is typically
client.signer.address.The SPL or Token-2022 mint address. Must match a mint for which the user has an existing encrypted balance.
The amount to withdraw, in the token’s native units. Must not exceed the current encrypted balance.
Additional compute unit price in microlamports. Recommended during high network load.
32 bytes of arbitrary metadata stored with the withdrawal. Defaults to all zeros.
Whether to wait for the Arcium MPC callback transaction to confirm before resolving. When
true, the returned WithdrawResult includes callbackSignature and callbackElapsedMs. When false, returns immediately after the handler (queue) transaction confirms.Skip Solana transaction preflight simulation.
Maximum number of times the RPC node should retry sending the transaction.
Commitment level used for RPC account reads during withdrawal preparation. Overrides the default on a per-call basis.
Commitment level used for fetching epoch info (Token-2022 transfer fee schedule). Overrides the default on a per-call basis.
Return Value
Returns aPromise<WithdrawResult>. The WithdrawResult object contains:
queueSignature- The transaction signature of the handler (queue computation) transaction.callbackStatus- The outcome of computation monitoring:"finalized","pruned", or"timed-out". Present whenawaitCallbackistrue(the default).callbackSignature- The transaction signature of the Arcium MPC callback transaction. Present whencallbackStatusis"finalized".callbackElapsedMs- Wall-clock milliseconds spent waiting for the callback. Present whenawaitCallbackistrue.rentClaimSignature- Transaction signature for reclaiming rent from the computation account. Attempted regardless of callback outcome.rentClaimError- Error encountered during rent reclaim, if any. The withdrawal itself still succeeded.
Example
Withdrawal Destination
The tokens are sent to the ATA associated with thedestinationAddress for the given mint. If that ATA does not exist, the transaction will fail with an account-not-found error. Create the ATA first using standard token tooling if needed.
Error Handling
Withdrawal errors are typed with astage field identifying exactly where in the pipeline the failure occurred: