Skip to content

How to Migrate from RainbowKit

Joan Alavedra, Co-Founder at Openfort•3 min read
RainbowKit to Openfort React migration guide

Migrating your React application from RainbowKit to Openfort allows you to offer more than just wallet connection. By switching to Openfort, you unlock features like embedded wallets, gas sponsorship, and session keys that improve user retention and simplify onboarding.

How to Migrate from RainbowKit to Openfort?

To migrate from RainbowKit to Openfort, you first install the @openfort/react package and its dependencies. Next, you replace the RainbowKitProvider in your application’s root with the OpenfortProvider, passing in your publishable keys and wallet configuration. Finally, update your components to use Openfort hooks like useUI instead of RainbowKit’s useConnectModal. This transition allows your app to move from a standard "connect wallet" flow to a more seamless, on-chain identity system while maintaining compatibility with wagmi and viem.

1. Install Openfort

Install the required package and its peer dependencies:

If you have wagmi and react-query already installed, just add openfort:


_10
yarn add @openfort/react

Note: Ensure you have compatible versions of wagmi, viem, @tanstack/react-query, and react as required by Openfort.

If you don't have wagmi or react-query installed, add them as well:


_10
yarn add @openfort/react wagmi viem@^2.22.0 @tanstack/react-query

2. Swap Wallet Provider

Swapping to Openfort react is very simple! Just replace your RainbowKit provider with Openfort provider.

From:


_14
import { RainbowKitProvider } from "@rainbow-me/rainbowkit";
_14
// ... your configuration
_14
_14
export default function WalletProvider({ children }) {
_14
return (
_14
<WagmiProvider config={config}>
_14
<QueryClientProvider client={client}>
_14
<RainbowKitProvider /* Your configuration */ >
_14
{children}
_14
</RainbowKitProvider>
_14
</QueryClientProvider>
_14
</WagmiProvider>
_14
);
_14
}

To:


_15
import { OpenfortProvider } from "@openfort/react";
_15
_15
// ... your configuration
_15
_15
export default function WalletProvider({ children }) {
_15
return (
_15
<WagmiProvider config={config}>
_15
<QueryClientProvider client={client}>
_15
<OpenfortProvider /* Your configuration */ >
_15
{children}
_15
</OpenfortProvider>
_15
</QueryClientProvider>
_15
</WagmiProvider>
_15
);
_15
}

3. Configure Openfort

Openfort UI comes with various configuration options, like what auth methods you want to use, the policy to sponsor your transactions and more.

Create the configuration, and add it to the OpenfortProvider as follows:


_28
const openfortOptions = {
_28
authProviders: [
_28
AuthProvider.GUEST,
_28
AuthProvider.EMAIL,
_28
AuthProvider.WALLET,
_28
AuthProvider.GOOGLE,
_28
]
_28
};
_28
_28
const walletConfig: OpenfortWalletConfig = {
_28
shieldPublishableKey: "Your shield api key",
_28
};
_28
_28
export default function WalletProvider({ children }) {
_28
return (
_28
<WagmiProvider config={config}>
_28
<QueryClientProvider client={client}>
_28
<OpenfortProvider
_28
publishableKey={"Your publishable key"}
_28
walletConfig={walletConfig}
_28
uiConfig={openfortOptions}
_28
>
_28
{children}
_28
</OpenfortProvider>
_28
</QueryClientProvider>
_28
</WagmiProvider>
_28
);
_28
}

4. Update Modal Usage in Components

Using Openfort hooks the same way you would use RainbowKit's hooks. The full list of hooks can be found here

For example, to open the modal, with Rainbowkit you would use useConnectModal. With Openfort you would use useUI, as follows:

RainbowKit:


_10
import { useConnectModal } from "@rainbow-me/rainbowkit";
_10
const { openConnectModal } = useConnectModal();
_10
...
_10
<Button onClick={openConnectModal}>Connect Wallet</Button>

Openfort:


_10
import { useUI } from "@openfort/react";
_10
const { setOpen: openConnectModal } = useUI();
_10
...
_10
<Button onClick={openConnectModal}>Connect Wallet</Button>

5. Handling Disconnect/SignOut Logic

If you used useDisconnect, replace it with Openfort's useSignOut, so the openfort user is logged out and disconnected:

Before:


_10
import { useDisconnect } from "wagmi";
_10
const { disconnect } = useDisconnect();

After:


_10
import { useSignOut } from "@openfort/react";
_10
const { signOut } = useSignOut();

6. Remove RainbowKit Imports and Dependencies

yarn remove @rainbow-me/rainbowkit.

Also, remove all @rainbow-me/rainbowkit imports and related code from your project files.

7. Test Your Application

  • Run your app and verify wallet connection, modal, and sign out flows work as expected.
  • Check for any remaining RainbowKit usage and update as needed.
Share this article

Related Articles

  1. How to Migrate from Web3Modal

    This guide provides a step-by-step process to migrate your React app from Web3Modal to Openfort React

  2. How to Migrate from Alchemy AccountKit

    Step-by-step guide to migrate your React app from Alchemy Account Kit to Openfort embedded wallets after Alchemy's signer sunset.

  3. Openfort React, an open-source WalletKit for developers

    Get started with Openfort Kit—a plug-and-play toolset that simplifies wallet deployment, auth, and payments for apps and webs.

  4. Introducing React Native SDK

    We’ve just released the Openfort React Native SDK, making it easier than ever to integrate wallet functionality

  5. Introducing React SDK

    The new React SDK integrates Openfort Kit auth UI elements with dedicated React hooks and TypeScript types for embedded wallets.

  6. Using Embedded Wallets with React Native app

    Openfort offers a foundational framework for developers to easily implement streamlined authentication and wallet integration across various platforms.

  7. How to create a USDC wallet

    In this tutorial, you'll learn how to integrate Openfort smart wallets into a mobile app to provide a usdc compatible wallet for your users.

  8. Introducing Swift SDK

    We’ve just released the Openfort Swift SDK, bringing seamless wallet integration and account abstraction natively to iOS.

Ship your first wallet in minutes

No credit card required • 2,000 operations free