You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connect metamask with QR (or wallet connect QR but with metamask mobile app)
Put other chain data to chain parameter in WalletConnectModal. If the chain is undefined, then don't put "locked chains" (the locked chains list below) in the first element of chains
Switch your metamask wallet connected chain to any chain other than the "locked chains"
Call wallet.switchChain(...) to "locked chains".
It will cause error May not specify default Metamask chain.
Locked Chains List
Eth Mainnet
Eth Sepolia
Linea
Linea Sepolia
Issue Detail
In thirdweb if the chain is not included in approved list, then the flow is:
Call wallet_addEthereumChain
Call wallet_switchEthereumChain
In this case, metamask will throw error if you try to call wallet_addEthereumChain with arg of either one of the locked chains.
Another Related Issue
As thirdweb uses @walletconnect/ethereum-provider under the hood to create the provider, I tested that library and check which chains will be included in approved list.
This library will only include the below ids as approved:
provided chainId from chain props
the current connected chain that user have in their metamask
This makes an issue where if the app is multichain, for example Sepolia and Ozean, and the app wants the user to connect to Ozean first, then we need to put Ozean as the chain props.
Which in turn will make Sepolia not included in approved list, and thirdweb will call wallet_addEthereumChain when switch chain, and throw the error.
Versions Used
How to reproduce:
chain
parameter inWalletConnectModal
. If thechain
is undefined, then don't put "locked chains" (the locked chains list below) in the first element ofchains
wallet.switchChain(...)
to "locked chains".May not specify default Metamask chain.
Locked Chains List
Issue Detail
In
thirdweb
if the chain is not included inapproved
list, then the flow is:wallet_addEthereumChain
wallet_switchEthereumChain
In this case, metamask will throw error if you try to call
wallet_addEthereumChain
with arg of either one of the locked chains.Another Related Issue
As
thirdweb
uses@walletconnect/ethereum-provider
under the hood to create the provider, I tested that library and check which chains will be included inapproved
list.This library will only include the below ids as
approved
:chain
propsThis makes an issue where if the app is multichain, for example
Sepolia
andOzean
, and the app wants the user to connect toOzean
first, then we need to putOzean
as thechain
props.Which in turn will make
Sepolia
not included in approved list, and thirdweb will callwallet_addEthereumChain
when switch chain, and throw the error.Possible Solution
From this comment from metamask's issue
We can apply this kind of behavior in the
switchChainWc
callMinimal Reproducible Example
https://github.com/teodorus-nathaniel/thirdweb-bug-reproduce
The text was updated successfully, but these errors were encountered: