Skip to content

useCoinbaseSelection

Full snapshot of the Coinbase withdraw selection for review screens and submit gating.

When to use

When a component needs token + network + funding + amount together (for example a confirm step). Prefer the focused hooks (token, network, amount) for pickers.

Example

tsx
import {
  useCoinbaseSelection,
  useCoinbaseWithdrawal,
  useCoinbaseWithdrawalCooldown,
} from '@swapped/connect-sdk/react'

function ReviewAndSubmit() {
  const {
    selectedCurrency,
    selectedNetwork,
    amount,
    canSubmit,
    reset,
  } = useCoinbaseSelection()
  const { startWithdrawal, isStartingWithdrawal } = useCoinbaseWithdrawal()
  const { isInCooldown } = useCoinbaseWithdrawalCooldown()

  return (
    <div>
      <p>
        Withdraw {amount} {selectedCurrency} on {selectedNetwork}
      </p>
      <button type="button" onClick={reset}>
        Reset
      </button>
      <button
        type="button"
        disabled={!canSubmit || isStartingWithdrawal || isInCooldown}
        onClick={() => void startWithdrawal()}
      >
        Confirm
      </button>
    </div>
  )
}

Returns

FieldPurpose
selectedCurrency / selectedBalanceToken
selectedNetwork / selectedNetworkItemNetwork
selectedFundingTokens / fundingTokens / aggregatedBalanceFunding
amount / amountFloat / minAmount / maxAmountAmount
canSubmitReady to call startWithdrawal()
reset()Clear selection back toward defaults

Requires CoinbaseProvider.