Appearance
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
| Method | Returns | Purpose |
|---|---|---|
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 / startWithdrawalErrors
| Code | When | What to do |
|---|---|---|
COINBASE_NOT_CONNECTED | No OAuth token | Call connect() |
COINBASE_SESSION_EXPIRED | Token invalid | Reconnect |
API_ERROR | Network / server failure | Retry |
See Errors.