Skip to content

Missing or invalid. emit() chainId: eip155:11155111. & Cannot convert undefined or null to object at Function.keys (<anonymous>) #948

@kamal9494

Description

@kamal9494

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.

Uncaught (in promise) Error: Missing or invalid. emit() chainId: eip155:11155111
    at ps.isValidEmit (index.ts:54:1)
Uncaught (in promise) TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Yt (index.ts:54:1)
    at un (index.ts:54:1)
    at ps.isValidUpdate (index.ts:54:1)

walletConnectV2.ts


import { initializeConnector } from '@web3-react/core';
import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2';

import { MAINNET_CHAINS, URLS } from '../web3-react-utils/chains';

import { TESTNET_CHAINS } from '../web3-react-utils/chains';
import { ALLOWED_NETWORK_ID, ENVIRONMENT } from '../constants';

const [mainnet, ...optionalMainnetChains] =
  Object?.keys(MAINNET_CHAINS).map(Number);

const [testnet, ...optionalTestnetChains] =
  Object?.keys(TESTNET_CHAINS).map(Number);

const projectId =
  ENVIRONMENT !== 'testnet'
    ? 'mainnet_id'
    : 'testnet_id';

export const [walletConnectV2, hooks] = initializeConnector<WalletConnectV2>(
  (actions) =>
    new WalletConnectV2({
      actions,
      // defaultChainId: ALLOWED_NETWORK_ID,
      options: {
        projectId: projectId,
        chains: [ENVIRONMENT === 'mainnet' ? mainnet : testnet],
        showQrModal: true,
        optionalChains:
          ENVIRONMENT === 'mainnet'
            ? optionalMainnetChains
            : optionalTestnetChains,
        rpcMap: URLS,
        rpc: URLS,
      },
    })
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions