Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/ffi/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,8 @@ impl std::fmt::Display for Bolt11Invoice {
pub struct LSPS1PaymentInfo {
/// A Lightning payment using BOLT 11.
pub bolt11: Option<crate::ffi::LSPS1Bolt11PaymentInfo>,
/// A Lightning payment using BOLT 12.
pub bolt12: Option<LSPS1Bolt12PaymentInfo>,
/// An onchain payment.
pub onchain: Option<LSPS1OnchainPaymentInfo>,
}
Expand All @@ -1590,11 +1592,41 @@ impl From<lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo> 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<Offer>,
}

#[cfg(feature = "uniffi")]
impl From<lightning_liquidity::lsps1::msgs::LSPS1Bolt12PaymentInfo> 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)]
Expand Down
Loading