WalletConnect V2 not working when on different chain than configured

When I try to connect with WalletConnectV2Adapter with Ethereum chain configured and having Polygon selected on the metamask app as current network. It connects but I cannot do a personal sign. When I try to get the chainId it always returns 0x1 but on the metamask app I’m actually on 0x89.

Tried calling wallet_switchEthereumChain but it doesn’t work either.

  • SDK Version: @web3auth/wallet-connect-v2-adapter 6.1.7
  • Platform: iOS
  • Browser Console Screenshots:
const coreAuthInstance = new Web3AuthNoModal({
      chainConfig: {
    displayName: "Ethereum Mainnet",
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: "0x1",
    rpcTarget: ".....",
    blockExplorer: "https://etherscan.io/",
    ticker: "ETH",
    tickerName: "Ethereum",
  },
      clientId,
      web3AuthNetwork: "cyan",
    });

const defaultWcSettings = await getWalletConnectV2Settings(
      chainNamespace,
      [chainId],
      this.walletConnectClientId
    );
const walletConnectV2Adapter = new WalletConnectV2Adapter({
      adapterSettings: {
        ...defaultWcSettings.adapterSettings,
        qrcodeModal: {
          open: async (uri) => {
            if (!uri) {
              return;
            }
            await this.walletConnectModal.openModal({
              uri,
              standaloneChains: [`${chainNamespace}:${chainId}`],
            });
          },
          close: () => {
            this.walletConnectModal.closeModal();
          },
        },
      },
      loginSettings: {
        ...defaultWcSettings.loginSettings,
      },
    });
coreAuthInstance.configureAdapter(walletConnectV2Adapter);
const provider = await coreAuthInstance.connectTo("wallet-connect-v2")
const ethereumWeb3Provider = new Web3Provider(provider, "any");
const signer = provider.getSigner(walletAddress);
const signed = signer.signMessage(message); // < - - BREAKS

@jayala08 Welcome Aboard!

Your issus has been forwarded to our team and we will get back with further updates once more information becomes available.

1 Like

Hey @jayala08,
Are you adding the chainId as hexadecimal or decimal format inside the getWalletConnectV2Settings? I’ll link the example here for your reference.

Hey @maharshi! Yeah, I’m adding it as number.

const chainId = 1
await getWalletConnectV2Settings(
      chainNamespace,
      [chainId],
      this.walletConnectClientId
    )
1 Like

@maharshi were you able to look into this issue?

Same problem. Have any update?