web3-react icon indicating copy to clipboard operation
web3-react copied to clipboard

WalletConnect v2 doesn't support optional chains - Make sure default chain is included in "chains"

Open torreyatcitty opened this issue 2 years ago • 6 comments

See the example app here: https://web3-react-mu.vercel.app/

If you try to select any other chain under walletConnectV2 besides mainnet you see the following error:

Error: Invalid chainId 10. Make sure default chain is included in "chains" - chains specified in "optionalChains" may not be selected as the default, as they may not be supported by the wallet.

torreyatcitty avatar Jun 29 '23 21:06 torreyatcitty

+1, I am just trying to connect the Polygon testnet to the MetaMask mobile app, but the Polygon testnet is available. However, I am still encountering an error.

gurukishore111 avatar Jul 11 '23 15:07 gurukishore111

@torreyatcitty @gurukishore111 in chains.ts you can add the following to be used for the WalletConnectV2 chainIds for it to work properly.

export const DEFAULT_MAIN_CHAINS = [
  // mainnets
  "eip155:1",
  "eip155:10",
  "eip155:100",
  "eip155:137",
  "eip155:324",
  "eip155:42161",
  "eip155:42220",
  "cosmos:cosmoshub-4",
  "solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",
  "polkadot:91b171bb158e2d3848fa23a9f1c25182",
  "mvx:1",
  "tron:0x2b6653dc",
  "tezos:mainnet",
  "kadena:mainnet01",
];

export const DEFAULT_TEST_CHAINS = [
  // testnets
  "eip155:5",
  "eip155:280",
  "eip155:420",
  "eip155:80001",
  "eip155:421611",
  "eip155:44787",
  "solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K",
  "polkadot:e143f23803ac50e8f6f8e62695d1ce9e",
  "near:testnet",
  "mvx:D",
  "tron:0xcd8690dc",
  "tezos:testnet",
  "kadena:testnet04",
];

export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS];

reference: https://github.com/WalletConnect/web-examples/blob/main/dapps/react-dapp-v2/src/constants/default.ts

rayQuadrata avatar Jul 20 '23 16:07 rayQuadrata

@rayQuadrata, thanks for the reply. I have added those chain IDs in the format recommended by web3-react link. However, it's still throwing the same issue.

gurukishore111 avatar Jul 23 '23 12:07 gurukishore111

@rayQuadrata, thanks for the reply. I have added those chain IDs in the format recommended by web3-react link. However, it's still throwing the same issue.

@gurukishore111 as you can see from the web3-react example, the format provided results in an error. However, if you use the format list in my example above, you can select the other networks for WallConnectV2. This alternate format is only for WalletConnectV2

rayQuadrata avatar Jul 25 '23 17:07 rayQuadrata

same issue

damianlluch avatar Feb 26 '24 15:02 damianlluch