I've been trying to integrate WalletConnect by following this documentation of web3-react.
The configuration that I'm using for the connector is as follows:
import { WalletConnectConnector } from '@web3-react/walletconnect-connector';
export const walletconnect = new WalletConnectConnector({
rpc: { 1: RPC_URLS[1], 4: RPC_URLS[4] },
infuraId: INFURA_TOKEN,
bridge: BRIDGE_URL,
qrcode: true,
pollingInterval: 15000,
});
Also, the versions of packages are as follows:
"@web3-react/core": "^6.0.9",
"@web3-react/walletconnect-connector": "^6.2.0",
When I use the activate
function from useWeb3React()
as explained in below code:
const { connector, activate, active, account } = useWeb3React();
activate(walletconnect, undefined, true)
.catch((error) => {
if (error instanceof UnsupportedChainIdError) {
activate(walletconnect)
} else {
console.log('Pending Error Occured')
}
})
It was able to generate QR Code, also I was able to successfully scan through MetaMask app on my Mobile Phone and on the mobile app it shows successfully connected.
Though, on the console logs of the Web App it shows a warning saying
Warning: Suppressed stale connector activation [object Object]
Thus, It fails to receive address inside the account
variable.
Important Note: I'm using the similar code with InjectedConnector
and it is working perfectly fine for MetaMask.
Though the above problem also appears with other wallets. These are the wallets I am facing the problem with:
Any advice will help me a lot.
Click on the scan icon in the top right corner and scan the QR code. A window will pop-up at the bottom of the screen and prompt you to connect to the DApp. Click Connect. If you were able to successfully connect, you will see a pop-up in MetaMask that says Connected to Moonbeam WalletConnect Demo App.
WalletConnect is a bridge that connects Decentralized Applications (DApps) to your Bitcoin.com Wallet. Once you've approved a connection request from the DApp (via WalletConnect), the DApp can send transaction requests to your Bitcoin.com Wallet, which you must also manually approve in the Wallet.
I have also faced the same issue when I was developing tagprotocol.com , however I have solved it in two ways :
Calling the activate function multiple times in subsequent lines ( Sounds weird I know )
Setting a delay on calling the activate function, something like this
setTimeout(() => activate(...), 500)
Im not sure about your code structure so I dont know to what extend this helps. But stale connector object issue is something that I have resolved using the above two methods. Let me know in the comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With