# Wallet assets

Wallet assets represent the tokens held by a user's embedded wallet:

* **Native tokens** (e.g., ETH, MATIC, AVAX) — the blockchain's native currency
* **ERC-20 tokens** (e.g., USDC, DAI, USDT) — fungible tokens following the ERC-20 standard

:::info
Asset tracking with [`useEthereumWalletAssets`](/docs/products/embedded-wallet/react/hooks/useEthereumWalletAssets) and the `assets` configuration is **Ethereum-only** (native tokens + ERC-20). For Solana, query the native balance through the Solana provider — see [Solana](#solana) below.
:::

## Ethereum

On Ethereum there are three steps: configure which tokens to track, display them with the prebuilt UI, and/or fetch them yourself with a hook.

### 1. Configure tracked tokens

By default, Openfort tracks balances for popular ERC-20 tokens like USDC and DAI, plus a set of [default assets](/docs/configuration/default-assets). Add your own tokens in the `assets` map of `walletConfig.ethereum`, keyed by chain ID:

```tsx
import { polygonAmoy } from "viem/chains"
import { OpenfortProvider } from "@openfort/react"

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <OpenfortProvider
      publishableKey="YOUR_OPENFORT_PUBLISHABLE_KEY"
      walletConfig={{
        shieldPublishableKey: "YOUR_SHIELD_PUBLISHABLE_KEY",
        ethereum: {
          chainId: polygonAmoy.id,
          assets: {   // [!code focus]
            [polygonAmoy.id]: ["0xef147ed8bb07a2a0e7df4c1ac09e96dec459ffac"],  // [!code focus]
          },  // [!code focus]
        },
      }}
    >
      {children}
    </OpenfortProvider>
  )
}
```

The `assets` object uses chain IDs as keys, with each value being an array of token addresses:

```typescript
assets?: {
  [chainId: number]: Hex[];
}
```

Openfort automatically queries each token contract to retrieve its `symbol`, `name`, and `decimals` — you only provide the address.

### 2. Display with Openfort UI

Openfort's prebuilt UI components fetch and display native and ERC-20 balances automatically, with no extra code. A user's assets look like this:

<div align="center">
  <img src="https://www.openfort.io/images/blog/Screenshot_2025_11_12_at_11_54_29_6a1d107b08.webp?updated_at=2025-11-12T10:55:54.632Z" width={300} height={300} alt="Wallet Assets UI" />
</div>

### 3. Fetch with a hook

To fetch assets yourself, use the [`useEthereumWalletAssets`](/docs/products/embedded-wallet/react/hooks/useEthereumWalletAssets) hook from `@openfort/react/ethereum`. It returns the default assets plus any tokens you configured in step 1 (or pass addresses directly to the hook).

```tsx
import { useEthereumWalletAssets } from "@openfort/react/ethereum"
import { formatUnits } from "viem"

function WalletAssets() {
  const { data: assets, isLoading, error } = useEthereumWalletAssets()

  if (isLoading) return <div>Loading assets...</div>
  if (error) return <div>Error: {error.message}</div>

  return (
    <div>
      <h2>Wallet Assets</h2>
      <ul>
        {assets?.map((asset) => (
          <li key={asset.address}>
            {asset.address}: {formatUnits(asset.balance, asset.metadata?.decimals ?? 18)} {asset.metadata?.symbol}
          </li>
        ))}
      </ul>
    </div>
  )
}
```

For all options, see [useEthereumWalletAssets](/docs/products/embedded-wallet/react/hooks/useEthereumWalletAssets).

## Solana

For native SOL balance, use the Solana RPC with the active wallet address from [`useSolanaEmbeddedWallet`](/docs/products/embedded-wallet/react/hooks/useSolanaEmbeddedWallet) (e.g. `activeWallet?.address`) and your preferred RPC client. The Ethereum `assets` config and `useEthereumWalletAssets` hook do not apply to Solana.

## Related resources

* [Wallet actions](/docs/products/embedded-wallet/react/wallet/actions) — send native tokens and ERC-20 transfers
* [Active wallet](/docs/products/embedded-wallet/react/wallet/active-wallet) — get, list, and switch the active wallet
* [ConnectedEmbeddedEthereumWallet](/docs/products/embedded-wallet/react/wallet/active-wallet/ethereum#connectedembeddedethereumwallet) — wallet object properties
