We're developing a multi-chain wallet which supports a number of EVM chains. When a user in your application switches which chain they're on, I'd expect to receive a wallet_addEthereumChain (or wallet_switchEthereumChain) request, but it doesn't happen for us. I've tested and confirmed that it works with MetaMask, our provider is mostly compatible with MetaMask's provider.
I suspect that's where it's falling down for us. Our provider is a JS class, so I think methods aren't being spread onto the new ethereumFN object correctly. Is there a reason the provider is spread onto a new object like this?
We're developing a multi-chain wallet which supports a number of EVM chains. When a user in your application switches which chain they're on, I'd expect to receive a
wallet_addEthereumChain
(orwallet_switchEthereumChain
) request, but it doesn't happen for us. I've tested and confirmed that it works with MetaMask, our provider is mostly compatible with MetaMask's provider.I noticed these lines: https://github.com/anyswap/anyswap-crosschain/blob/2377e73b937519fe7015b964cad49239cf51f601/src/config/tools/methods.ts#L9-L12
I suspect that's where it's falling down for us. Our provider is a JS class, so I think methods aren't being spread onto the new
ethereumFN
object correctly. Is there a reason the provider is spread onto a new object like this?