Overview
Thedeposit operation moves tokens from a user’s public Associated Token Account (ATA) into their encrypted balance. After a successful deposit, the balance is hidden on-chain.
Transfer from Public ATA
Tokens are moved from the user’s Associated Token Account (ATA) into the Shielded Pool - an on-chain SPL or Token-2022 custody account controlled by the Umbra program.
Fee Deduction
Protocol fees and any Token-2022 transfer fees are subtracted from the incoming amount. The net amount is what gets credited to the encrypted balance.
The user must be registered before depositing. An
EncryptedUserAccount PDA must exist for their wallet address.Usage
Parameters
The wallet address whose encrypted balance is credited. This is usually
client.signer.address (depositing to yourself), but you can deposit into any registered user’s account - the funds will be encrypted under their X25519 key.The SPL token mint address. Works with any standard SPL token and Token-2022 mints (see Token-2022 Support for transfer fee handling).
The gross amount to transfer, in the token’s native units (accounting for decimals). For example,
1_000_000n for 1 USDC (6 decimals). Protocol fees and Token-2022 transfer fees are subtracted from this amount before the encrypted balance is credited.Additional compute unit price in microlamports. Increase this if transactions are timing out during periods of high network congestion.
A purpose flag stored alongside the deposit. Reserved for protocol use; leave at
0 unless instructed otherwise.32 bytes of arbitrary metadata stored with the deposit. Defaults to all zeros.
Whether to wait for the Arcium MPC callback transaction to confirm before resolving. When
true, the returned DepositResult includes callbackSignature and callbackElapsedMs. When false, returns immediately after the handler (queue) transaction confirms.Skip Solana transaction preflight simulation. Useful when preflight nodes are behind.
Maximum number of times the RPC node should retry sending the transaction.
Commitment level used for RPC account reads during deposit 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<DepositResult>. The DepositResult 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 deposit itself still succeeded.
Encryption Mode Selection
The SDK automatically selects the correct instruction variant based on the state of the destination user’s account:- New MXE-only balance - destination has no X25519 key registered; first deposit
- Existing MXE-only balance - destination has no X25519 key; balance already exists
- New Shared balance - destination has X25519 key registered; first deposit
- Existing Shared balance - destination has X25519 key; balance already exists
Protocol Fees
Fees are deducted from thetransferAmount before crediting the encrypted balance. The amount credited is:
In most cases, direct deposits from your own ATA to your own encrypted balance carry zero protocol fees - the
baseFee and commissionBps are both set to 0 for standard self-shielding. Fees may apply for deposits routed through relayers or for specific pool configurations.Example: Self-Deposit
Example: Deposit to Another User
You can shield tokens directly into another registered user’s encrypted balance:Error Handling
Deposit errors include astage field identifying where the failure occurred: