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

feat: webln integration for blocktank #73

Merged
merged 7 commits into from
Mar 13, 2024

Conversation

pavanjoshi914
Copy link
Contributor

@pavanjoshi914 pavanjoshi914 commented Jan 12, 2024

webln integration for lightning payments.

2024-01-12.18-08-48.mp4

@pavanjoshi914 pavanjoshi914 marked this pull request as draft January 12, 2024 12:43
@BitcoinErrorLog
Copy link
Collaborator

Is this also working properly when Alby is disabled?

@pavanjoshi914 pavanjoshi914 marked this pull request as ready for review January 18, 2024 06:30
@pavanjoshi914
Copy link
Contributor Author

Is this also working properly when Alby is disabled?

unfortunately, there is no way to detect if the wallet is disabled. alby and other lightning providers do inject providers even if it's disabled. it's just that providers won't work

@pavanjoshi914
Copy link
Contributor Author

  • are there any docs regarding how to test blocktank widget in the dev environment? do I have to spend my own sats to reach to claim channel page?

@rbndg
Copy link
Contributor

rbndg commented Jan 19, 2024

We currently test internally with regtest, so we would have to merge and test it ourselves.

@rbndg
Copy link
Contributor

rbndg commented Jan 19, 2024

After a review, we can merge this and we can test it internally

@pavanjoshi914
Copy link
Contributor Author

any updates on this pr? is there anything i can help with?

@flaviomoceri
Copy link
Member

flaviomoceri commented Feb 7, 2024

Hi @pavanjoshi914,

I checked the code, the payment works, these are the errors:

  1. Add space between "Claim Now" button and "Copy claim url" (you can use <div className={'claim-channel-button-spacer'} />)
  2. Replace onClick={() => ClaimWithWebln} with onClick={ClaimWithWebln} otherwise the function is not called
  3. When I try to claim the channel via Alby it doesn't seem to work (please take a look)

If you need help or have any other questions, please let me know.

I am on mainnet

recording-_3_-_1_.mp4

@pavanjoshi914
Copy link
Contributor Author

pavanjoshi914 commented Feb 13, 2024

i am not sure how i can access the claim page. is there any testnet setup you provide?

@flaviomoceri
Copy link
Member

You can test in mainnet, currently regtest is only for internal testing

But if you use this PR and set the environment variable REACT_APP_API_URL="https://api.stag.blocktank.to/blocktank/api/v2/", you should be able to create an order in regtest and if you send me LN invoice regtest I will pay it for you, so you will be able to see the "Claim Channel" page

@pavanjoshi914
Copy link
Contributor Author

thanks claim page might not have been working because of typo. corrected the function call should work now

@flaviomoceri
Copy link
Member

Great, please try claiming a channel by making a video to make sure everything works

You can test on regtest by following these instructions #73 (comment), otherwise if you stay on mainnet, if you send me the LN invoice I will pay for it for you, so you can make sure that everything works

@pavanjoshi914
Copy link
Contributor Author

image
unable to pay it from the regtest node

@pavanjoshi914
Copy link
Contributor Author

if you want me to try mainnet here's my lightning address pavanj@getalby.com

@flaviomoceri
Copy link
Member

flaviomoceri commented Feb 13, 2024

Done, sent. Make sure to take a video please

@pavanjoshi914
Copy link
Contributor Author

pavanjoshi914 commented Feb 13, 2024

@flaviomoceri which node you use in alby. few of the connector implementations in alby doesn't support connectPeer() which is required while claiming channel. getAlby/lightning-browser-extension#3041

i created pr in wallet to show proper error when method is not supported.

image

not it shows proper error message

@flaviomoceri
Copy link
Member

flaviomoceri commented Feb 13, 2024

I currently don't have any node connected to my alby, please use your node to test, a video would be perfect

@pavanjoshi914
Copy link
Contributor Author

#73 (comment) yup i am just clarifying the video mentioned here.

@pavanjoshi914
Copy link
Contributor Author

pavanjoshi914 commented Feb 14, 2024

image

do you know why the server is responding with status code 400?
here's the lnurl of created channel
lnurl1dp68gurn8ghj7cnvda3kkarpde4juumedehku7td9e6x7tmpwp5j7a3j9akz7v34xd3rqdmrxuknzve3x5kngdekxckkyvnxxuknverpxasnyerzx93kgcstylxh6

@flaviomoceri
Copy link
Member

When do you get this error and what kind of problem are you having while trying to claim with alby?

@pavanjoshi914
Copy link
Contributor Author

while trying to claim the channel.
lnurl decoder shows this
image

@SeverinAlexB
Copy link

SeverinAlexB commented Feb 15, 2024

do you know why the server is responding with status code 400? here's the lnurl of created channel lnurl1dp68gurn8ghj7cnvda3kkarpde4juumedehku7td9e6x7tmpwp5j7a3j9akz7v34xd3rqdmrxuknzve3x5kngdekxckkyvnxxuknverpxasnyerzx93kgcstylxh6

Hi @pavanjoshi914. I tested the LNURL endpoint on mainnet manually again and it works just fine for me. If you can reproduce this error again, can you show me the exact network request/response that shows the 400 error? 400 hints to a request validation issue. Maybe Alby is using LNURL slightly differently than we expect it.

Where can you find this request/response?

Developer Console -> Network -> Select the correct request -> Show me Payload, Response, and Headers/General section.
CleanShot 2024-02-15 at 08 38 22@2x

@pavanjoshi914
Copy link
Contributor Author

pavanjoshi914 commented Feb 15, 2024

i figured out alby lnurl channel implementation. found that they were missing a private field to add in lnurl callback. i updated the code and will be fixed with merging of this pr getAlby/lightning-browser-extension#3046

@pavanjoshi914
Copy link
Contributor Author

lnurl channel fixes are merged! and will be present in the next release. please do test it. latest changes are present in alby nightly builds https://github.com/getAlby/lightning-browser-extension#try-out-the-most-recent-version-of-alby-nightly-releases

@flaviomoceri
Copy link
Member

Great @pavanjoshi914, so have you tried claiming a channel via alby and got no errors?

@flaviomoceri
Copy link
Member

any updates? We tried to test by connecting the node on alby but without success

@pavanjoshi914
Copy link
Contributor Author

can you please share what error you are encountering

@MiguelMedeiros
Copy link
Member

Hey @pavanjoshi914, thanks for your PR! 🥳

I've connected my node to my Alby extension (with nightly build) and tried to claim the channel with it.
But I got some errors! 😢

  1. First try:

Nothing happend and I remebered that I needed to use the nightly build). 😄

20240308-1338-08.4794829.mp4
  1. Second try:

Now with the nightly build I've tried again. Got this error:

Error: Not yet supported with the currently used account.

20240308-1343-48.1036933.mp4
  1. Third try:

Tried again with the option "private channel", and got the same errror:

Error: Not yet supported with the currently used account.

20240308-1346-32.1620072.mp4

Do I need some special permissions to integrate that with my Alby account?

@pavanjoshi914
Copy link
Contributor Author

pavanjoshi914 commented Mar 11, 2024

hey @MiguelMedeiros every connector needs connectPeer function to make lnurl-channel work. unfortunately all alby connectors doesn't have that method implemented due to some issues. currently it's supported by only two connectors commando and lnd. if user has such nodes connected via alby it will work only for that.

maybe we just use webln only for payments and not lnurl channel opening for now? wdyt?

@MiguelMedeiros
Copy link
Member

Hey @pavanjoshi914 ,

maybe we just use webln only for payments and not lnurl channel opening for now? wdyt?

Agreed, we could push the payments first, and figure it out how to claim a channel later in another PR.
All good to me! Can yo just resolve the conflicts, so we can merge it?

Thanks 🥳

@MiguelMedeiros MiguelMedeiros self-requested a review March 11, 2024 16:28
@MiguelMedeiros MiguelMedeiros added the enhancement New feature or request label Mar 11, 2024
@pavanjoshi914
Copy link
Contributor Author

Thanks resolved the conflicts

@flaviomoceri
Copy link
Member

Hi @pavanjoshi914, can you please also remove the function and button related to "Claim Channel" to be pushed in a separate PR in the future?

@pavanjoshi914
Copy link
Contributor Author

reverted webln changes from claim page

Copy link
Member

@MiguelMedeiros MiguelMedeiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. 👍

@MiguelMedeiros MiguelMedeiros merged commit 9076b6e into synonymdev:master Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants