Custom connectors
Add custom connectors for Ethers or Wagmi
- Wagmi
- Ethers
- Solana
If you already have Wagmi integrated into your application or would like more control over Wagmi's configuration, you can integrate AppKit on top of it.
import { createWeb3Modal } from '@web3modal/wagmi'
import { reconnect, http, createConfig } from '@wagmi/core'
import { sepolia } from '@wagmi/core/chains'
import { walletConnect } from '@wagmi/connectors'
const projectId = 'YOUR_PROJECT_ID'
const metadata = {
//...
}
const config = createConfig({
chains: [sepolia],
transports: {
[sepolia.id]: http()
},
connectors: [
walletConnect({ projectId, metadata, showQrModal: false }), // showQrModal must be false.
//other connectors...
]
})
reconnect(config)
const modal = createWeb3Modal({
//...
wagmiConfig: config,
})
Coming soon...
Add custom wallet adapters for Solana wallets by first installing the wallet adapter package and then including the adapters in the wallets array. You can find a more Solana wallet adapters here.
- npm
- Yarn
- Bun
- pnpm
npm install @solana/wallet-adapter-solflare
yarn add @solana/wallet-adapter-solflare
bun add @solana/wallet-adapter-solflare
pnpm add @solana/wallet-adapter-solflare
import { createWeb3Modal, defaultSolanaConfig } from '@web3modal/solana'
import { solana, solanaTestnet, solanaDevnet } from '@web3modal/solana/chains'
import { SolflareWalletAdapter } from '@solana/wallet-adapter-solflare'
// 0. Setup chains
const chains = [solana, solanaTestnet, solanaDevnet]
// 1. Get projectId from https://cloud.walletconnect.com
const projectId = 'YOUR_PROJECT_ID'
// 2. Create solanaConfig
const metadata = {
//...
}
const solanaConfig = defaultSolanaConfig({
chains,
projectId,
metadata
})
// 3. Create modal
const modal = createWeb3Modal({
solanaConfig,
projectId: projectId,
metadata: metadata,
chains,
enableAnalytics: true,
termsConditionsUrl: 'https://walletconnect.com/terms',
privacyPolicyUrl: 'https://walletconnect.com/privacy',
wallets: [
new SolflareWalletAdapter(),
]
})