Fund an account
Deposit USDC, allocate margin, and withdraw free balance.
On this page
Deposit USDC
Connect a wallet with devnet USDC and SOL for transaction costs. The high-level deposit method prepares the private balance when needed. Wait for its credit receipt before using the funds.
Deposit 25 USDC
const deposit = await depth.account.deposit(25_000_000n);
await deposit.confirm();
const balance = await depth.account.summary();Allocate margin
Allocate 10 USDC
const allocation = await depth.account.allocate({
marketId: "SOL-USD",
amount: 10_000_000n,
});
await allocation.confirm();Free balance and market collateral are separate. An order’s margin field allocates additional collateral before submission; set it to 0n when the market already has enough margin.
Release and withdraw
Return available collateral
const release = await depth.account.release({
marketId: "SOL-USD",
amount: "all",
});
await release.confirm();
const withdrawal = await depth.account.withdraw("all");
await withdrawal.confirm();Close exposure and finish pending operations first. Only releasable margin can leave the market, and only free balance can be withdrawn.