-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing or invalid. emit() chainId: eip155:11155111. & Cannot convert undefined or null to object at Function.keys (<anonymous>) #948
Comments
This issue could be due to the way the chains and optionalChains are configured in your WalletConnect V2 connector setup. Here's a step-by-step guide to resolve this issue: Understanding the Issue:Chain ID Validation: The error message Uncaught (in promise) Error: Missing or invalid. emit() chainId: eip155:11155111 suggests that the WalletConnect V2 connector is not properly handling the chain ID after the network switch. WalletConnect V2 expects a specific format and the correct chain ID to be emitted, which is not happening here. Undefined Object Conversion: The TypeError: Cannot convert undefined or null to object indicates that there's an attempt to access or manipulate a null or undefined value. This usually happens when the expected data structure isn't properly defined. Solution:Check Chain Configuration:
Ensure that MAINNET_CHAINS and TESTNET_CHAINS are defined and not empty. Emit Correct Chain ID:
Update WalletConnect V2: Handle Chain Switching Logic:
Test Different Environments: Final Code Example:
This setup should help you resolve the errors you're encountering when switching networks with WalletConnect V2 and MetaMask. Ensure all dependencies are up-to-date and test thoroughly in both mainnet and testnet environments. |
Didn't Work! @m-Jawa-d
This is how I encountered the error: Logged in using WalletConnect V2 (scanned the QR code with the MetaMask app). |
im using
"@web3-react/walletconnect-v2": "^8.5.1",
After i successfully logging in through WalletConnect from MetaMask app. when i change the network (to any supported network) in MetaMask.
these errors occurred.
walletConnectV2.ts
The text was updated successfully, but these errors were encountered: