Skip to content

Commit 1865f4e

Browse files
committed
feat: expose PaymentKind accessors in UDL bindings
1 parent 6e4d70d commit 1865f4e

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

bindings/ldk_node.udl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
namespace ldk_node {
22
Mnemonic generate_entropy_mnemonic(WordCount? word_count);
33
Config default_config();
4+
5+
// PaymentKind Accessors
6+
PaymentHash? payment_kind_get_payment_hash(PaymentKind kind);
7+
PaymentPreimage? payment_kind_get_preimage(PaymentKind kind);
8+
PaymentSecret? payment_kind_get_secret(PaymentKind kind);
49
};
510

611
dictionary Config {

src/ffi/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub use crate::graph::{ChannelInfo, ChannelUpdateInfo, NodeAnnouncementInfo, Nod
5353
pub use crate::liquidity::{LSPS1OrderStatus, LSPS2ServiceConfig};
5454
pub use crate::logger::{LogLevel, LogRecord, LogWriter};
5555
pub use crate::payment::store::{
56+
payment_kind_get_payment_hash, payment_kind_get_preimage, payment_kind_get_secret,
5657
ConfirmationStatus, LSPFeeLimits, PaymentDirection, PaymentKind, PaymentStatus,
5758
};
5859
pub use crate::payment::QrPaymentResult;

src/payment/store.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,24 @@ impl PaymentKind {
529529
}
530530
}
531531

532+
#[cfg(feature = "uniffi")]
533+
#[doc(hidden)]
534+
pub fn payment_kind_get_payment_hash(kind: PaymentKind) -> Option<PaymentHash> {
535+
kind.payment_hash()
536+
}
537+
538+
#[cfg(feature = "uniffi")]
539+
#[doc(hidden)]
540+
pub fn payment_kind_get_preimage(kind: PaymentKind) -> Option<PaymentPreimage> {
541+
kind.preimage()
542+
}
543+
544+
#[cfg(feature = "uniffi")]
545+
#[doc(hidden)]
546+
pub fn payment_kind_get_secret(kind: PaymentKind) -> Option<PaymentSecret> {
547+
kind.secret()
548+
}
549+
532550
/// Represents the confirmation status of a transaction.
533551
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
534552
pub enum ConfirmationStatus {

0 commit comments

Comments
 (0)