I'm having a hard time migrating from my Dapp using walletconnect to walletconnect v2.
I was originally using the version below. "@web3-react/core": "^6.1.9", "@web3-react/walletconnect-connector": "^6.2.13",
The original code is below.
- connectoer.js
import { WalletConnectConnector } from "@web3-react/walletconnect-connector";
export const WalletConnect = new WalletConnectConnector({
rpcUrl: `${process.env.REACT_APP_INFURA}`,
bridge: "https://bridge.walletconnect.org",
qrcode: true,
supportedChainIds: [1],
});
- walletconnect.js
import { useWeb3React } from "@web3-react/core";
import { WalletConnect } from "../../../lib/connectors";
const { activate } = useWeb3React();
async function connectWalletHandler() {
const provider = WalletConnect;
}
try {
await activate(provider);
} catch (error) {
console.log(error);
}
}
I tried to convert the connector in various ways by looking at the official documentation of walletconnect, but failed.
Is there any good way? :(
I tried the methods suggested in the official documentation, but all failed.
https://docs.walletconnect.com/2.0/advanced/migration-from-v1.x/dapps#web3-react