Awesome, thanks for writing this up. I think we could move to another thread, but before we do:
What if the provider could return another provider, allowing Dapps to potentially maintain connections to multiple blockchains at once?
This also limits possible errors related to specifying the wrong network when sending a transaction (which funnily enough, you presented a solution for in another thread by adding a network/chain ID parameter to the sendTransaction method ), clearly a pain you’re hitting as a dapp dev, and that’s the gold of our developer experience, so I’m really eager to add this.
We need to also consider that concern about price feeds. It may be beyond the scope of this initial proposal, and maybe we make-do without exchange rates on custom networks for a while. If we do want to provide a permission for providing a price feed, we will probably want it to use a syntax that can allow for exchange rates pegged to any of the user’s known-priced currencies.
Clients need to do some validation here, because if a dapp can suggest chainId then there’s a replay attack vector if they can suggest a chain ID that the user already uses.
There’s also a UX opportunity for the client, to potentially show the new network’s currency alongside other currencies, as “selected network” becomes increasingly abstracted away from the UI.
This method’s parameters should also be built into the
provider.enable() method’s parameters (which I’m thinking of also exposing as
wallet_enable()). This would allow the network suggestion to be unified with the account request.
Naturally on that screen we’re going to need to allow account selection, and that login could potentially only be permitted to send transactions on behalf of that requested/approved network.
In fact, the account-on-network is maybe the most important part, since if you wanted to read from this provider you’d just be doing it. What this is really about is making the user aware of a new account they have, with a new base currency, and potentially making it easy to transfer funds into it.
Okay that’s enough thoughts for now!