🚫
WalletConnect v1 has been sunset. You must migrate to the WalletConnect v2 Connector before June 28, after which, this Connector will be removed.
WalletConnect Legacy
The WalletConnectLegacyConnector
uses WallectConnect v1 by default and 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 { WalletConnectLegacyConnector } from '@wagmi/core/connectors/walletConnectLegacy'
Usage
import { WalletConnectLegacyConnector } from '@wagmi/core/connectors/walletConnectLegacy'
const connector = new WalletConnectLegacyConnector({
options: {
qrcode: true,
},
})
Configuration
chains (optional)
Chains supported by app. Defaults to defaultChains
.
import { mainnet, optimism, polygon } from '@wagmi/core/chains'
import { WalletConnectLegacyConnector } from '@wagmi/core/connectors/walletConnectLegacy'
const connector = new WalletConnectLegacyConnector({
chains: [mainnet, optimism, polygon],
options: {
qrcode: true,
},
})
- The above example is using chains from
@wagmi/core/chains
. - Upon connection, the connector will connect to the previously connected chain unless otherwise specified by a
chainId
config on useConnect.
options
projectId (optional)
WalletConnect Cloud Project ID. Required for WalletConnect v2. You can find your Project ID here.
import { WalletConnectLegacyConnector } from '@wagmi/core/connectors/walletConnectLegacy'
const connector = new WalletConnectLegacyConnector({
options: {
qrcode: true,
projectId: '...',
},
})
Other options
You can pass through options supported by the WalletConnect v1 WalletConnectProvider
or the WalletConnect v2 UniversalProvider
:
import { WalletConnectLegacyConnector } from '@wagmi/core/connectors/walletConnectLegacy'
const connector = new WalletConnectLegacyConnector({
options: {
qrcode: true,
rpc: {
1: 'https://eth-mainnet.alchemyapi.io/v2/yourAlchemyId',
},
},
})