-
Notifications
You must be signed in to change notification settings - Fork 102
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
base: main
Are you sure you want to change the base?
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!
src/payment/bolt11.rs
Outdated
type Bolt11Invoice = Arc<crate::uniffi_types::Bolt11Invoice>; | ||
|
||
#[cfg(not(feature = "uniffi"))] | ||
pub 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 don't think these helper methods should be pub
?
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! Changed to pub(crate)
because it's needed in unified_qr.rs
.
a210c5e
to
efe36fb
Compare
efe36fb
to
422a81b
Compare
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.
422a81b
to
0efa3f9
Compare
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