• React
  • Connectors
  • WalletConnect

WalletConnect

The WalletConnectConnector wraps the WalletConnect Ethereum Provider and supports its configuration options. This is a great option for adding support for many wallets to your app.

import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'

Usage

import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'
 
const connector = new WalletConnectConnector({
  options: {
    qrcode: true,
  },
})

Configuration

chains (optional)

Chains supported by app. Defaults to defaultChains.

import { mainnet, optimism } from 'wagmi/chains'
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'
 
const connector = new WalletConnectConnector({
  chains: [mainnet, optimism],
  options: {
    qrcode: true,
  },
})

Note: Upon connection, the connector will connect to the previously connected chain unless otherwise specified by a chainId config on useConnect.

options

version (optional)

Version of WalletConnect to use. Defaults to 1.

import { WalletConnectConnector } from '@wagmi/core/connectors/walletConnect'
 
const connector = new WalletConnectConnector({
  options: {
    qrcode: true,
    version: '2',
    projectId: '...',
  },
})

projectId (optional)

WalletConnect Cloud Project ID. Required for WalletConnect v2. You can find your Project ID here.

import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'
 
const connector = new WalletConnectConnector({
  options: {
    qrcode: true,
    version: '2',
    projectId: '...',
  },
})

Other options

You can pass through options supported by the WalletConnect v1 WalletConnectProvider or the WalletConnect v2 UniversalProvider:

import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'
 
const connector = new WalletConnectConnector({
  options: {
    qrcode: true,
    rpc: {
      1: 'https://eth-mainnet.alchemyapi.io/v2/yourAlchemyId',
    },
  },
})