Skip to content

Commit f01d021

Browse files
Add Bolt12Invoice wrapper for FFI bindings
Implement Bolt12Invoice struct in ffi/types.rs 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.
1 parent dc6a8f2 commit f01d021

File tree

3 files changed

+385
-21
lines changed

3 files changed

+385
-21
lines changed

bindings/ldk_node.udl

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,31 @@ interface Refund {
776776
string? payer_note();
777777
};
778778

779+
interface Bolt12Invoice {
780+
[Throws=NodeError, Name=from_str]
781+
constructor([ByRef] string invoice_str);
782+
PaymentHash payment_hash();
783+
u64 amount_msats();
784+
OfferAmount? amount();
785+
PublicKey signing_pubkey();
786+
u64 created_at();
787+
u64? absolute_expiry_seconds();
788+
u64 relative_expiry();
789+
boolean is_expired();
790+
string? description();
791+
string? issuer();
792+
string? payer_note();
793+
sequence<u8>? metadata();
794+
u64? quantity();
795+
sequence<u8> signable_hash();
796+
PublicKey payer_signing_pubkey();
797+
PublicKey? issuer_signing_pubkey();
798+
sequence<u8> chain();
799+
sequence<sequence<u8>>? offer_chains();
800+
sequence<Address> fallback_addresses();
801+
sequence<u8> encode();
802+
};
803+
779804
[Custom]
780805
typedef string Txid;
781806

@@ -794,9 +819,6 @@ typedef string NodeId;
794819
[Custom]
795820
typedef string Address;
796821

797-
[Custom]
798-
typedef string Bolt12Invoice;
799-
800822
[Custom]
801823
typedef string OfferId;
802824

0 commit comments

Comments
 (0)