wallet_switchEthereumChain Does not work with custom networks #5620
julia-script opened this issue · 5 comments
Apparently, wallet_switchEthereumChain
doesn't work with networks added through wallet_addEthereumChain
is this intentional?
Steps
- Add a custom network
window.rainbow.request({
"method": "wallet_addEthereumChain",
"params": [
{
"chainId": "0x2329",
"chainName": "Evmos",
"nativeCurrency": {
"decimals": 18,
"name": "Evmos",
"symbol": "EVMOS"
},
"rpcUrls": [
"http://localhost:3000/api/eth-json-rpc/evmos"
],
"blockExplorerUrls": [
"https://escan.live"
]
}
]
})
(this works, this adds the network to my wallet, it doesn't auto switch to it after that though as is the behavior in other wallets)
2. Try to switch to the network
window.rainbow.request({
"method": "wallet_switchEthereumChain",
"params": [
{
"chainId": "0x2329",
}
]
})
I get the following error
{
"name": "Invalid Request",
"message": "Chain Id not supported",
"code": -32600
}
digging the code a little bit it seems that only what's in this list here is supported, is that correct?
wallet_addEthereumChain
seems to check for a featureFlags.custom_rpc
flag, but wallet_switchEthereumChain
right below it doesnt
https://github.com/rainbow-me/provider/blob/586aa46965b41173bd071d7ca2bdccf70ef10b0c/src/handleProviderRequest.ts#L239
this was fixed yesterday, coming out in the next release
thanks for the report 🚀
oh, that was a quick one, thanks :)
Quick question, when is next release scheduled to?
This fix was released on 04/17 with v1.4.65. Let us know if any issues persist!