From 6af12c6856132c0be368cb7715f12af0a4a5d6c8 Mon Sep 17 00:00:00 2001 From: elnafateh Date: Wed, 18 Nov 2026 17:10:09 +0100 Subject: [PATCH] Expose LSPS1 BOLT12 payment info in UniFFI --- src/ffi/types.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/ffi/types.rs b/src/ffi/types.rs index 6d39bdaa46..2f137275dc 100644 --- a/src/ffi/types.rs +++ b/src/ffi/types.rs @@ -1581,6 +1581,8 @@ impl std::fmt::Display for Bolt11Invoice { pub struct LSPS1PaymentInfo { /// A Lightning payment using BOLT 11. pub bolt11: Option, + /// A Lightning payment using BOLT 12. + pub bolt12: Option, /// An onchain payment. pub onchain: Option, } @@ -1590,11 +1592,41 @@ impl From for LSPS1PaymentIn fn from(value: lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo) -> Self { LSPS1PaymentInfo { bolt11: value.bolt11.map(|b| b.into()), + bolt12: value.bolt12.map(|b| b.into()), onchain: value.onchain.map(|o| o.into()), } } } +/// A Lightning payment using BOLT 12. +#[cfg(feature = "uniffi")] +#[derive(Clone, Debug, PartialEq, Eq, uniffi::Record)] +pub struct LSPS1Bolt12PaymentInfo { + /// Indicates the current state of the payment. + pub state: LSPS1PaymentState, + /// The datetime when the payment option expires. + pub expires_at: LSPSDateTime, + /// The total fee the LSP will charge to open this channel in satoshi. + pub fee_total_sat: u64, + /// The amount the client needs to pay to have the requested channel opened. + pub order_total_sat: u64, + /// A BOLT 12 offer the client can pay to have the channel opened. + pub offer: Arc, +} + +#[cfg(feature = "uniffi")] +impl From for LSPS1Bolt12PaymentInfo { + fn from(info: lightning_liquidity::lsps1::msgs::LSPS1Bolt12PaymentInfo) -> Self { + Self { + state: info.state, + expires_at: info.expires_at, + fee_total_sat: info.fee_total_sat, + order_total_sat: info.order_total_sat, + offer: Arc::new(info.offer.into()), + } + } +} + /// An onchain payment. #[cfg(feature = "uniffi")] #[derive(Clone, Debug, PartialEq, Eq, uniffi::Record)]