stackernews / stacker.news

Internet communities that pay you Bitcoin
https://stacker.news
MIT License
419 stars 106 forks source link

Add WebLN #35

Closed huumn closed 3 years ago

huumn commented 3 years ago

Wallet providers use a protocol (https://webln.dev/) to make sending lightning payments less cumbersome is my understanding. It'd be nice to support this.

bumi commented 3 years ago

I was thinking of the most simple WebLN integration. (so without changing the concept that the user has an account and a balance).

we could simply check for webln on the QR topup page: https://github.com/stackernews/stacker.news/compare/master...bumi:webln?expand=1 (pseudo code - because I could not run it)

the idea is, that it checks of WebLN is available, if so it hands over to WebLN. if NOT it shows the current flow with the QR code

huumn commented 3 years ago

Thanks for this! This is roughly the level of change required to support WebLN? Much less work than I thought

bumi commented 3 years ago

Yeah, just call some JS instead of showing a QR code. + some error handling (and showing the QR code in the error case)

huumn commented 3 years ago

Right on, I'll reprioritize this. Might be able to cram it in today even.

bumi commented 3 years ago

Let me know if you have questions. I am happy to help (you can also find me in the bitcoin design slack)

huumn commented 3 years ago

Hey @bumi, deployed this. SN now supports both fund and withdrawals through WebLN. Tested it with Joule - seems to work well. Thanks for giving me the push!

Lmk if you have any gripes.

bumi commented 3 years ago

whoop whoop! you're fast. works great! 🎉 :shipit: Though I would only show the QR code if WebLN is NOT available or the WebLN request fails. - I find doing both a bit confusing...

is there a reason why you do it like this? (In my code I tried to do that with the useWebln state.)

huumn commented 3 years ago

I don't disagree but a blank page is also confusing - in a different way. This is just version get.it.done. On my MacBook Air the popup from Joule covers most of the page, so it also didn't seem too confusing too. Up to changing it though if your experience differs significantly.

bumi commented 3 years ago

I'd show a loading spinner instead.

Our extension currently pretty quickly closes the popup after confirmation and it takes a second until the payment is done. So I guess there the QR code is visible longer. I also think the idea is that most should be handled in the website (e.g. also error handling) - so we do not wait but leave it up to the website.