A comprehensive React library that simplifies wallet connection functionality for decentralized applications with support for 66 wallets and extensive customization options
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Setup and configuration functions for integrating RainbowKit with wagmi and custom wallet selections.
Creates a default wagmi configuration optimized for RainbowKit with sensible defaults.
/**
* Creates a default wagmi configuration optimized for RainbowKit
* @param parameters - Configuration parameters
* @returns Configured wagmi Config object
*/
function getDefaultConfig<T extends readonly [Chain, ...Chain[]]>(
parameters: GetDefaultConfigParameters<T>
): Config;
interface GetDefaultConfigParameters<T extends readonly [Chain, ...Chain[]]> {
/** Application name shown in wallet connection prompts */
appName: string;
/** WalletConnect project ID from https://cloud.walletconnect.com */
projectId: string;
/** Array of blockchain networks to support */
chains: T;
/** Application description for wallet connection */
appDescription?: string;
/** Application URL for wallet connection */
appUrl?: string;
/** Application icon URL for wallet connection */
appIcon?: string;
/** Custom wallet list (uses default wallets if not provided) */
wallets?: WalletList;
/** Enable server-side rendering support */
ssr?: boolean;
}Usage Examples:
import { getDefaultConfig } from '@rainbow-me/rainbowkit';
import { mainnet, polygon, optimism, arbitrum } from 'wagmi/chains';
// Basic configuration
const config = getDefaultConfig({
appName: 'My DApp',
projectId: 'YOUR_PROJECT_ID',
chains: [mainnet, polygon, optimism, arbitrum],
});
// Full configuration
const advancedConfig = getDefaultConfig({
appName: 'Advanced DApp',
appDescription: 'The best DApp for advanced users',
appUrl: 'https://mydapp.com',
appIcon: 'https://mydapp.com/icon.png',
projectId: 'YOUR_PROJECT_ID',
chains: [mainnet, polygon, optimism, arbitrum],
ssr: true,
});Creates wallet connectors from a custom wallet list configuration.
/**
* Creates wallet connectors from a custom wallet list
* @param walletList - Array of wallet groups to include
* @param parameters - Connector configuration parameters
* @returns Array of wagmi connector functions
*/
function connectorsForWallets(
walletList: WalletList,
parameters: ConnectorsForWalletsParameters
): CreateConnectorFn[];
interface ConnectorsForWalletsParameters {
/** WalletConnect project ID from https://cloud.walletconnect.com */
projectId: string;
/** Application name shown in wallet connection prompts */
appName: string;
/** Application description for wallet connection */
appDescription?: string;
/** Application URL for wallet connection */
appUrl?: string;
/** Application icon URL for wallet connection */
appIcon?: string;
/** Additional WalletConnect parameters */
walletConnectParameters?: RainbowKitWalletConnectParameters;
}
type WalletList = {
groupName: string;
wallets: CreateWalletFn[];
}[];
type CreateWalletFn = (options?: WalletOptions) => Wallet;Usage Examples:
import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import { metaMaskWallet, coinbaseWallet, rainbowWallet } from '@rainbow-me/rainbowkit/wallets';
// Custom wallet configuration
const connectors = connectorsForWallets(
[
{
groupName: 'Popular',
wallets: [metaMaskWallet, coinbaseWallet, rainbowWallet],
},
],
{
appName: 'My DApp',
projectId: 'YOUR_PROJECT_ID',
}
);
// Use with wagmi createConfig
import { createConfig, http } from 'wagmi';
import { mainnet, polygon } from 'wagmi/chains';
const config = createConfig({
connectors,
chains: [mainnet, polygon],
transports: {
[mainnet.id]: http(),
[polygon.id]: http(),
},
});Returns the default wallet configuration used by RainbowKit.
/**
* Returns default wallet configuration (overloaded function)
*/
function getDefaultWallets(): { wallets: WalletList };
function getDefaultWallets(parameters: ConnectorsForWalletsParameters): {
connectors: CreateConnectorFn[];
wallets: WalletList;
};Usage Examples:
import { getDefaultWallets } from '@rainbow-me/rainbowkit';
// Get default wallet list only
const { wallets } = getDefaultWallets();
// Get default wallets with connectors
const { connectors, wallets } = getDefaultWallets({
appName: 'My DApp',
projectId: 'YOUR_PROJECT_ID',
});Creates a WalletConnect connector for integrating with WalletConnect protocol.
/**
* Creates a WalletConnect connector
* @param parameters - WalletConnect configuration parameters
* @returns WalletConnect connector function
*/
function getWalletConnectConnector(
parameters: WalletConnectConnectorParameters
): CreateConnectorFn;
interface WalletConnectConnectorParameters {
/** WalletConnect project ID */
projectId: string;
/** Application metadata */
metadata?: {
name: string;
description: string;
url: string;
icons: string[];
};
/** Whether to show QR modal (default: false for RainbowKit) */
showQrModal?: boolean;
/** Additional WalletConnect parameters */
qrModalOptions?: {
themeMode?: 'light' | 'dark';
themeVariables?: Record<string, string>;
};
}Usage Examples:
import { getWalletConnectConnector } from '@rainbow-me/rainbowkit';
const walletConnectConnector = getWalletConnectConnector({
projectId: 'YOUR_PROJECT_ID',
metadata: {
name: 'My DApp',
description: 'My DApp description',
url: 'https://mydapp.com',
icons: ['https://mydapp.com/icon.png'],
},
});import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import {
metaMaskWallet,
coinbaseWallet,
ledgerWallet,
trustWallet,
argentWallet,
} from '@rainbow-me/rainbowkit/wallets';
const connectors = connectorsForWallets(
[
{
groupName: 'Popular',
wallets: [metaMaskWallet, coinbaseWallet],
},
{
groupName: 'Hardware',
wallets: [ledgerWallet],
},
{
groupName: 'Mobile',
wallets: [trustWallet, argentWallet],
},
],
{
appName: 'My DApp',
projectId: 'YOUR_PROJECT_ID',
}
);import { getDefaultConfig } from '@rainbow-me/rainbowkit';
import { mainnet, sepolia, polygon, polygonMumbai } from 'wagmi/chains';
const config = getDefaultConfig({
appName: 'My DApp',
projectId: process.env.NEXT_PUBLIC_PROJECT_ID!,
chains: process.env.NODE_ENV === 'production'
? [mainnet, polygon]
: [sepolia, polygonMumbai],
appDescription: 'My DApp for Web3',
appUrl: process.env.NODE_ENV === 'production'
? 'https://mydapp.com'
: 'http://localhost:3000',
ssr: true, // Enable for Next.js SSR
});Install with Tessl CLI
npx tessl i tessl/npm-rainbow-me--rainbowkit