Skip to content

Commit 0dd04ba

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 391a2d8 commit 0dd04ba

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
@@ -774,6 +774,31 @@ interface Refund {
774774
string? payer_note();
775775
};
776776

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

@@ -792,9 +817,6 @@ typedef string NodeId;
792817
[Custom]
793818
typedef string Address;
794819

795-
[Custom]
796-
typedef string Bolt12Invoice;
797-
798820
[Custom]
799821
typedef string OfferId;
800822

0 commit comments

Comments
 (0)