Deposits
This guide covers depositing tokens from your wallet into your private balance.Basic Deposit
Deposit Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenAddress | Hex | Yes | ERC-20 token contract address |
amount | bigint | Yes | Amount in smallest unit (wei) |
recipientMpk | bigint | No | Deposit to another user’s MPK |
onProgress | function | No | Progress callback function |
Progress Tracking
Track shield progress with a callback:Deposit Steps
| Step | Description |
|---|---|
wrapping | Wrapping ETH to WETH (if depositing ETH) |
approving | Approving token spending |
shielding | Executing the deposit transaction |
compliance | Waiting for compliance verification |
Deposit Result
Depositing ETH
To deposit native ETH, use the zero address:- Wraps ETH to WETH
- Approves WETH spending
- Deposits WETH to shield
Deposit to Another User
You can deposit directly to another user’s private balance:Token Approval
The SDK handles token approval automatically. For large amounts, you may want to approve unlimited spending:Parsing Amounts
Use the standaloneparseAmount / formatAmount helpers exported from the SDK package:
Error Handling
UI Example
Best Practices
1. Always Validate Amounts
2. Check Token Support
3. Handle Large Deposits
For large deposits, consider splitting into multiple transactions:Relayed Deposits (build calldata, relay yourself)
If your users don’t submit transactions directly — they hold funds at addresses you relay for (a gasless relayer, an EIP-7702 session key, a custom pipeline) — build the deposit calldata without submitting it, relay it through your own infrastructure, then finalize from the mined receipt.{ to, value, data }, so the array drops directly into an
EIP-5792 / Porto wallet_prepareCalls bundle.
Server-side (no session)
A backend that holds only a recipient’s privacy address can build a deposit on their behalf with the statelessbuildShieldPayload — no signed-in session and
no private keys: