Integrate Para with RainbowKit to provide seamless wallet connection and authentication for your dApp users.
This guide shows how to add Para to RainbowKit, allowing users to connect via social logins, email, and phone verification. You have two integration options:
RainbowKit Wallet (getParaWallet) - Adds Para as a wallet option in RainbowKit. When selected, opens the Para modal on top of the RainbowKit modal for social login.
Para Integrated (getParaWalletIntegrated) - Embeds Para directly within RainbowKit’s right-hand panel for a seamless, integrated experience without additional modal layers.
Learn more about RainbowKit and wagmi in their documentation.
To use Para, you need an API key. This key authenticates your requests to Para services and is essential for integration. Before integrating Para with your application, ensure you have:
Completed Para authentication setup in your application (see one of our Setup Guides)
A valid Para API key
An RPC endpoint for your desired network
Need an API key? Visit the Developer Portal to create API keys, manage billing, teams, and more.
Create a configuration file to initialize your Para wallet configuration. Choose between the two integration methods:
RainbowKit Wallet (Modal Overlay)
Para Integrated (Embedded Panel)
Copy
Ask AI
import { QueryClient } from "@tanstack/react-query";import { connectorsForWallets } from "@getpara/rainbowkit";import { getParaWallet, OAuthMethod, AuthLayout } from "@getpara/rainbowkit-wallet";import { Environment } from "@getpara/web-sdk";import { createConfig, http } from "wagmi";import { sepolia } from "wagmi/chains";const API_KEY = process.env.NEXT_PUBLIC_PARA_API_KEY || "";const paraWalletOpts = { para: { environment: Environment.BETA, apiKey: API_KEY, }, appName: "My dApp",};const paraWallet = getParaWallet(paraWalletOpts);const connectors = connectorsForWallets([ { groupName: "Social Login", wallets: [paraWallet], },]// The rest of your connectors);export const wagmiConfig = createConfig({ connectors, chains: [sepolia], transports: { [sepolia.id]: http(), },});export const queryClient = new QueryClient();
Copy
Ask AI
import { QueryClient } from "@tanstack/react-query";import { connectorsForWallets } from "@getpara/rainbowkit";import { getParaWalletIntegrated, OAuthMethod, ParaWeb, Environment } from "@getpara/rainbowkit-wallet";import { createConfig, http } from "wagmi";import { sepolia } from "wagmi/chains";const API_KEY = process.env.NEXT_PUBLIC_PARA_API_KEY || "";// Initialize Para clientconst paraClient = new ParaWeb(Environment.BETA, API_KEY);// Configure Para integrated walletconst paraWalletIntegratedOpts = { para: paraClient, nameOverride: "Sign in with Para", // Optional: customize the button text transports: { [sepolia.id]: http(), },};const paraWallet = getParaWalletIntegrated(paraWalletIntegratedOpts);const connectors = connectorsForWallets([ { groupName: "Sign up or log in", wallets: [paraWallet], },],{ appName: "My dApp", projectId: "YOUR_WALLET_CONNECT_PROJECT_ID", // Required for WalletConnect});export const wagmiConfig = createConfig({ connectors, chains: [sepolia], transports: { [sepolia.id]: http(), },});export const queryClient = new QueryClient();
2
Set Up Providers
Wrap your application with the necessary providers:
Copy
Ask AI
import React from "react";import { QueryClientProvider } from "@tanstack/react-query";import { RainbowKitProvider, lightTheme } from "@getpara/rainbowkit";import { WagmiProvider } from "wagmi";import { queryClient, wagmiConfig } from "./wagmi"; // Path to your config fileimport { ConnectButton } from "@getpara/rainbowkit";function App() { return ( <WagmiProvider config={wagmiConfig}> <QueryClientProvider client={queryClient}> <RainbowKitProvider> {/* Rest of your application */} </RainbowKitProvider> </QueryClientProvider> </WagmiProvider> );}export default App;
3
Add Connect Button
Add the ConnectButton component to your application to allow users to connect their wallets:
Copy
Ask AI
import { ConnectButton } from "@getpara/rainbowkit";function App() { return ( // The rest of your application <div> <ConnectButton /> </div> );}
If using Next.js, its recommended to setup providers in a dedicated Providers component and using either the ‘use client’ directive or the next/dynamic import to ensure the providers are rendered on the client side.
Rainbowkit is powered by wagmi, so you can use hooks like useAccount to interact with the connected wallet. To learn more about using wagmi hooks or the Rainbowkit hooks check out their docs Using Wagmi Hooks and Using RainbowKit Hooks guides.
You can also use Para directly without RainbowKit while still taking advantage of wagmi’s hooks. Check out our wagmi guide for more information on how to do that.