Skip to content

Balances

Load enriched Coinbase balances for the connected account.

When to use

Call after a successful connection. Use the list to let the user pick a withdrawal currency.

Methods

MethodReturnsPurpose
getBalances()Promise<CoinbaseBalance[]>Enriched balances (eligibility, fees, formatted display)

Each balance includes:

  • currency, name, id (account name for networks)
  • eligible / ineligibleReason (unsupported | zero_balance | below_min | below_fee_reserve)
  • formatted.balance, formatted.valueFiat
  • raw — pass into funding-token helpers

Example

ts
import { TokenSymbol } from '@swapped/connect-sdk';

const balances = await client.coinbase.getBalances();

const usdc = balances.find(
  item => item.currency === TokenSymbol.USDC && item.eligible,
);

if (!usdc) {
  // Show “no eligible USDC” — inspect ineligibleReason on matching rows
}

console.log(usdc?.formatted.balance, usdc?.formatted.valueFiat);

Prefer eligible === true rows for selection. Keep ineligible rows visible with a hint if you want to explain why they cannot withdraw.

Errors

CodeWhenWhat to do
COINBASE_NOT_CONNECTEDNo OAuth tokenCall connect() first
COINBASE_SESSION_EXPIREDToken rejected by APIReconnect
API_ERRORNetwork / server failureRetry on the same step

See Errors.