> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getpara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RainbowKit Integration

> Integrate Para with RainbowKit to provide seamless wallet connection and authentication for your dApp users.

export const Card = ({imgUrl, iconUrl, fontAwesomeIcon, title, description, href, horizontal = false}) => {
  return <div className="relative group my-2" style={{
    padding: "1px",
    background: "#e5e7eb",
    borderRadius: "12px"
  }} onMouseOver={e => {
    e.currentTarget.style.background = "linear-gradient(45deg, #FF4E00, #874AE3)";
  }} onMouseOut={e => {
    e.currentTarget.style.background = "#e5e7eb";
  }}>
      <a href={href} className={`
          block not-prose font-normal h-full
          bg-white dark:bg-background-dark 
          overflow-hidden w-full cursor-pointer
          flex ${horizontal ? "flex-row" : "flex-col"}
        `} style={{
    borderRadius: "11px"
  }}>
        {(imgUrl || iconUrl) && <div className={`
              relative overflow-hidden flex-shrink-0
              ${horizontal ? "rounded-l" : ""}
              ${!imgUrl ? "bg-white dark:bg-background-dark p-4" : ""}
            `} style={{
    width: horizontal ? "30%" : "100%"
  }}>
            {imgUrl && <img src={`https://mintlify.s3-us-west-1.amazonaws.com/getpara${imgUrl}`} alt={title} className="w-full h-full object-cover" />}
            {(iconUrl || fontAwesomeIcon) && <div className={`
                ${imgUrl ? "absolute inset-0" : ""}
                flex items-center justify-center
              `}>
                <div className="relative w-8 h-8">
                  <img src={iconUrl ? `https://mintlify.s3-us-west-1.amazonaws.com/getpara${iconUrl}` : fontAwesomeIcon} alt={title} className="w-full h-full object-contain" style={{
    filter: "brightness(0) invert(1)"
  }} />
                </div>
              </div>}
          </div>}
        <div className={`
            flex-grow px-6 py-5
            ${horizontal && (imgUrl || iconUrl) ? "flex flex-col justify-center" : ""}
          `} style={{
    width: horizontal ? "70%" : "100%"
  }}>
          {title && <h2 className="font-semibold text-base text-gray-800 dark:text-white">{title}</h2>}
          {description && <div className={`
              font-normal text-sm text-gray-600 dark:text-gray-400 leading-6
              ${horizontal || !imgUrl && !iconUrl ? "mt-0" : "mt-1"}
            `}>
              <p>{description}</p>
            </div>}
        </div>
      </a>
    </div>;
};

export const Link = ({href, label}) => <a href={href} style={{
  display: "inline-block",
  position: "relative",
  color: "#000000",
  fontWeight: 600,
  cursor: "pointer",
  borderBottom: "none",
  textDecoration: "none"
}} onMouseEnter={e => {
  e.currentTarget.querySelector("#underline").style.height = "2px";
}} onMouseLeave={e => {
  e.currentTarget.querySelector("#underline").style.height = "1px";
}}>
    {label}
    <span id="underline" style={{
  position: "absolute",
  left: 0,
  bottom: 0,
  width: "100%",
  height: "1px",
  borderRadius: "2px",
  background: "linear-gradient(45deg, #FF4E00, #874AE3)",
  transition: "height 0.3s"
}}></span>

  </a>;

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:

1. **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.
2. **Para Integrated** (`getParaWalletIntegrated`) - Embeds Para directly within RainbowKit's right-hand panel for a seamless, integrated experience without additional modal layers.

Learn more about <Link href="https://rainbowkit.com/docs/installation" label="RainbowKit" /> and <Link href="https://wagmi.sh/react/getting-started" label="wagmi" /> in their documentation.

## Prerequisites

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

<Tip>
  Need an API key? Visit the <Link label="Developer Portal" href="https://developer.getpara.com" /> to create API keys, manage billing, teams, and more.
</Tip>

## Installation

Install the required packages for the integration:

<CodeGroup>
  ```bash npm theme={null}
  npm install @getpara/rainbowkit-wallet @getpara/rainbowkit wagmi viem @tanstack/react-query
  ```

  ```bash yarn theme={null}
  yarn add @getpara/rainbowkit-wallet @getpara/rainbowkit wagmi viem @tanstack/react-query
  ```

  ```bash pnpm theme={null}
  pnpm add @getpara/rainbowkit-wallet @getpara/rainbowkit wagmi viem @tanstack/react-query
  ```
</CodeGroup>

## Setup

<Steps>
  <Step title="Configure Wagmi and Para client">
    Create a configuration file to initialize your Para wallet configuration. Choose between the two integration methods:

    <Tabs>
      <Tab title="RainbowKit Wallet (Modal Overlay)">
        ```typescript [expandable] theme={null}
        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();
        ```
      </Tab>

      <Tab title="Para Integrated (Embedded Panel)">
        ```typescript [expandable] theme={null}
        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 client
        const paraClient = new ParaWeb(Environment.BETA, API_KEY);

        // Configure Para integrated wallet
        const 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();
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Set Up Providers">
    Wrap your application with the necessary providers:

    ```tsx [expandable] theme={null}
    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 file
    import { ConnectButton } from "@getpara/rainbowkit";


    function App() {
      return (
        <WagmiProvider config={wagmiConfig}>
          <QueryClientProvider client={queryClient}>
            <RainbowKitProvider>
              {/* Rest of your application */}
            </RainbowKitProvider>
          </QueryClientProvider>
        </WagmiProvider>
      );
    }

    export default App;
    ```
  </Step>

  <Step title="Add Connect Button">
    Add the `ConnectButton` component to your application to allow users to connect their wallets:

    ```tsx theme={null}
    import { ConnectButton } from "@getpara/rainbowkit";

    function App() {
      return (
        // The rest of your application
        <div>
          <ConnectButton />
        </div>
      );
    }
    ```
  </Step>
</Steps>

<Note>
  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.
</Note>

### Advanced Configuration

Both integration methods support advanced configuration, but with slightly different approaches:

<Tabs>
  <Tab title="RainbowKit Wallet Configuration">
    The `getParaWallet` method supports all `ParaModal` props:

    ```typescript [expandable] theme={null}
    const paraWalletOpts: GetParaOpts = {
      para: {
        environment: Environment.DEVELOPMENT,
        apiKey: API_KEY,
      },
      appName: "My dApp",
      logo: "/path/to/logo.svg", // Your app logo
      oAuthMethods: [
        OAuthMethod.APPLE,
        OAuthMethod.DISCORD,
        // Add other OAuth methods as needed
      ],
      theme: {
        backgroundColor: "#FFFFFF",
        font: "Inter", // Font family to use
      },
      onRampTestMode: true,
      disableEmailLogin: false,
      disablePhoneLogin: false,
      authLayout: [AuthLayout.AUTH_FULL], // Layout options for the auth modal
      recoverySecretStepEnabled: true, // Enable recovery secrets
    };
    ```
  </Tab>

  <Tab title="Para Integrated Configuration">
    The `getParaWalletIntegrated` method requires initializing a `ParaWeb` client with constructor options:

    ```typescript [expandable] theme={null}
    // Constructor options for ParaWeb client
    const paraConstructorOpts = {
      // Portal branding
      portalBackgroundColor: '#FFFFFF',
      portalPrimaryButtonColor: '#5298FF',
      portalTextColor: '#000000',
      portalPrimaryButtonTextColor: '#FFFFFF',

      // Email branding
      emailTheme: 'light',
      emailPrimaryColor: '#5298FF',
      githubUrl: 'https://github.com/yourorg',
      xUrl: 'https://x.com/yourorg',
      homepageUrl: 'https://yourapp.com',
      supportUrl: 'support@yourapp.com',
    };

    const paraClient = new ParaWeb(Environment.BETA, API_KEY, paraConstructorOpts);

    // Para integrated wallet options
    const paraWalletIntegratedOpts = {
      para: paraClient,
      nameOverride: 'Sign in with Para',
      iconOverride: '/path/to/custom-icon.svg', // Optional custom icon
      iconBackgroundOverride: '#ffffff',
      transports: {
        [sepolia.id]: http(),
      },
    };

    const paraWallet = getParaWalletIntegrated(paraWalletIntegratedOpts);
    ```

    You can also configure modal-specific props when using Para integrated:

    ```typescript [expandable] theme={null}
    export const paraModalProps = {
      appName: 'My dApp',
      oAuthMethods: [OAuthMethod.GOOGLE, OAuthMethod.DISCORD, OAuthMethod.APPLE],
      recoverySecretStepEnabled: true,
    };
    ```
  </Tab>
</Tabs>

You can learn more about customizing the `ParaModal` in the customization guide:

<Card horizontal title="Customization Guide" imgUrl="/images/v1/general-customize.png" href="/v1/web/guides/customization/overview" description="Learn how to customize Para's appearance to match your brand" />

### Interacting with the Connected Wallet

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 <Link href="https://wagmi.sh/react/api/hooks" label="Using Wagmi Hooks" /> and <Link href="https://rainbowkit.com/docs/modal-hooks" label="Using RainbowKit Hooks" /> guides.

```tsx [expandable] theme={null}
import { useAccount, useBalance } from "wagmi";

function WalletInfo() {
  const { address, isConnected } = useAccount();
  const { data: balance } = useBalance({ address });

  if (!isConnected){
    return <p>Connect your wallet to view balance</p>;
  } 

  return (
    <div>
      <p>Connected address: {address}</p>
      <p>Balance: {balance?.formatted} {balance?.symbol}</p>
    </div>
  );
}
```

## Examples

If you'd like to learn more about how to use Rainbowkit with Para, check out our examples on GitHub:

<Card horizontal title="Rainbowkit Wallet Connector Example" imgUrl="/images/v1/connctor-rainbowkit.png" href="https://github.com/getpara/examples-hub/tree/main/web/with-react-nextjs/connector-rainbowkit" description="A simple example of using Para's RainbowKit wallet connector as a wallet option in Rainbowkit ConnectModal" />

## Troubleshooting

If you run into any issues, check out the following common problems and solutions:

<AccordionGroup>
  <Accordion title="Connection issues">
    If you encounter connection issues, check the following:

    * Verify your Para API key is correct
    * Ensure you've configured the correct environment (DEVELOPMENT vs PRODUCTION)
    * Check browser console for error messages
    * Verify you've selected supported networks in your configuration
  </Accordion>

  <Accordion title="Modal not appearing">
    If the Para modal doesn't appear when clicking the connect button:

    * Ensure you're using the correct imports from `@getpara/rainbowkit`
    * Check for any CSS conflicts that might hide the modal
    * Verify your RainbowKit providers are properly configured
  </Accordion>
</AccordionGroup>

## Next Steps

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.

<Card horizontal title="Para + Wagmi Guide" href="/v1/web/guides/evm/wagmi" imgUrl="/images/v1/connctor-wagmi.png" description="Learn how to use the Para wagmi wallet connector directly" />
