hirosystems / connect

A library for building excellent user experiences with Stacks.
https://connect.stacks.js.org
MIT License
76 stars 40 forks source link

Resolve StacksProvider conflict across wallets #325

Closed markmhendrickson closed 9 months ago

markmhendrickson commented 1 year ago

Currently wallets that use StacksProvider such as Hiro and Xverse experience collisions whenever both are installed and using apps that have integrated Connect since the library doesn't have a way to distinguish between each wallet when the user wants to perform actions with them (e.g. connect, transact).

Developers and users alike would benefit from having the library distinguish them somehow so that only the wallet of choice is incurred for the particular app session, even if multiple remain installed and activated.

Hiro exposes HiroWalletProvider as well which may be helpful for supporting such an enhancement.

Screenshot 2023-07-17 at 15 55 48
janniks commented 1 year ago

💯

I'd like to see Connect try to implement a .providers array, where wallets can register their named providers. (something similar has been discussed in a working group)

Anatolie commented 1 year ago

+1! Would like to be able to trigger a specific wallet extension (ie: Hiro) when performing actions such as PSBT + message signing!

janniks commented 1 year ago

I think we could add a quick fix to allow web devs to target a specific wallet using connect. Basically let most functions take in the provider directly, rather than guessing/taking the main one

janniks commented 1 year ago

1st pass to allow web apps to pass a known stacks provider (up to them to select the one they want etc.) #326

RobertClarke commented 1 year ago

Reproducible across all the major Ordinals Marketplaces!

markmhendrickson commented 1 year ago

@RobertClarke Might your team want to try integrating the branch here to confirm it works on your end pre-release? https://github.com/hirosystems/connect/pull/326

janniks commented 1 year ago

Reopening this for further improvements. The first pass fixed #320

markmhendrickson commented 1 year ago

Curious which improvements you have in mind, and whether we should hold off asking developers to upgrade their integrations or is that effort good to go with the first pass?

janniks commented 1 year ago

Would like to test out a .provider interface where wallets register their presence and connect would use it to allow users to select their choice and route requests to the custom provider. But for now I'd recommend going with what we have already, since it might take a while for wallets to adopt any new experiments.

ThomAille commented 1 year ago

I am implementing Stack/Connect to allow my users to connect either with Hiro or Xverse, to avoid the integration of several libraries, I only use this one.

For once Hiro it's easy I push HiroWalletProvider in showConnect on the other hand for xverse I have explored windows in vain I can't find a specific provider for it. For once, send you what as info for xverse?

janniks commented 1 year ago

cc @m-aboelenein is Xverse thinking about adding a similar custom provider? Maybe we should discuss this in the wallet api standards group?

dawasherpa-ui commented 11 months ago

cc @m-aboelenein is Xverse thinking about adding a similar custom provider? Maybe we should discuss this in the wallet api standards group? in the authOptions what the provider name of xverseWallet?

janniks commented 11 months ago

@fess-v feel free to leave you ideas here as well. Curious to hear all sides 🙂

m-aboelenein commented 11 months ago

I am implementing Stack/Connect to allow my users to connect either with Hiro or Xverse, to avoid the integration of several libraries, I only use this one.

For once Hiro it's easy I push HiroWalletProvider in showConnect on the other hand for xverse I have explored windows in vain I can't find a specific provider for it. For once, send you what as info for xverse?

Hello @ThomAille in the latest version of xverse we have added a custom provider you can find it under window.XverseProviders.StacksProvider

janniks commented 9 months ago

Closed by #341