getAlby / bitcoin-connect

Connecting lightning wallets to your webapp has never been easier. Enable WebLN in all browsers with a single button
https://bitcoin-connect.com
MIT License
83 stars 29 forks source link

Programmatically access what connector the user is connected to #177

Closed rolznz closed 8 months ago

rolznz commented 8 months ago

In the modal we show what connector you're connected to. But you can't access it from outside.

For example with LNbits there stacker news could show "Connected with LNbits". I'm not sure if showing the hostname is good, because that is specific to LNbits and not other connectors. But we could expose some extra info about the current connector in a generic way?

I think it makes more sense to add a function in Bitcoin Connect rather than expose extra info in WebLN (because it is more about the connector than WebLN?)

image

ekzyis commented 8 months ago

For example with LNbits there stacker news could show "Connected with LNbits".

Yeah, something like this (or exactly this) would be great!

I'm not sure if showing the hostname is good, because that is specific to LNbits and not other connectors.

You're right, I am also not sure.

I think it makes more sense to add a function in Bitcoin Connect rather than expose extra info in WebLN (because it is more about the connector than WebLN?)

I agree

bumi commented 8 months ago

isn't that already possible because I can access the underlaying provider of the webln object? So I can ask the provider?

rolznz commented 8 months ago

@bumi we only have access to the alias from WebLN.

In the Bitcoin Connect modal we show the connector name (which comes from the connector config)

image

I think we could add an api call getConnectorName().

rolznz commented 8 months ago

Add getConnectorConfig to the api, and also push a WebLN spec. (maybe the provider name could be returned in getInfo or something else)

Adding more functions makes the API more complicated and less clear.

Ideally the Bitcoin Connect API should expose a Bitcoin Connect provider class (which could hold a config and webln provider etc.), rather than global functions - something to think about for the next major version.