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

# Deposit into a private balance

> Shield SOL, USDC, USDT or BRS from a wallet into the user's private balance

A deposit (a **shield**) moves tokens from a public wallet into the user's private balance. It is the
one flow the user's wallet signs and pays for, because the funding wallet is public on the way in
anyway.

## Prerequisites

* An opened `createCloak` object. See [Quickstart](https://docs.cloak.ag/get-started/quickstart.md).
* The token in the wallet, plus a little SOL for the network fee.
* At least the pool minimum: 0.01 SOL, or 1 USDC or USDT.

## Shield from a Solana wallet

```ts theme={null}
import { isCloakCallError } from "@cloak.dev/sdk";

try {
  const receipt = await cloak.shield({
    from: "solana", // the Solana wallet passed to createCloak
    token: "USDC",
    amount: "25",
    ref: "deposit-2026-11-30-001", // optional: the same ref never shields twice
    onProgress: (step) => console.log(step),
  });
  console.log(receipt);
} catch (e) {
  if (isCloakCallError(e, "shield.rejected")) console.log("Declined in the wallet. Nothing moved.");
  else throw e;
}
```

Expected output:

```text theme={null}
{
  status: "shielded",
  token: "USDC",
  amount: "25",
  fee: "0",
  txs: { solana: "5Kq…" },
  notes: { spent: 0, created: 1 }
}
```

The wallet signs one transaction. Shields carry no protocol fee; the wallet pays the Solana network
fee. The new note is recoverable from the chain with the account's viewing key, so it survives a lost
device.

## What `onProgress` reports

A shield from Solana reports steps such as `Validating transaction parameters...`,
`Generating ZK proof...`, `Waiting for wallet signature...`, `Sending transaction...` and
`Confirming transaction...`. The first shield of a page load also reports
`Downloading circuit files (n of m MB)...`. Treat the text as display only; it is not an API.
See [Events and callbacks](https://docs.cloak.ag/reference/events-and-callbacks.md).

## Shield from another chain

Pass an EVM or Sui wallet to `createCloak`, then name the chain:

```ts theme={null}
await cloak.shield({ from: "base", token: "USDC", amount: "10" }); // or "polygon", "sui"
```

The origin wallet sends one transfer and pays that chain's gas. See [Cross-chain](https://docs.cloak.ag/guides/cross-chain.md).

## Quote first

```ts theme={null}
const q = await cloak.quote({ from: "solana", token: "SOL", amount: "0.5" });
console.log(q.arrives.atLeast, q.fee); // "0.5", "0"
```

## Common errors

| Code | Cause | Fix |
| - | - | - |
| `shield.rejected` | The user declined in the wallet | Nothing moved; let them retry |
| `shield.failed` | The transaction did not complete (insufficient funds, below the minimum, network) | Read `e.message`; the call is retryable |
| `amount.too_precise` | More decimals than the token has | Round to the token's decimals |
| `wallet.none_for_chain` | No connected wallet on that chain | Pass one to `createCloak` or `cloak.connect(wallet)` |

## With the low-level API

A deposit is `transact` with a zero input note and a positive `externalAmount`. Build the output with
`createRecoverableDepositUtxo` and pass its salt as `chainNoteSalt`. The full example is in
[Low-level API](https://docs.cloak.ag/sdk/low-level-api.md#deposit-example-transact).

## Related

* [Balances](https://docs.cloak.ag/guides/balances.md)
* [Private transfers](https://docs.cloak.ag/guides/private-transfers.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.