floating / frame

System-wide Web3 for macOS, Windows and Linux
https://frame.sh
GNU General Public License v3.0
1.07k stars 150 forks source link

Feature: support wallet_switchNetworkRpcProvider for Omnichain support #1542

Open sambacha opened 1 year ago

sambacha commented 1 year ago

wallet_switchNetworkRpcProvider

EIP Proposal draft:wallet_switchNetworkRpcProvider

The wallet_switchNetworkRpcProvider RPC method allows Ethereum applications ("dapps") to request that the wallet switches its active RPC Provider backend if the wallet has a concept thereof.

The caller MUST specify a chain ID. The caller MUST specify a valid URL for the RPC Endpoint

The wallet application may not arbitrarily refuse or accept the request. A status code of 200 is returned if the active RPC was successfully switched, A status code of [TODO] otherwise.

Important cautions for implementers of this method are included in the Security Considerations section.

Motivation

The purpose wallet_switchNetworkRpcProvider is to provide dapps with a way of requesting to switch the wallet's active chain's RPC Provider, which they would otherwise have to ask the user to do manually.

Existing EIP Specifications do not service this end

updatedEthereumChain specifies that the "...Wallet should default the rpcUrl to any existing endpoints matching a chainId known previously to the wallet, otherwise it will use the provided rpcUrl as a fallback."

wallet_switchNetworkRpcProvider intentionally and explicitly is purely concerned with switching the active RPC endpoints, regardless of any other metadata associated therewith.

solves https://github.com/floating/frame/issues/1536 & https://github.com/floating/frame/issues/1501

This would ensure that Omnichain support is guaranteed

nickadamson commented 1 year ago

I update Frame recently, from v0.5.0-beta.22, and switching networks worked as expected in that version. Not sure if it's the app or the browser extension.

goosewobbler commented 1 year ago

@nickadamson This is a feature request for dapps being able to request a switch of RPC provider - not related to switching chains, which is already covered by wallet_switchEthereumChain.

goosewobbler commented 1 year ago

@sambacha I'll discuss this with the team, I think the idea is a good one but the draft could be more complete.

Regarding the "solved" issues - I don't think these issues will be solved by wallet_switchNetworkRpcProvider. #1501 is to do with an issue we fixed in Frame around a flaky Mainnet RPC connection causing extension connection issues (we have an extension release to make before this can be considered fully fixed), and #1536 is about splitting traffic between different RPCs.