-
Notifications
You must be signed in to change notification settings - Fork 103
Feature: Add Bolt12 Uniffi Type Wrappers #542
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?
Feature: Add Bolt12 Uniffi Type Wrappers #542
Conversation
I've assigned @valentinewallace as a reviewer! |
match LdkBolt11InvoiceDescription::try_from(self) { | ||
Ok(ldk_description) => ldk_description, | ||
Err(e) => { | ||
panic!("Failed to convert Bolt11InvoiceDescription to LDK type: {:?}", e) |
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.
Not a fan of this myself. We could refactor the Bolt11InvoiceDescription to be a struct that holds the LdkType in an inner
field (similar to what we did to other types) to make this conversion safer. Looking for advice on whether it's worth introducing a breaking change for this!
Implement Offer struct in uniffi_types to provide a wrapper around LDK's Offer for cross-language bindings. Modified payment handling in bolt12.rs to: - Support both native and FFI-compatible types via type aliasing - Implement conditional compilation for transparent FFI support - Update payment functions to handle wrapped types Added testing to verify that properties are preserved when wrapping/unwrapping between native and FFI types.
Implement Refund struct in uniffi_types to provide a wrapper around LDK's Refund for cross-language bindings. Modified payment handling in bolt12.rs to: - Support both native and FFI-compatible types via type aliasing - Implement conditional compilation for transparent FFI support - Update payment functions to handle wrapped types Added testing to verify that properties are preserved when wrapping/unwrapping between native and FFI types.
Implement Bolt12Invoice struct in uniffi_types to provide a wrapper around LDK's Bolt12Invoice for cross-language bindings. Modified payment handling in bolt12.rs to: - Support both native and FFI-compatible types via type aliasing - Implement conditional compilation for transparent FFI support - Update payment functions to handle wrapped types Added testing to verify that properties are preserved when wrapping/unwrapping between native and FFI types.
Implement UniffiType trait to standardize conversion between native LDK types and their FFI-compatible wrappers. Enhanced uniffi_conversions module to: - Add a generic trait-based approach to type conversions - Support all wrapped Lightning types (Offer, Refund, Bolt11Invoice, Bolt12Invoice, Bolt11InvoiceDescription) - Provide consistent maybe_convert and maybe_wrap utilities for conditional compilation - Ensure correct type handling with compile-time feature flags Designed for maintainability and consistency when adding new FFI type wrappers in the future.
f07aa51
to
e85a185
Compare
Second PR for #504.
This PR adds full Offer-, Refund- and Bolt12Invoice- types for the FFI bindings.
Changes:
ldk_node.udl
anduniffi_types.rs
uniffi_conversions.rs
bolt12.rs
andunified_qr.rs
Benefits:
Note:
Appreciate that this PR is big. Happy to break down into smaller parts if preferred.