Skip to content

Commit fbb2e9a

Browse files
committed
feat(wip): uniffi wrapper for payment preimage
In a bid to create a uniffi wrapper for PaymentPreimage, we also create bindings-specific variants for the ffg types: LightningBalance, PaymentKind, and Event, all of which have fields that hold object/interface instances - PaymentPreimage, ConfirmationStatus and ClosureReason. We implement type conversion for the types created. Unfortunately the build does not compile. According to the uniffi docs: "When you want to ... store object instances as fields in records, the underlying Rust code will need to work with Arc<T> directly, to ensure that the code behaves in the way that UniFFI expects." Arc-ing the fields that hold PaymentPreimage, ConfirmationStatus, & ClosureReason is not sufficient to circumvent the error associated with objects not being supported in enum variants.
1 parent 45a1a73 commit fbb2e9a

2 files changed

Lines changed: 651 additions & 15 deletions

File tree

bindings/ldk_node.udl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,11 @@ interface Bolt12Invoice {
803803
sequence<u8> encode();
804804
};
805805

806+
interface PaymentPreimage {
807+
[Throws=NodeError, Name=from_str]
808+
constructor([ByRef] string preimage_str);
809+
};
810+
806811
[Custom]
807812
typedef string Txid;
808813

@@ -830,9 +835,6 @@ typedef string PaymentId;
830835
[Custom]
831836
typedef string PaymentHash;
832837

833-
[Custom]
834-
typedef string PaymentPreimage;
835-
836838
[Custom]
837839
typedef string PaymentSecret;
838840

0 commit comments

Comments
 (0)