Add `wallet_` methods to improve dapp to wallet interaction

I would like to follow up on the proposed method wallet_changeChain to update the name to wallet_updateChain and include the following parameters suggested by @danfinlay on an earlier discussion last week on Twitter

The suggested parameters are: chainId, networkId, rpcUrl, nativeCurrencyName.

A JSON RPC request would look like the following for requesting the user to add/connect to a xDai remote node:

{
  "id":1,
  "jsonrpc": "2.0",
  "method": "wallet_updateChain",
  "params": [{ "chainId": 100, "networkId": 1, "rpcUrl": "https://dai.poa.network", "nativeCurrencyName": "xDAI"  }]
}

This would provide a Stateless Dapp like for example @austingriffith’s Burner Wallet a better UX to quickly request within the Wallet to switch the chain/network/node that the Dapp wishes to connect.

Austin has already quick fix for this by displaying a popup to easily guide the user to change the chain on Metamask.

This pattern is very common in a lot of Dapps and this simple JSON RPC request can improve the UX dramatically.

I was planning to include this as a WalletConnect-specific method within the v1.0 SDK but I think this would be more beneficial as a standard that can be shared with other Wallet patterns like Metamask, Ledger, etc

3 Likes