The implementation steps make use of Wagmi, and the defaultWagmiConfig we can import from web3Modal. We can customize this to strictly make use of the ME wallet or any specific wallet, but the default config is good for our use case.
Here is a code example pulled from the Wallet Connect docs
import { createWeb3Modal } from'@web3modal/wagmi/react'import { defaultWagmiConfig } from'@web3modal/wagmi/react/config'import { WagmiProvider } from'wagmi'import { arbitrum, mainnet } from'wagmi/chains'import { QueryClient, QueryClientProvider } from'@tanstack/react-query'// 0. Setup queryClientconstqueryClient=newQueryClient()// 1. Get projectId from https://cloud.walletconnect.comconstprojectId='YOUR_PROJECT_ID'// 2. Create wagmiConfigconstmetadata= { name:'Web3Modal', description:'Web3Modal Example', url:'https://web3modal.com',// origin must match your domain & subdomain icons: ['https://avatars.githubusercontent.com/u/37784886']}constchains= [mainnet] asconstconstconfig=defaultWagmiConfig({ chains, projectId, metadata,})// 3. Create modalcreateWeb3Modal({ wagmiConfig: config, projectId, enableAnalytics:true,// Optional - defaults to your Cloud configuration enableOnramp:true// Optional - false as default})exportfunctionWeb3ModalProvider({ children }) {return ( <WagmiProviderconfig={config}> <QueryClientProviderclient={queryClient}>{children}</QueryClientProvider> </WagmiProvider> )}
Opening the Modal
We can also make use of the out of the box <w3m-button/> directly from the web3Modal