-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
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
Labels
No labels