> **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.

# Active wallet (Ethereum)

The active wallet is the wallet currently used for signing and sending transactions. Use [`useEthereumEmbeddedWallet`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useEthereumEmbeddedWallet) to read and manage the active Ethereum wallet. For Solana, see [Active wallet (Solana)](https://www.openfort.io/docs/products/embedded-wallet/react/wallet/active-wallet/solana).

## View active wallet

Use `useEthereumEmbeddedWallet` to read the active wallet:

```tsx
import { useEthereumEmbeddedWallet } from "@openfort/react/ethereum"

function ActiveWalletDisplay() {
  const { activeWallet, status } = useEthereumEmbeddedWallet()

  if (status !== "connected" || !activeWallet) return <div>Not connected</div>

  return (
    <div>
      <p>Address: {activeWallet.address}</p>
      <p>Chain: Ethereum</p>
    </div>
  )
}
```

## List user wallets

The hook returns a list of [`ConnectedEmbeddedEthereumWallet`](#connectedembeddedethereumwallet) objects.

```tsx
import { useEthereumEmbeddedWallet } from "@openfort/react/ethereum"

function WalletList() {
  const { wallets, activeWallet } = useEthereumEmbeddedWallet()

  return (
    <ul>
      {wallets.map((w) => (
        <li key={w.id}>
          {w.address} {w.id === activeWallet?.id && "(active)"}
        </li>
      ))}
    </ul>
  )
}
```

## Change active wallet

To change the active wallet, use the `setActive` method from the `useEthereumEmbeddedWallet` hook. In this example, we change the active wallet by providing the `address`.

```tsx
import { useEthereumEmbeddedWallet } from "@openfort/react/ethereum"
import type { Hex } from "viem"

function SwitchWallet() {
  const {
    isConnecting,
    setActive,
  } = useEthereumEmbeddedWallet()

  const handleChangeWallet = async (address: Hex) => {
    const result = await setActive({ address })
    if (result.error) return console.error(result.error.shortMessage)
    if (result.needsRecovery) console.log("Recovery required")
  }

  return (
    <button onClick={() => handleChangeWallet("0x..." as Hex)} disabled={isConnecting}>
      Switch wallet
    </button>
  )
}
```

You can also pass `chainId`, `recoveryParams`, `recoveryMethod`, `passkeyId`, `password`, or `otpCode` when recovering a wallet. The result reports `needsRecovery: true` when recovery is still required.

## ConnectedEmbeddedEthereumWallet

The Ethereum wallet object represents the embedded wallet for the user on Ethereum. It contains:

* Account ID and wallet address uniquely identify the wallet
* Account type (e.g. Smart Account) specifies the wallet's capabilities
* Recovery method used for wallet restoration
* `getProvider()` for EIP-1193 signing

**Properties:**

* `address`: The wallet address (hex).
* `id`: Wallet identifier.
* `chainType`: Always `'EVM'`.
* `walletIndex`: Index among the user's Ethereum wallets.
* `recoveryMethod`: The recovery method (e.g. AUTOMATIC, PASSWORD, PASSKEY).
* `ownerAddress`: Owner address (Smart Account only).
* `implementationType`: Implementation type (e.g. Upgradeable\_v05) (Smart Account only).
* `getProvider()`: Returns the EIP-1193 compatible provider.
* `isAvailable`: Whether the wallet is available.
* `isActive`: Whether this wallet is currently active.
* `isConnecting`: Whether the wallet is connecting.
* `accounts`: Account metadata (id, chainId).
* `connectorType`: Connector type (e.g. embedded).
* `walletClientType`: Wallet client type (e.g. openfort).
* `accountId`: Account ID (Openfort embedded wallets).
* `accountType`: Account type (e.g. Smart Account).
* `createdAt`: Timestamp for wallet creation.
* `salt`: Salt used for wallet encryption.

### Example usage

```tsx
import { useEthereumEmbeddedWallet } from "@openfort/react/ethereum"

function MyComponent() {
  const { activeWallet, wallets } = useEthereumEmbeddedWallet()

  return (
    <div>
      <h1>Ethereum wallet</h1>
      <p>Address: {activeWallet?.address}</p>
      <p>Account ID: {activeWallet?.accountId}</p>
      <p>Created at: {activeWallet?.createdAt}</p>
      <h2>All wallets</h2>
      <ul>
        {wallets.map((wallet) => (
          <li key={wallet.address}>
            {wallet.address} — {wallet.isActive ? "Active" : "Inactive"}
          </li>
        ))}
      </ul>
    </div>
  )
}
```
