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:
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