Appearance
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
| Code | When | What to do |
|---|---|---|
REACT_CASH_APP_PROVIDER_REQUIRED | Used outside CashAppProvider | Wrap with the provider |
SESSION_REQUIRED | Session not loaded | Call loadSession() first |
API_ERROR | Network / server failure | Retry refetch |
See Errors.