Skip to content

useCashAppSupportedAssets

Load destination assets a Cash App onramp can pay out to.

When to use

On the asset picker. Drive the token list and amount minimum. Pair with useCashAppAsset for selection.

Example

tsx
import { getCashAppAssetKey } from '@swapped/connect-sdk'
import { useCashAppSupportedAssets } from '@swapped/connect-sdk/react'

function AssetList() {
  const { assets, isLoading, error, refetch } = useCashAppSupportedAssets()

  if (isLoading) return <p>Loading assets…</p>
  if (error) return <p>{error.message}</p>

  return (
    <div>
      <ul>
        {assets.map(asset => (
          <li key={getCashAppAssetKey(asset)}>
            {asset.asset} on {asset.chain} — min ${asset.minAmountFiat}
          </li>
        ))}
      </ul>
      <button type="button" onClick={() => void refetch()}>
        Refresh
      </button>
    </div>
  )
}

Mins are floored at the client default of $1.

Returns

Returns assets, isLoading, isRefetching, error, refetch.

Requires CashAppProvider.

Errors

CodeWhenWhat to do
REACT_CASH_APP_PROVIDER_REQUIREDUsed outside CashAppProviderWrap with the provider
SESSION_REQUIREDSession not loadedCall loadSession() first
API_ERRORNetwork / server failureRetry refetch

See Errors.