Deposit and withdraw cash
Move USDC into ledger cash and back out, one to one.
A deposit turns USDC in your wallet into free ledger cash, 1:1, and a withdrawal turns it back. You need ledger cash to post a bid, take an ask, lend in a repo or pay income.
Before you start
- You are admitted.
- To deposit: USDC in your wallet's associated token account for the cash mint. On Mainnet, Get test USD sends test USD and SOL to your wallet.
- To withdraw: the amount free in your ledger cash, and that token account. Cash locked in offers can't be withdrawn until you cancel them.
In the app
Open Ledger cash
On your account page at /app, the Ledger cash panel switches between Deposit and Withdraw. On Mainnet, the Get test USD button at the top of the page sends test USD and SOL to your wallet.
Enter the amount
In USD, up to 6 decimals. A withdrawal shows how much is free. Press Review deposit or Review withdrawal to see what moves.
Sign and send
The panel steps through Building, Wallet, Sending and Settled, then shows the signature with See it on the ledger. The header's ledger cash balance changes to match.
Through the API
await api.faucet({ wallet }) // test USD and SOL, on localnet only
await send(await api.buildDeposit({ wallet, amount: '250000000' }), sign) // 250.00 USD in
await send(await api.buildWithdraw({ wallet, amount: '50000000' }), sign) // 50.00 USD outcurl -X POST "$AGORA_API/v1/build/deposit" -H 'content-type: application/json' \
-d '{"wallet":"<wallet>","amount":"250000000"}'
curl -X POST "$AGORA_API/v1/build/withdraw" -H 'content-type: application/json' \
-d '{"wallet":"<wallet>","amount":"50000000"}'Amounts are cash atoms: 6 decimals, so 250000000 is 250.00 USD. GET /v1/config says whether the faucet is there (faucetAvailable).
What it ends in
| Deposit | Withdraw | |
|---|---|---|
| Your wallet's USDC account | − amount | + amount |
| The vault | + amount | − amount |
| Your ledger cash, free | + amount | − amount |
The settlement is the kind deposit or withdraw. A first deposit also creates your cash position, which your wallet pays rent for.
If it fails
NotAdmitted: the wallet has noMemberaccount.InsufficientFreeCash: for a deposit, the wallet's USDC account holds less than the amount; for a withdrawal, free ledger cash is short.InvalidCashAccount: the token account given isn't the wallet's associated token account for the cash mint.ZeroAmount: the amount is zero.