web3-react
web3-react copied to clipboard
WalletConnect failed with ^8.0.35-beta.0
I tried to connect with WalletConnect but it failed to connect
Error on wallet connect Error: WebSocket connection failed for URL: wss://relay.walletconnect.com?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtoelhxTXJiYmFVR3U5aENadTdoN0NOZmNZZFdnN3lFWWRYNlVtTFVHOHUzSyIsInN1YiI6Ijg0ZjQwMzc2OTNjMmQ4MWNhMzVmN2E2MWJlMWNmNTUzYzY0OGRmNTczNzc3YzIyM2Q5ODJiYTBjZDQyMzIwMjgiLCJhdWQiOiJ3c3M6Ly9yZWxheS53YWxsZXRjb25uZWN0LmNvbSIsImlhdCI6MTY3MDUwOTk1OSwiZXhwIjoxNjcwNTk2MzU5fQ.R3AYpXN0kOBJRfcVrkbjOgfsd3SaatELuPQPdHgD_lm-6vF_bEzij0eV9k6N9QOZnb-Vg5-gAO9JTZo4tYkOCQ&ua=wc-2%2Fjs-2.1.3%2Fmacos-chrome-107.0.0%2Fbrowser%3Alocalhost%3A3000
at socket.onerror (ws.js?dc4f:99:1)
I was able to connect metamask and coinbase wallet without any issues
Here are versions I use
"@web3-react/coinbase-wallet": "^8.0.34-beta.0",
"@web3-react/core": "^8.0.35-beta.0",
"@web3-react/metamask": "^8.0.28-beta.0",
"@web3-react/walletconnect": "^8.0.36-beta.0",
Here is the code piece for walletConnect connector initialization
export const [walletConnect, walletConnectHooks] = initializeConnector<WalletConnect>(
(actions) =>
new WalletConnect({
actions,
options: {
rpc: { 1: [`https://mainnet.infura.io/v3/${process.env.NEXT_PUBLIC_INFURA_ID}`] },
bridge: 'https://bridge.walletconnect.org',
qrcode: true,
supportedChainIds: [1],
},
defaultChainId: 1,
}),
);
Can I get some help on this?
I encountered the same issue. Here's some trace
TypeError: Cannot read properties of undefined (reading 'on')
at WalletConnect.eval (index.js?6bf5:105:1)
at Generator.next (<anonymous>)
at fulfilled (index.js?6bf5:28:43)
this.provider.connector.on('display_uri', this.URIListener);
Further investigation suggests that @walletconnect/ethereum-provider v2 introduced breaking changes. We need to rework the connection.
Current workaround: Use v1
- "@walletconnect/ethereum-provider": "^2.1.4",
+ "@walletconnect/ethereum-provider": "^1.7.5",
Thought wallet connect v1 is depreceted
https://github.com/MetaMask/metamask-mobile/issues/3914#issuecomment-1342335554