extension icon indicating copy to clipboard operation
extension copied to clipboard

adding option to choose wallet to connect

Open pedroapfilho opened this issue 2 years ago • 3 comments

This PR enables the possibility of enabling only a specific wallet if needed.

I'm creating it to be used here: https://github.com/Premiurly/polkassembly/pull/132

pedroapfilho avatar May 31 '22 03:05 pedroapfilho

Hi! Very usefull and needed addition. Actually I visited PRs page to see whether there is some PR like this one and start my own if I don't find one. Thank you, Pedro.

@jacogr hope you'll find couple of minutes to review this tiny, but very awaited PR.

Have a nice day!

fend25 avatar Jun 03 '22 21:06 fend25

@jacogr could you check this one again?

pedroapfilho avatar Aug 26 '22 15:08 pedroapfilho

Hi you guys are the writers and builders I'm on the outside looking into this multiple wallets with multiple functions creates more work costing data people time so logic tells me that humanity likes things simple with ahassle free time saving components so a wallet that can perform all of these different functions is a move in the rite direction I feel if this could be developed and phase out multiple wallets people will naturally progress towards it it may be complicated and complex but once this is in place I think benifits will be notified

Rocket19-1 avatar Sep 08 '22 18:09 Rocket19-1

Hey @jacogr is it possible for you to check this out again?

pedroapfilho avatar Nov 25 '22 09:11 pedroapfilho

This really flies in the face of what the interface is meant to be.

It is designed so that you don't need to provide the user with a dialog to select a specific provider. (This in my view is a hold-over from the old days in other environments where each had their own interface)

It is meant to happily pull in accounts from multiple providers and just allow you to use them.

jacogr avatar Nov 25 '22 16:11 jacogr

I have to agree with Jaco, sorry Pedro :heart:

Users should decide which wallet they want to use, not the dapp.

Having per-wallet connect button forces the dapp to have one button per existing wallet. it's sustainable now as there are very few polkadot compatible wallets, but it won't be in a year or two. Whether it's on purpose or because the dapp developer doesn't know about the existence of a given wallet, some users will be left out.

Enabling a specific wallet is already achievable by doing window.injectedWeb3["the-wallet-id"].enable("dapp-name"). It may not be as intuitive but still is easy enough. There's even a popular dapp right now that only allows 1 single wallet to connect (allowing to vote on which is the best wallet :joy:), this is not something that should be encouraged by the mainstream API. Let's not repeat the mistakes of the ETH ecosystem.

0xKheops avatar Nov 26 '22 12:11 0xKheops

window.injectedWeb3["the-wallet-id"].enable("dapp-name") will actually stop being available in a future version of the interfaces. Let me explain...

The window.injectedWeb3 object does "leak" information about what is available to the specific user. When everybody plays nice, not an issue, however it does show all sites what is there without the user even having taken action to enable/disable. So this needs to be more opaque until enable (or something like enable) indicates stuff is approved by the user and the underlying info is returned.

So in a future version the exposed interface will change where the keys are being hashed (and being different on each load) and the enable call will actually return the extension info. Obviously the old way will still be there for extensions that does not support it yet, however certainly for the polkadot-js extension we will move in that direction as soon as available as an option on extension-dapp and extension-inject. (This would be around January-ish, just need to get the Manifest 3 conversion done this year.)

jacogr avatar Nov 28 '22 06:11 jacogr

That's very cool! Thanks for all the explanations! I'm happy to see that we are moving away from it.

pedroapfilho avatar Nov 28 '22 10:11 pedroapfilho

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

polkadot-js-bot avatar Nov 30 '22 11:11 polkadot-js-bot