> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# `useSolanaWalletAssets`

Fetch native SOL and SPL Token or Token-2022 holdings for the connected Solana wallet.

:::info
Import this hook from `@openfort/react/solana`. Configure `walletConfig.chainType` as `ChainTypeEnum.SVM` and provide `walletConfig.solana` first.
:::

## Usage

```tsx
import { useSolanaWalletAssets } from '@openfort/react/solana'

function SolanaBalances() {
  const { data: assets, error, isPending, isIdle } = useSolanaWalletAssets()

  if (isIdle) return <p>Connect a Solana wallet</p>
  if (isPending) return <p>Loading balances…</p>
  if (error) return <p>{error.shortMessage}</p>

  return (
    <ul>
      {assets?.map((asset) => (
        <li key={asset.mint}>
          {asset.symbol}: {asset.amount.toString()} base units
        </li>
      ))}
    </ul>
  )
}
```

## Return type

The hook returns the full TanStack Query result. Before the first result, `data` is `null`; errors are normalized to `OpenfortError`; and `isIdle` is true when no connected wallet or Solana RPC URL is available.

```ts
type UseSolanaWalletAssetsResult = Omit<
  UseQueryResult<SolanaAsset[], Error>,
  'data' | 'error'
> & {
  data: SolanaAsset[] | null
  error: OpenfortError | undefined
  isIdle: boolean
}

type SolanaAsset = {
  mint: string       // "native" for SOL, otherwise the SPL mint address
  symbol: string
  name: string
  amount: bigint     // Raw base units; lamports for SOL
  decimals: number
  isNative: boolean
}
```

The query reads SOL plus both SPL Token and Token-2022 accounts from the configured cluster. Known mints receive display metadata; unknown tokens use a shortened mint as their symbol.
