Deposits
This guide covers depositing tokens from your wallet into your private balance.Basic Deposit
Deposit Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenAddress | String | Yes | ERC-20 token contract address |
amount | String | Yes | Amount in wei (smallest unit) |
Deposit Steps
When a deposit is submitted, the SDK executes these steps in order:| Step | Description |
|---|---|
| Wrapping | Wrapping ETH to WETH (if depositing ETH) |
| Approving | Approving token spending on the shield contract |
| Shielding | Executing the deposit transaction |
| Registering | Registering the deposit with the indexer |
| Compliance | Waiting for compliance verification |
Deposit Result
Depositing ETH
To deposit native ETH, use the zero address. The SDK automatically wraps ETH to WETH:- Wraps ETH to WETH
- Approves WETH spending
- Deposits WETH to the shield contract
Parsing Amounts
Use helper functions to convert between human-readable and wei formats:Error Handling
Best Practices
1. Validate Amounts Before Depositing
2. Refresh Balance After Deposit
3. Always Use Background Dispatcher
SDK methods are blocking calls. Always wrap them inwithContext(Dispatchers.IO) to avoid blocking the main thread: