WalletKit is a React component library for easily connecting a wallet to your dApp.
- 💡 Typescript — Get types straight out of the box.
- 🌱 Ecosystem Standards — Built on top of wagmi and viem
- 🎨 Customization — Easily customizing wallets and themes
For full documentation, visit here.
The following examples are provided in the examples folder of this repo.
npm i @node-real/walletkit@^2 wagmi@^2 viem@^2 @tanstack/react-query@^5import '@node-real/walletkit/styles.css';
import { binanceWallet, trustWallet, metaMask, walletConnect } from '@node-real/walletkit/wallets';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import {
ConnectModal,
WalletKitConfig,
WalletKitProvider,
ConnectButton,
SwitchNetworkModal,
ProfileModal,
} from '@node-real/walletkit';
import { WagmiProvider } from 'wagmi';
import { AppProps } from 'next/app';
import { bsc, mainnet } from 'wagmi/chains';
const queryClient = new QueryClient();
const config: WalletKitConfig = {
options: {
closeModalOnEsc: false,
},
evmConfig: defaultEvmConfig({
autoConnect: true,
initialChainId: 1,
// WalletConnect 2.0 requires a projectId which you can create quickly
// and easily for free over at WalletConnect Cloud https://cloud.walletconnect.com/sign-in
walletConnectProjectId: 'xxx',
wallets: [binanceWallet(), metaMask(), trustWallet(), walletConnect()],
chains: [mainnet, bsc],
}),
};
export default function App({ Component, pageProps }: AppProps) {
return (
<QueryClientProvider client={queryClient}>
<WalletKitProvider config={config} debugMode={true} mode="auto">
<Component {...pageProps} />
<ConnectButton />
<ConnectModal />
{/*
Profile modal shows some basic information about the current account,
if you don't need this modal, you can remove it.
*/}
<ProfileModal />
{/* 👇 Here's the SwitchNetworkModal
If the user switches to a network that is not supported by our dApp,
this modal will be displayed to remind the user to switch to our supported networks.
*/}
<SwitchNetworkModal />
</WalletKitProvider>
</QueryClientProvider>
);
}WalletKit shows a warning before wallet selection when the iOS or iPadOS version reported by Safari matches its risk rules. If Safari omits the patch number, the warning appears only when the whole reported version series is affected. An acknowledgement applies to the reported system version and the current policy for the rest of the browser tab's session.
The warning is enabled by default. To disable it, set options.iosSecurityWarning to false
in the configuration passed to WalletKitProvider.
Please follow our WalletKit Contribution Guide.
See LICENSE for more information.