npm install @rainbow-me/rainbowkit wagmi [email protected] @tanstack/react-query
npm install thirdweb
import '@rainbow-me/rainbowkit/styles.css';
import {
getDefaultConfig,
RainbowKitProvider,
} from '@rainbow-me/rainbowkit';
import { WagmiProvider } from 'wagmi';
import {
mainnet,
polygon,
optimism,
arbitrum,
base,
} from 'wagmi/chains';
import {
QueryClientProvider,
QueryClient,
} from "@tanstack/react-query";
const config = getDefaultConfig({
appName: 'My RainbowKit App',
projectId: 'YOUR_PROJECT_ID',
chains: [mainnet, polygon, optimism, arbitrum, base],
ssr: true, // If your dApp uses server side rendering (SSR)
});
const queryClient = new QueryClient();
const App = () => {
return (
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<RainbowKitProvider>
{/* Your App */}
</RainbowKitProvider>
</QueryClientProvider>
</WagmiProvider>
);
};
import { ThirdwebProvider } from "thirdweb/react";
const App = () => {
return (
<ThirdwebProvider>
{/* Your App */}
</ThirdwebProvider>
);
};
import { ConnectButton } from '@rainbow-me/rainbowkit';
export const YourApp = () => {
return <ConnectButton />;
};
import { ConnectButton } from "thirdweb/react";
import { createThirdwebClient } from "thirdweb";
const client = createThirdwebClient({ clientId: "your-client-id" });
export const YourApp = () => {
return <ConnectButton client={client} />
}
<RainbowKitProvider
locale="zh-CN"
{...etc}>
{/* Your App */}
</RainbowKitProvider>
<ConnectButton
locale={"es-ES"}
{...etc}
/>
<RainbowKitProvider
modalSize="compact"
{...etc}>
{/* Your App */}
</RainbowKitProvider>
<ConnectButton
connectModal={{ size: "compact" }}
{...etc}
/>
<RainbowKitProvider
locale="zh-CN"
{...etc}>
{/* Your App */}
</RainbowKitProvider>
<ConnectButton
locale={"es-ES"}
{...etc}
/>
import { ...etc, darkTheme } from '@rainbow-me/rainbowkit';
<RainbowKitProvider
theme={darkTheme()}
{...etc}>
{/* Your App */}
</RainbowKitProvider>
<ConnectButton
theme="dark" // "light"
{...etc}
/>