Skip to content

Networks

Load withdrawal networks for a selected Coinbase currency / account.

When to use

After the user picks a balance. Pass currency and accountName (CoinbaseBalance.id). Prefer eligible networks for the amount form.

Methods

MethodReturnsPurpose
getNetworks({ currency, accountName })Promise<CoinbaseNetworkItem[]>Networks with mins and eligibility

ineligibleReason when not eligible: inactive | insufficient_balance.

Example

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

const balances = await client.coinbase.getBalances();
const usdc = balances.find(item => item.currency === TokenSymbol.USDC);
if (!usdc) throw new Error('No USDC');

const networks = await client.coinbase.getNetworks({
  currency: TokenSymbol.USDC,
  accountName: usdc.id,
});

const network = networks.find(item => item.eligible) ?? networks[0];
// Pass network?.id into getMinWithdrawalAmount / startWithdrawal

Errors

CodeWhenWhat to do
COINBASE_NOT_CONNECTEDNo OAuth tokenCall connect()
COINBASE_SESSION_EXPIREDToken invalidReconnect
API_ERRORNetwork / server failureRetry

See Errors.