Wallet Connect V2 Error Connecting to OTHER chain

Does the Wallet Connect add-on support “other” chains (i.e. Polkadot/Substrate based chains). I’m getting Error: Unsupported chain namespace: other when trying to init web3 Wallet Connect add-on as per the docs here.

  • SDK Version:
    @walletconnect/modal”: “^2.6.2”,
    @walletconnect/sign-client”: “^2.10.2”,
    @web3auth/base”: “^7.3.1”,
    @web3auth/no-modal”: “^7.3.1”,
    @web3auth/openlogin-adapter”: “^7.3.1”,
    @web3auth/wallet-connect-v2-adapter”: “^8.0.1”,
  • Platform: nextJS 13.4.19
  • Browser Console Screenshots:
    Screenshot 2024-03-06 at 12.08.36 AM

I had to use a workaround because I’m working in nextJS and SSR was causing an issue with Wallet Connect it seems so hence if (typeof window !== "undefined") inside the useEffect hook. If there is a better way to do this please advise.

Below is my web3 init code

useEffect(() => {
    const init = async () => {
      if (typeof window !== "undefined") {
        const { WalletConnectModal } = require("@walletconnect/modal");
        const {
          WalletConnectV2Adapter,
          getWalletConnectV2Settings,
        } = require("@web3auth/wallet-connect-v2-adapter");

        const defaultWcSettings = await getWalletConnectV2Settings(
          CHAIN_NAMESPACES.OTHER,
          ["0x1"],
          "*projectID*",
        );
        const walletConnectModal = new WalletConnectModal({
          projectId: "*projectID*",
        });
        const walletConnectV2Adapter = new WalletConnectV2Adapter({
          adapterSettings: {
            qrcodeModal: walletConnectModal,
            ...defaultWcSettings.adapterSettings,
          },
          loginSettings: { ...defaultWcSettings.loginSettings },
        });
        if (web3WalletConnect) {
          web3WalletConnect.configureAdapter(walletConnectV2Adapter);
        }
        setIsReady(true);
      }
    };
    init();
  }, [web3WalletConnect]);

chain config code:

export const chainConfig = {
  chainNamespace: CHAIN_NAMESPACES.OTHER,
  chainId: "0x1",
  rpcTarget: "https://rpc.polkadot.io/",
  displayName: "Polkadot Mainnet",
  blockExplorer: "https://explorer.polkascan.io/",
  ticker: "DOT",
  tickerName: "Polkadot",
};

note: I tried connecting without calling getWalletConnectV2Settings but then I get a chain mismatch because it defaults to EIP155

Thank you

welcome @rob :slight_smile:

Your issue has been forwarded to our Dev team and we will get back with further updates.

hi @rob,

would you mind updating all the web3auth libraries to v8 and try again?

@web3auth/base”: “^8.0.0”,
@web3auth/no-modal”: “^8.0.1”,
@web3auth/openlogin-adapter”: “^8.0.1”,

Sorry to inform that Wallet Connect v2 Adapter only supports CHAIN_NAMESPACES.EIP155

Ahh, okay thanks @TomTom for the update. Your team might want to update to the docs to let other devs know it’s not supported on other chains.

Thanks for the suggestion, I will report it !

Getting this error on walletconnectv2 and I am connecting polygon mainnet

client.js:26 Error while connecting to adapter: wallet-connect-v2 WalletLoginError: Failed to connect with wallet. Failed to login with wallet connect: Unsupported chains.

hi @lazygamestech

I hope you are doing well today.

Can you tell me the versions and the packages that you are using ?

@walletconnect/sign-client”: “^2.13.1”,
@web3-onboard/metamask”: “^2.0.3”,
@web3-onboard/react”: “^2.8.14”,
@web3auth/default-evm-adapter”: “^8.6.2”,
@web3auth/ethereum-provider”: “^8.6.1”,
@web3auth/metamask-adapter”: “^8.6.1”,
@web3auth/modal”: “^8.6.1”,
@web3auth/modal-react-hooks”: “^8.6.1”,
@web3auth/wallet-services-plugin”: “^8.6.1”,

Is this helpfull ?

yes , that’s ok. You can update all the web3auth packages to v8.6.2 if you want to.

Also Can you share with me some code snippets?

const selectedChain = 0;
const chainConfigs = [
{
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: “0x89”,
chainCode: 137,
rpcTarget: process.env.NEXT_PUBLIC_RPC_MATIC,
displayName: “Polygon”,
blockExplorerUrl: “https://polygonscan.com/”,
ticker: “MATIC”,
tickerName: “Polygon”,
userRegistry: “0x55986780342c3683C654384d76c815ACfB9292a9”,
paymasterKey: process.env.NEXT_PUBLIC_PAYMASTER_KEY_MATIC,
bundler: process.env.NEXT_PUBLIC_BUNDLER_MATIC
},
{
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: “0xC4”,
chainCode: 196,
rpcTarget: process.env.NEXT_PUBLIC_RPC_X_MAIN,
displayName: “Layer X Mainnet”,
blockExplorerUrl: “X Layer Explorer | Blockchain Explorer | OKLink”,
ticker: “OKB”,
tickerName: “OKB”,
userRegistry: “0x2f5CC68ad8E94cFC68F71A34Da7E606AF43c498e”,
paymasterKey: process.env.NEXT_PUBLIC_PAYMASTER_KEY_X_MAIN,
bundler: process.env.NEXT_PUBLIC_BUNDLER_X_MAIN,
}
];
const web3authInstance = new Web3Auth({
privateKeyProvider: privateKeyProvider,
clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENTID,
web3AuthNetwork: process.env.NEXT_PUBLIC_WEB3AUTH_NETWORK,
sessionTime: (86400 * 7),
uiConfig: {
appName: “Lazy Games”,
mode: “dark”,
loginMethodsOrder: [“google”],
logoLight: “https://web3auth.io/images/web3auth-logo.svg”,
logoDark: “https://web3auth.io/images/web3auth-logo---Dark.svg”,
defaultLanguage: “en”,
loginGridCol: 3,
primaryButton: “socialLogin”,
},
});
const adapters = await getDefaultExternalAdapters({ options: {
clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENTID,
chainConfig : { …chainConfigs[selectedChain], chainNamespace : CHAIN_NAMESPACES.EIP155},
privateKeyProvider: privateKeyProvider,
web3AuthNetwork: process.env.NEXT_PUBLIC_WEB3AUTH_NETWORK,
} });

  adapters.forEach((adapter) => {
    web3authInstance.configureAdapter(adapter);
  });
  // web3authInstance.configureAdapter(metamaskAdapter);
  await web3authInstance.initModal();
  if (!web3authInstance) {
    return
  }
  let web3authProvider = web3auth.provider;
  if (!web3authInstance.connected) {
    try {
      web3authProvider = await web3authInstance.connect();
    } catch (error) {
      if (error.message === "User closed the modal") {
        console.error("User closed the modal. Please try again.");
        return;
      } else {
        console.error("An error occurred:", error);
        return;
      }
    }
  }

Also demo example from web3auth is also not working on the mobile metamask connect with walletconnect v2. I have scanned QR code from metamask and it results in the same error

Hi @lazygamestech,

Thank you for reporting this issue. It is working fine with Rainbow wallet, but it is throwing an error with mobile Metamask. I will address this with our team and provide an update soon.

Thanks

Also is there any way we can connect to mobile metamask from the mobile browser ?

Using regular metamask adapter works on system and not on mobile so we are kind of stuck at that level and for that reason we used walletconnect and walletconnect also has issue.

So is there any workaround to it ?

hi @lazygamestech,

I believe your best option currently is to use WalletConnect.

While our team is addressing the issue, Is it possible for you to use the Rainbow wallet on your mobile device?

Any TAT for the fixes ? We are using it on production and needs to be addressed soon

We are looking to integarate the Walletconnect ourselves outside web3auth to resolve this issue.

If you provide TAT for the fix, we will take a decission to continue with the implementation walletconnect outside or wait for it

It is critical for us and we are looking to go big on the marketing and promotion

hi @lazygamestech,

Please give me one day to give you an estimate time.

Any update on this please

@lazygamestech Thanks for your patience.

Please give me sometime to check back with our Dev team and provide an update.

Hi @lazygamestech,

We estimate that it will be resolved by Tuesday.

Is that suitable for you?

Thanks for the patience.