Overview
Thedeposit operation moves tokens from a user’s AssociatedTokenAccount (ATA) into their EncryptedTokenAccount (ETA). After a successful deposit, the balance is hidden on-chain.
Transfer from ATA
Tokens are moved from the user’s
AssociatedTokenAccount into the pool custody account — an on-chain SPL or Token-2022 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 ETA.
The user must be registered before depositing. An
EncryptedUserAccount PDA must exist for the destination wallet address.Usage
Parameters
The wallet address whose ETA 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.32 bytes of caller metadata stored with the deposit. Defaults to 32 zero bytes. Must be a pre-hashed or pre-encrypted 32-byte value — never store plaintext identifiers.
Commitment level used for RPC account reads during deposit preparation.
Commitment level used for fetching epoch info (Token-2022 transfer-fee schedule).
Per-phase lifecycle hooks. Keys:
onValidationStart, onValidationComplete, onMintFetchStart, onMintFetchComplete, onAccountFetchStart, onAccountFetchComplete, onArciumSetupStart, onArciumSetupComplete, onInstructionBuildStart, onInstructionBuildComplete, queueComputation (MpcTransactionStepHooks — onPreSend, onPostSend, onMonitorStarted, onProgress, onFinalized, onRentReclaimSubmitted, onRentReclaimError), onComplete, onError. Each receives a typed event object.There are no
priorityFees, awaitCallback, skipPreflight, maxRetries, or purpose options on the depositor. Priority fees are configured at factory time via deps.microLamportsPerAcuPolicy. Callback waiting is always-on for direct deposits — the result’s callback field is populated on success.Return Value
Returns aPromise<DepositResult>. The DepositResult object contains:
signatures— every transaction signature submitted by this call, in submission order (handler, callback, rent claim).queueSignature— the handler (queue computation) transaction signature.callback— present once the callback round-trip completes (always awaited) (the default). Discriminated onstatus:"finalized"means the callback landed andsignatureis the MPC callback tx signature;"pruned"/"timed-out"indicate the callback never landed.rentClaim— present once rent reclamation has been attempted.{ claimed: true }returns the rent-reclaim signature;{ claimed: false }returns the reason. Rent reclamation is best-effort — the deposit itself still succeeded even whenclaimed: false.
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.
isUserAccountX25519KeyRegistered flag drives the selection.
Protocol Fees
Fees are deducted from thetransferAmount before crediting the ETA. With the BPS divisor of 16,384:
In most cases, direct deposits from your own ATA to your own ETA 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 ETA:Error Handling
Deposit errors include astage field identifying where the failure occurred: