Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/select web3 extension #1382

Conversation

AleksandrRadik
Copy link

Hi there guys! I working on one of Web3 app for staking using dApp, and we wanna add possibility for staking Polkadot on our validators for user with there web3 wallets. But I meet some problem:
Imagine that user have two extension which can injected in dApp (Polkadot.js & SubWallet for example) and when we call web3Enable func it start authorization to all of them, it's some not clear for user (why you need all my extension??) and some harder to develop for developers. So, I propose add new func which return all available extensions for developer and he can shown list for user, and user can choose one only. And of course add new args for web3Enable method for enable only one of extenstion.
Hope you accept this, thank's for your attention, time, and work, Polkadot is amazing project and we belive in big success of it in future))

@Tbaut
Copy link
Contributor

Tbaut commented Jul 1, 2024

Thank you for your PR, but I will close because this is already possible, since front-end devs can read the extensions available and call enable for a selected one. There are also tools such as https://github.com/TalismanSociety/talisman-connect/tree/master/packages/connect-wallets that make this even simpler.

@Tbaut Tbaut closed this Jul 1, 2024
@AleksandrRadik
Copy link
Author

AleksandrRadik commented Jul 1, 2024

Thanks for you reply! @Tbaut
What you mean front-dev read and enable?
Just call window.InjectedWeb3 and there in object call enable method? Oh there are exist others methods? Because in this way, webEnablePromise object will undefined and all other methods will be unavailable?
And also thank you for provided package for this task ^^

@Tbaut
Copy link
Contributor

Tbaut commented Jul 1, 2024

The window.InjectedWeb3 is an object with injected extensions by name. Each entry has an enable function.
What the package I linked proposes to do is create a modal with a list of the available extensions, allows to download them if not present, and if users have certain extensions available, then enable just the one that users select with window.injectedWeb3['{extension-name}'].enable.
image

@AleksandrRadik
Copy link
Author

Okay, I got it.
As I understand, if I wanna exclude multiple popup for auth to few extenstion, I need to write my own logic working with windows.InjectedWeb3 object?
Cause If i follow your instruction, when I enable only one wallet myself it's not setting web3EnablePromise object which needed in all other's methods like web3Accounts(), web3FromSource() etc.?
image
P.S. I check TalismanConnect package it's look good, and I think i can reuse this, cause they write there own logic for working with window.InjectedWeb3 object, they just have list of supported extnestion is good. Now I wanna understand how I can use @polkadot/extension-dapp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants