> ## Documentation Index
> Fetch the complete documentation index at: https://docs.privacyboost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deposits

# Deposits

This guide covers depositing tokens from your wallet into your private balance using the Privacy Boost CLI.

## CLI Command

```bash theme={null}
privacy-boost shield \
  --token 0x4200000000000000000000000000000000000006 \
  --amount 1.0 \
  --human
```

Output:

```
Deposit submitted!
Transaction: 0x1234...5678
Commitment: 0xabcd...ef01
Waiting for confirmation...
Deposit confirmed in block 12345678
```

## Command Parameters

| Flag       | Required | Description                                       |
| ---------- | -------- | ------------------------------------------------- |
| `--token`  | Yes      | ERC-20 token contract address                     |
| `--amount` | Yes      | Amount to deposit                                 |
| `--human`  | No       | Interpret amount as human-readable (default: wei) |

## Deposit Steps

When a deposit is submitted, the SDK executes these steps:

| 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             |

## Programmatic Usage (Rust)

```rust theme={null}
use privacy_boost_cli::PrivacyBoostCLI;

let result = sdk.shield(
    "0x4200000000000000000000000000000000000006",
    "1000000000000000000", // 1 token in wei
)?;
println!("Deposit TX: {}", result.tx_hash);
println!("Commitment: {}", result.commitment);
```

### ShieldResult

```rust theme={null}
pub struct ShieldResult {
    pub tx_hash: String,
    pub commitment: String,
}
```

## Depositing ETH

To deposit native ETH, use the zero address:

```bash theme={null}
privacy-boost shield \
  --token 0x0000000000000000000000000000000000000000 \
  --amount 1.0 \
  --human
```

The SDK automatically wraps ETH to WETH before depositing.

## Working with Amounts

```bash theme={null}
# Human-readable (with --human flag)
privacy-boost shield --token $TOKEN --amount 1.5 --human

# Wei (default)
privacy-boost shield --token $TOKEN --amount 1500000000000000000
```

Programmatic conversion:

```rust theme={null}
let wei = sdk.parse_amount("1.5", 18)?;   // "1500000000000000000"
let eth = sdk.format_amount(&wei, 18)?;    // "1.5"
```

## Error Handling

```rust theme={null}
match sdk.shield(token_address, amount) {
    Ok(result) => println!("Deposit TX: {}", result.tx_hash),
    Err(CliError::InsufficientBalance) => println!("Not enough tokens in wallet"),
    Err(CliError::InvalidAmount) => println!("Invalid amount format"),
    Err(CliError::NotAuthenticated) => println!("Please login first"),
    Err(CliError::NetworkError { message }) => println!("Network error: {}", message),
    Err(e) => println!("Deposit failed: {:?}", e),
}
```

## Best Practices

### 1. Use `--human` for Interactive Use

The `--human` flag makes amounts more readable and less error-prone.

### 2. Check Balance After Deposit

```bash theme={null}
privacy-boost shield --token $TOKEN --amount 1.0 --human
privacy-boost balance --token $TOKEN
```

## Next Steps

* [Withdrawals Guide](./withdrawals)
* [Transfers Guide](./transfers)
* [Balances Guide](./balances)
* [Error Handling](./error-handling)
