# Wallet configuration

Configure smart wallets to match your app's requirements. Openfort React Native lets you:

* Set recovery methods (automatic, password-based)
* Adjust wallet creation options and chain preferences
* Manage wallet state and embedded wallet lifecycle

:::info
Ready to execute transactions? Visit [Wallet actions](/docs/products/embedded-wallet/react-native/wallet/actions) for smart-account call examples and gas sponsorship guidance.
:::

:::info
For details on recovery methods, see [Recovery methods](/docs/configuration/recovery-methods). For account types, see [Account types](/docs/products/embedded-wallet/account-types).
:::

## Configuration

To configure Openfort in your React app, set up the `OpenfortProvider` with your publishable key and wallet configuration.

```tsx twoslash
import React from "react";
// ---cut---
import { OpenfortProvider, RecoveryMethod } from '@openfort/react-native'

function App() {
  return (
    <OpenfortProvider
      // ... other configuration
      publishableKey="YOUR_OPENFORT_PUBLISHABLE_KEY"

      // Set the wallet configuration.
      walletConfig={{
        shieldPublishableKey: "YOUR_SHIELD_PUBLISHABLE_KEY",
        // If you want to use AUTOMATIC embedded wallet recovery, an encryption session endpoint is required.
        // createEncryptedSessionEndpoint: "https://your-backend.com/api/protected-create-encryption-session"
      }}
    >
      <>
        {/* Add your wallet components here */}
      </>
    </OpenfortProvider>
  )
}
```

## Using Openfort wallets

Openfort supports both Ethereum and Solana embedded wallets. Choose the hook that matches your target blockchain:

* [`useEmbeddedEthereumWallet`](/docs/products/embedded-wallet/react-native/hooks/useEmbeddedEthereumWallet) - For Ethereum-compatible chains (smart accounts)
* [`useEmbeddedSolanaWallet`](/docs/products/embedded-wallet/react-native/hooks/useEmbeddedSolanaWallet) - For Solana (EOA wallets)

:::code-group

```tsx [Ethereum]
import { useEmbeddedEthereumWallet } from "@openfort/react-native"

function SampleComponent() {
  const {
    wallets,       // List of the wallets of the user.
    status,        // Current state: 'disconnected' | 'fetching-wallets' | 'connecting' | 'reconnecting' | 'creating' | 'needs-recovery' | 'connected' | 'error'
    create,        // Create a new wallet.
    setActive,     // Set the active wallet for the application.
    setRecovery,   // Set the recovery method for the wallet.
    exportPrivateKey, // Export the private key of the active wallet.
  } = useEmbeddedEthereumWallet();

  const activeWallet = wallets?.[0];
  // ...
}
```

```tsx [Solana]
import { useEmbeddedSolanaWallet } from "@openfort/react-native"

function SampleComponent() {
  const {
    wallets,       // List of the wallets of the user.
    status,        // Current state: 'disconnected' | 'fetching-wallets' | 'connecting' | 'reconnecting' | 'creating' | 'needs-recovery' | 'connected' | 'error'
    create,        // Create a new wallet.
    setActive,     // Set the active wallet for the application.
  } = useEmbeddedSolanaWallet();

  const activeWallet = wallets?.[0];
  // ...
}
```

:::
