Hi, I’m running into an issue when trying to switch chains using web3Auth.switchChain, but it seems to happen only when using the MetaMask browser extension, and only with the Arbitrum Sepolia testnet.
const switchChain = async (chain: CustomChainConfig) => {
if (!provider) {
logConsole('switchChain. provider not initialized yet')
return
}
if (!web3Auth) {
logConsole('switchChain. web3auth not initialized yet')
return ''
}
await web3Auth.addChain(chain)
await web3Auth.switchChain({ chainId: chain.chainId })
}
The chain config I’m trying to use is:
ArbitrumSepolia: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: '0x66eee',
displayName: 'Arbitrum Sepolia',
tickerName: 'ETH',
ticker: 'ETH',
rpcTarget: 'https://sepolia-rollup.arbitrum.io/rpc',
logo: '',
blockExplorerUrl: 'https://sepolia-explorer.arbitrum.io',
isTestnet: true
}
And here’s the error I’m getting:
{
"code": -32603,
"message": "l is not a function",
"data": {
"cause": {
"stack": "TypeError: l is not a function\n at n.switchChain (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background-0.js:1:67870)\n at async chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background-0.js:1:61494",
"message": "l is not a function"
}
}
}
Here are the Web3Auth SDK versions I’m using:
"@web3auth/auth-adapter": "^9.7.0",
"@web3auth/base": "^9.7.0",
"@web3auth/default-evm-adapter": "^9.7.0",
"@web3auth/ethereum-provider": "^9.7.0",
"@web3auth/no-modal": "^9.7.0",
"@web3auth/wallet-connect-v2-adapter": "^9.7.0"
Has anyone run into this before?