Skip to main content

Deposits

This guide covers depositing tokens into the privacy pool using the Privacy Boost React SDK.

Basic Deposit

Deposit Parameters

This differs from the TypeScript SDK, which only accepts bigint (wei), and from the mobile SDKs, which accept a wei-as-string. The React useVault hook normalizes for you: a human-readable string is parsed with the token’s decimals before being passed to the underlying SDK.

Progress Tracking

Track shield steps with the onProgress callback:

Deposit Steps

The step value comes from the ShieldStep enum and matches the same values across all SDK platforms.

Depositing ETH

Native ETH is automatically wrapped to WETH during shield:

Complete Example

Error Handling

Best Practices

1. Refresh Balances After Deposit

useBalances() is reactive and will pick up updates the SDK already knows about. Call refreshBalances() (from useVault) to force a server fetch — for example, immediately after a shield, when you want the UI to reflect the new shielded balance without waiting for the next polling tick.

2. Handle Wallet Rejection Silently

When users cancel the wallet popup, don’t show an error:

3. Show Progress to Users

Deposits involve multiple on-chain steps. Always show progress so users know the operation is working.

Next Steps