anyswap-crosschain
anyswap-crosschain copied to clipboard
Our injected Ethereum provider never gets the 'wallet_addEthereumChain' request
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 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?