Official WalletConnect connector for wagmi.
# Using pnpm
pnpm add @walletconnect/wagmi-connector
# Using npm
npm install @walletconnect/wagmi-connector
# Using yarn
yarn add @walletconnect/wagmi-connector
# Using bun
bun add @walletconnect/wagmi-connectorimport { createConfig, http } from 'wagmi'
import { mainnet, sepolia } from 'wagmi/chains'
import { injected } from 'wagmi/connectors'
import { walletConnect } from '@walletconnect/wagmi-connector'
export const config = createConfig({
chains: [mainnet, sepolia],
connectors: [
injected(),
walletConnect({
projectId: 'YOUR_WALLETCONNECT_PROJECT_ID' // dashboard.reown.com
}),
],
transports: {
[mainnet.id]: http(),
},
})walletConnect({
projectId: string // Required: Your WalletConnect project ID
showQrModal?: boolean // Optional: Show QR modal (default: true)
isNewChainsStale?: boolean // Optional: Treat new chains as stale (default: true)
metadata?: { // Optional: App metadata
name: string
description: string
url: string
icons: string[]
}
qrModalOptions?: { // Optional: QR modal configuration
enableMobileFullScreen?: boolean
}
})If you're migrating from the built-in wagmi connector:
Before:
import { walletConnect } from 'wagmi/connectors'After:
import { walletConnect } from '@walletconnect/wagmi-connector'That's it! The API is exactly the same.
# Install dependencies
pnpm install
# Build the package
pnpm build
# Clean build artifacts
pnpm clean-
In the connector package directory (
~/Code/wagmi-connector):# Build the package pnpm build # Link it globally pnpm link --global
-
In your test application:
# Link the connector pnpm link --global @walletconnect/wagmi-connector -
Update your imports:
// Replace wagmi/connectors import import { walletConnect } from '@walletconnect/wagmi-connector'
-
Test the functionality:
- Run your dev server
- Test WalletConnect connection
- Verify all features work correctly
# In your test app
pnpm unlink @walletconnect/wagmi-connector
# In the connector package
pnpm unlink --global- wagmi: ^2.0.0
- viem: ^2.0.0
- @wagmi/core: ^2.22.0
- TypeScript: >=5.0.4 (optional)
This package is built with TypeScript and includes type definitions. All types are exported from the main entry point:
import { walletConnect, type WalletConnectParameters } from '@walletconnect/wagmi-connector'Creates a WalletConnect connector instance.
projectId(required): Your WalletConnect Cloud project ID. Get one at cloud.walletconnect.comshowQrModal(optional): Whether to show the QR modal for connection. Default:trueisNewChainsStale(optional): How to handle newly added chains. Default:truetrue: Disconnect and require reconnection when new chains are addedfalse: Attempt to continue connection (may error if wallet doesn't support dynamic chains)
metadata(optional): Application metadata shown in wallet during connectionqrModalOptions(optional): Configuration options for the QR modalenableMobileFullScreen: Enable full-screen mode on mobile devices
A wagmi connector instance that can be used in createConfig.
walletConnect({
projectId: 'YOUR_PROJECT_ID',
metadata: {
name: 'My DApp',
description: 'My awesome decentralized app',
url: 'https://myapp.com',
icons: ['https://myapp.com/icon.png']
}
})walletConnect({
projectId: 'YOUR_PROJECT_ID',
showQrModal: false
})walletConnect({
projectId: 'YOUR_PROJECT_ID',
isNewChainsStale: false // Allow dynamic chain additions
})walletConnect({
projectId: 'YOUR_PROJECT_ID',
qrModalOptions: {
enableMobileFullScreen: true // Enable full-screen on mobile
}
})Make sure you've installed @walletconnect/ethereum-provider:
pnpm add @walletconnect/ethereum-providerEnsure you have the correct peer dependencies installed:
pnpm add wagmi viem @wagmi/core- Verify your WalletConnect project ID is correct
- Check that your chains are properly configured in wagmi
- Ensure your RPC endpoints are accessible
See LICENSE.md for details. This project is licensed under the WalletConnect Community License Agreement.
Portions © 2025 Reown, Inc. All Rights Reserved
This project includes code derived from wagmi, which is licensed under the MIT License. See NOTICE for full attribution details.
This package is maintained by WalletConnect. We welcome contributions! Please follow these guidelines:
-
Clone the repository:
git clone https://github.com/walletconnect/wagmi-connector.git cd wagmi-connector -
Install dependencies:
pnpm install
-
Build the package:
pnpm build
# Run tests once
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverageBefore submitting a PR, ensure your code passes all checks:
# Type checking
pnpm typecheck
# Linting
pnpm lint
# Format code
pnpm format
# Check formatting
pnpm prettier:check- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run all tests and linting checks
- Commit your changes using Conventional Commits
- Push to your fork and submit a Pull Request
This project uses Changesets for version management.
- Make your changes
- Add a changeset:
pnpm changeset
- Commit the changeset file
- When merged to main, a PR will be automatically created to bump versions and update the changelog
- Merging the version PR will automatically publish to npm
The repository uses GitHub Actions for continuous integration:
- PR Checks: Runs on all pull requests, testing build, linting, type checking, and tests on Node.js 18.x and 20.x
- Publish: Automatically publishes to npm when version PRs are merged to main
- Canary Releases: Manual workflow for publishing canary versions
Please open an issue in the repository to report bugs or request features.