Rainbow logo
RainbowKit
2.2.7

Danh sách Ví Tùy chỉnh

Danh sách Ví Tùy chỉnh

Tùy chỉnh danh sách ví

Bạn có thể nhập các ví riêng lẻ từ '@rainbow-me/rainbowkit/wallets' cùng với hàm connectorsForWallets để tạo danh sách ví của riêng bạn với các đầu nối cần thiết của chúng. Bằng cách này, bạn có toàn quyền kiểm soát để hiển thị ví nào và theo thứ tự nào.

Ví dụ, bạn có thể chỉ chọn hiển thị Rainbow cùng với các ví dự phòng chung.

import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import { rainbowWallet, walletConnectWallet, } from '@rainbow-me/rainbowkit/wallets';
const connectors = connectorsForWallets(
[
{
groupName: 'Recommended',
wallets: [rainbowWallet, walletConnectWallet],
},
],
{
appName: 'My RainbowKit App',
projectId: 'YOUR_PROJECT_ID',
}
);

Sau đó, bạn có thể truyền các đầu nối của mình vào tính năng createConfig của Wagmi.

import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import { createConfig } from 'wagmi';
const connectors = connectorsForWallets(/* ... */);
const config = createConfig({
connectors,
{/* Wagmi config */}
});
const queryClient = new QueryClient();
const App = () => (
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<RainbowKitProvider {...etc}>
{/* Your App */}
</RainbowKitProvider>
</QueryClientProvider>
</WagmiProvider>
);

Các ví sau đây được cung cấp qua đối tượng wallet.

Các ví sau đây hiện hữu qua các phương thức kết nối chung thay vì các ứng dụng cụ thể. Kết quả là, nên luôn bao gồm các ví này.

Đây là một tùy chọn ví dự phòng được thiết kế sẵn cho các ví dựa trên WalletConnect mà chưa được cung cấp bởi ví khác trong danh sách.

Nó được khuyên dùng rằng bạn luôn bao gồm ví này trong danh sách để đảm bảo tất cả các ví dựa trên WalletConnect đều được hỗ trợ.

import { walletConnectWallet } from '@rainbow-me/rainbowkit/wallets';

Đây là một tùy chọn ví dự phòng được thiết kế cho những trường hợp mà window.ethereum tồn tại nhưng không được cung cấp bởi ví khác trong danh sách. Ví này sẽ tự động ẩn mình khỏi danh sách khi không cần thiết hoặc nếu không có ví injected có sẵn.

Nó được khuyên dùng rằng bạn luôn bao gồm ví này trong danh sách để đảm bảo tất cả các ví injected đều được hỗ trợ.

import { injectedWallet } from '@rainbow-me/rainbowkit/wallets';

Đối với dApps hỗ trợ Safe Apps cho phép người dùng dễ dàng kết nối với kho an toàn hoặc ví nhiều chữ ký của họ, bao gồm tùy chọn safeWallet cho các kết nối tự động. Tùy chọn Safe sẽ chỉ xuất hiện trong môi trường trình duyệt Safe Wallet.

import { safeWallet } from '@rainbow-me/rainbowkit/wallets';

Các ví sau đây được cung cấp qua đối tượng wallet (theo thứ tự bảng chữ cái).

import { oneInchWallet } from '@rainbow-me/rainbowkit/wallets';
import { argentWallet } from '@rainbow-me/rainbowkit/wallets';
import { backpackWallet } from '@rainbow-me/rainbowkit/wallets';
import { berasigWallet } from '@rainbow-me/rainbowkit/wallets';
import { bestWallet } from '@rainbow-me/rainbowkit/wallets';
import { binanceWallet } from '@rainbow-me/rainbowkit/wallets';
import { bitgetWallet } from '@rainbow-me/rainbowkit/wallets';
import { bifrostWallet } from '@rainbow-me/rainbowkit/wallets';
import { bitskiWallet } from '@rainbow-me/rainbowkit/wallets';
import { bitverseWallet } from '@rainbow-me/rainbowkit/wallets';
import { bloomWallet } from '@rainbow-me/rainbowkit/wallets';
import { braveWallet } from '@rainbow-me/rainbowkit/wallets';
import { bybitWallet } from '@rainbow-me/rainbowkit/wallets';

Kết nối ví này hỗ trợ cả ứng dụng và tiện ích mở rộng Coinbase Wallet, cũng như Coinbase Smart Wallet trên Web.

Một đối số preference được cung cấp để kiểm soát xem Smart Wallet có được kích hoạt và khả dụng cho người dùng hay không. Hành vi dựa trên sở thích được ghi lại tại đây.

Smart Wallet sẽ được kích hoạt mặc định với all vào đầu tháng Sáu, mà không cần nâng cấp thêm.

Các nhà phát triển có thể thử nghiệm Smart Wallet với các chuỗi sepoliabaseSepolia ngay hôm nay bằng cách đặt smartWalletOnly và bao gồm coinbaseWallet trong danh sách ví của họ như sau:

import { coinbaseWallet } from '@rainbow-me/rainbowkit/wallets';
// Enable Coinbase Smart Wallet for testing
coinbaseWallet.preference = 'smartWalletOnly';
import { coin98Wallet } from '@rainbow-me/rainbowkit/wallets';
import { compassWallet } from '@rainbow-me/rainbowkit/compassWallet';
import { coreWallet } from '@rainbow-me/rainbowkit/wallets';
import { dawnWallet } from '@rainbow-me/rainbowkit/wallets';
import { enkryptWallet } from '@rainbow-me/rainbowkit/wallets';
import { foxWallet } from '@rainbow-me/rainbowkit/wallets';
import { frameWallet } from '@rainbow-me/rainbowkit/wallets';
import { frontierWallet } from '@rainbow-me/rainbowkit/wallets';
import { gateWallet } from '@rainbow-me/rainbowkit/wallets';
import { imTokenWallet } from '@rainbow-me/rainbowkit/wallets';
import { iopayWallet } from '@rainbow-me/rainbowkit/wallets';
import { kaiaWallet } from '@rainbow-me/rainbowkit/wallets';
import { kaikasWallet } from '@rainbow-me/rainbowkit/wallets';
import { krakenWallet } from '@rainbow-me/rainbowkit/wallets';
import { kresusWallet } from '@rainbow-me/rainbowkit/wallets';
import { ledgerWallet } from '@rainbow-me/rainbowkit/wallets';
import { magicEdenWallet } from '@rainbow-me/rainbowkit/wallets';
import { mewWallet } from '@rainbow-me/rainbowkit/wallets';
import { metaMaskWallet } from '@rainbow-me/rainbowkit/wallets';
import { okxWallet } from '@rainbow-me/rainbowkit/wallets';
import { omniWallet } from '@rainbow-me/rainbowkit/wallets';
import { oneKeyWallet } from '@rainbow-me/rainbowkit/wallets';
import { paraSwapWallet } from '@rainbow-me/rainbowkit/wallets';
import { phantomWallet } from '@rainbow-me/rainbowkit/wallets';
import { rabbyWallet } from '@rainbow-me/rainbowkit/wallets';
import { rainbowWallet } from '@rainbow-me/rainbowkit/wallets';
import { ramperWallet } from '@rainbow-me/rainbowkit/wallets';
import { roninWallet } from '@rainbow-me/rainbowkit/wallets';
import { safeheronWallet } from '@rainbow-me/rainbowkit/wallets';
import { tahoWallet } from '@rainbow-me/rainbowkit/wallets';
import { talismanWallet } from '@rainbow-me/rainbowkit/wallets';
import { tokenaryWallet } from '@rainbow-me/rainbowkit/wallets';
import { tokenPocketWallet } from '@rainbow-me/rainbowkit/wallets';
import { trustWallet } from '@rainbow-me/rainbowkit/wallets';
import { uniswapWallet } from '@rainbow-me/rainbowkit/wallets';
import { valoraWallet } from '@rainbow-me/rainbowkit/wallets';
import { xdefiWallet } from '@rainbow-me/rainbowkit/wallets';
import { xPortalWallet } from '@rainbow-me/rainbowkit/wallets';
import { zerionWallet } from '@rainbow-me/rainbowkit/wallets';
import { zilPayWallet } from '@rainbow-me/rainbowkit/wallets';
import { wigwamWallet } from '@rainbow-me/rainbowkit/wallets';

Dưới đây là vài ví dụ về cách hiển thị các ví khác nhau, theo thứ tự khác nhau.

Hiển thị MetaMask cùng với các ví dự phòng chung.

import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import { metaMaskWallet, walletConnectWallet, } from '@rainbow-me/rainbowkit/wallets';
const connectors = connectorsForWallets(
[
{
groupName: 'Recommended',
wallets: [metaMaskWallet, walletConnectWallet],
},
],
{ appName: 'RainbowKit App', projectId: 'YOUR_PROJECT_ID' },
);

Hiển thị Rainbow, MetaMask và Coinbase cùng với các ví dự phòng chung.

import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import { rainbowWallet, metaMaskWallet, coinbaseWallet, walletConnectWallet, } from '@rainbow-me/rainbowkit/wallets';
const connectors = connectorsForWallets(
[
{
groupName: 'Suggested',
wallets: [
rainbowWallet,
metaMaskWallet,
coinbaseWallet,
walletConnectWallet,
],
},
],
{ appName: 'RainbowKit App', projectId: 'YOUR_PROJECT_ID' },
);

Nhắc nhở: Thứ tự của mảng wallets xác định thứ tự mà ví sẽ được hiển thị trong UI.

Bạn có thể sử dụng khóa groupName để đặt tên cho các nhóm ví khác nhau. Điều này hữu ích nếu bạn muốn giao tiếp với người dùng ví mà bạn khuyến nghị, cũng như các ví khả thể khác.

Khuyến nghị Rainbow và MetaMask, nhưng cũng cung cấp Coinbase cùng với các ví dự phòng chung.

import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import { rainbowWallet, metaMaskWallet, coinbaseWallet, walletConnectWallet, } from '@rainbow-me/rainbowkit/wallets';
const connectors = connectorsForWallets(
[
{
groupName: 'Recommended',
wallets: [rainbowWallet, metaMaskWallet],
},
{
groupName: 'Others',
wallets: [coinbaseWallet, walletConnectWallet],
},
],
{ appName: 'RainbowKit App', projectId: 'YOUR_PROJECT_ID' },
);