Skip to content

Conversation

@21M4TW
Copy link
Contributor

@21M4TW 21M4TW commented Jun 9, 2025

These changes add bolt12 support to the NWC provider extension, leveraging the work to add support in lnbits (lnbits/lnbits#3092). The following NWC commands are added:
-make_offer
-lookup_offer
-enable_offer
-disable_offer
-list_offers
-fetch_invoice

Also, the following commands are modified to support bolt12:
-lookup_invoices
-pay_invoice
-multi_pay_invoice

arcbtc and others added 13 commits March 3, 2025 21:31
* fix nwc description

* initial

* fixup crud and models

* views and tasks

* Added description for extension preview

* fixed js

* make

* Allow arbitrary types

* trying to fix install error

* added arbitrary_types_allowed

* fixed migration error

* migration fix

* migration fix attempt

* make

* hopefully his will work

* removed basemodel (test)

* Update manifest.json

* fix json bug, move js to own file

* move admin js to own file

* update dev environment

* fix template regression

* upgrade quasar api calls

* fix models

* fix budget

* fix tracked budget

* fix async pytests

* mount docker socket for integration test

* install pytest-asyncio in poetry env

* update integration tests

* revert listener refactoring to avoid cyclic dependency hell

* fix broken refactoring

* fix for new api

* fix integration test run

* fix integration test run?

* fix integration test run?

* fix integration test run?

* fix integration test run?

* edges hardening

* fix integration test run?

* more hardening

* fix for ghactions ?

* fix ghactions?

* more ghaction fixes

* fix integration test run?

* more hardening

* garbage collect old tracked events

* configurable handle_missed_events

* readme format

* default handle_missed_events  to 0

* more hardening

* increase timeout

* increase timeout

* Add more tests

* more hardening

* format

* lint

* postgres fix

---------

Co-authored-by: Riccardo Balbo <[email protected]>
 -Was accessing the arguments from payload instead of from params
 -Was using "to" instead of "until" defined in NIP-47
-Improving _offer_to_dict function
-This should complete the initial support for Bolt12. The only remaining
issue is regarding the invoice string for Bolt12 payments. Currently
there is no bolt12 column in the apipayments table. This can be added if
this is deemed useful.
@21M4TW
Copy link
Contributor Author

21M4TW commented Jun 11, 2025

PR for NIP-47 to add Bolt12 support: nostr-protocol/nips#1952

Copy link
Owner

@riccardobl riccardobl left a comment

Choose a reason for hiding this comment

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

Thank you!
We'll need to wait until support is merged into LNbits and the changes are approved in the NIP-47 spec.

Aside from that, it looks solid at first glance, but it will need some tests for the new methods in test_all.py

raise Exception("Missing invoice")
invoice_data = bolt11_decode(invoice)
# hardening #
assert_valid_bolt12(invoice)
Copy link
Owner

Choose a reason for hiding this comment

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

please add an assert_valid_bolt12_or_bolt11 method, if the invoice can be either of the two

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok yes I will do that

invoice_data = bolt11_decode(invoice)

# hardening #
assert_valid_bolt12(invoice)
Copy link
Owner

Choose a reason for hiding this comment

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

same here, should use assert_valid_bolt12_or_bolt11

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted

finally:
await wallet1.close()
await wallet2.close()
await wallet2.close()
Copy link
Owner

Choose a reason for hiding this comment

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

why did you remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I think it might be a "\r\n" vs "\n" new line issue. I had to manually merge. I will analyze how the file was previously ending by doing an hex dump.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh ok it's the line ending, i was sleepy and misread the diff in the merged view.
Don't worry about that.

@21M4TW
Copy link
Contributor Author

21M4TW commented Jun 11, 2025

Thank you! We'll need to wait until support is merged into LNbits and the changes are approved in the NIP-47 spec.

Aside from that, it looks solid at first glance, but it will need some tests for the new methods in test_all.py

Yes of course I understand. I am just working on the different pieces that are needed. It seems I managed to get the discussing going with NIP-47. I will start working on support from Zeus next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants