-
Notifications
You must be signed in to change notification settings - Fork 106
Expose Bolt11Invoice type in bindings #522
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
Expose Bolt11Invoice type in bindings #522
Conversation
👋 Thanks for assigning @tnull as a reviewer! |
🔔 1st Reminder Hey @valentinewallace! This PR has been waiting for your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this!
Approach looks already pretty good, some comments
6352b5d
to
15153ef
Compare
Please let me know when this is ready for another round of review! |
f2552f4
to
e2f37df
Compare
@tnull, when you have time, could you take another look? I believe the check failures are not related. |
e2f37df
to
96fc245
Compare
The first commit won't build on its own because of the function signatures in the bindings. Should I squash to one single commit? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excuse the delay here! Generally looks good, just two minor comments.
The first commit won't build on its own because of the function signatures in the bindings. Should I squash to one single commit?
Yes, if the commits don't build by themselves, it's preferable to squash, thank you!
a210c5e
to
efe36fb
Compare
422a81b
to
0efa3f9
Compare
🔔 1st Reminder Hey @tnull! This PR has been waiting for your review. |
🔔 2nd Reminder Hey @tnull! This PR has been waiting for your review. |
🔔 3rd Reminder Hey @tnull! This PR has been waiting for your review. |
🔔 4th Reminder Hey @tnull! This PR has been waiting for your review. |
🔔 5th Reminder Hey @tnull! This PR has been waiting for your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excuse the delay here!
This basically looks good to me, just one comment that needs to be addressed, the DRYing up can happen in any of the follow-up PRs.
type Bolt11Invoice = Arc<crate::uniffi_types::Bolt11Invoice>; | ||
|
||
#[cfg(not(feature = "uniffi"))] | ||
pub(crate) fn maybe_wrap_invoice(invoice: LdkBolt11Invoice) -> Bolt11Invoice { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to wonder if we really need type-dependant methods for everything we wrap. I think we should look to DRY them up, e.g., to be reused for Offer
,Bolt12Invoice
, Refund
, etc.
Probably fine to leave as-is here, but in the next PR we should start DRYing the wrapping code where we can (i.e., will probably also make sense to move these to uniffi_types
then).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, good point. Will try a couple of things for the types to come
Implement Bolt11Invoice struct in uniffi_types to provide a wrapper around LDK's Bolt11Invoice for cross-language bindings. Modified payment handling in bolt11.rs to: - Support both native and FFI-compatible invoice types via type aliasing - Add maybe_wrap_invoice and maybe_convert_invoice helper functions - Implement conditional compilation for transparent FFI support - Update all payment functions to handle wrapped invoice types Integrated with unified_qr.rs to ensure consistent invoice handling across the QR code generation and payment workflows. Functionality tested with test coverage to ensure that data does not change when wrapping/unwrapping.
0efa3f9
to
f8e758d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
First PR for #504.
This PR converts Bolt11Invoice from a string typedef to a full interface in the UDL, providing direct access to invoice properties across language bindings.
The scope has been limited to primitive properties for simplicity, with plans to extend the interface in future PRs.
Changes
Benefits