An Open protocol for connecting Wallets to Dapps, supports Asset Chain. Wallet Connect's, Wallet Kit boasts features that provide a simple, secure way for your wallet users to easily connect with thousands of apps.
Getting Started
To connect your application to WalletConnect, you'll need to create a project on the WalletConnect Dashboard and obtain the Project ID.
create a config.js file in the src folder and add this code below:
import { assetChainTestnet } from"viem/chains";import { getDefaultConfig } from"@rainbow-me/rainbowkit";exportconstconfig=getDefaultConfig({ appName:"Wallet Connect Demo",//Update App Name projectId:"77a78cdc46a724d6e05ce4ae785d24d7",// Update ProjectID and for security purposes , put it in a .env file. chains: [assetChainTestnet], ssr:false,// If your dApp uses server side rendering (SSR)-true});
in the main.jsx file, add this code below:
import { StrictMode } from'react'import { createRoot } from'react-dom/client'import { RainbowKitProvider } from"@rainbow-me/rainbowkit";import App from'./App.jsx'import'./index.css'import"@rainbow-me/rainbowkit/styles.css";import { WagmiProvider } from"wagmi";import { QueryClient, QueryClientProvider,} from"@tanstack/react-query";import { config } from"./config"; // replace with your own wallet-connect configuration/* connect users wallet to a dapp on assetchain, through wallet-connect. - user clicks connect wallet. - shows them qr code to scan with phone. - user scans with phone wallet, and connects to this app(running on a-chain) */constqueryClient=newQueryClient();createRoot(document.getElementById("root")).render( <StrictMode> <WagmiProviderconfig={config}> <QueryClientProviderclient={queryClient}> <RainbowKitProvider> {" "} <App /> </RainbowKitProvider> </QueryClientProvider> </WagmiProvider> </StrictMode>);
and finally in your App.jsx file, add the code below: