@@ -15,9 +15,7 @@ pub use crate::config::{
15
15
EsploraSyncConfig , MaxDustHTLCExposure ,
16
16
} ;
17
17
pub use crate :: graph:: { ChannelInfo , ChannelUpdateInfo , NodeAnnouncementInfo , NodeInfo } ;
18
- pub use crate :: liquidity:: {
19
- LSPS1OnchainPaymentInfo , LSPS1OrderStatus , LSPS1PaymentInfo , LSPS2ServiceConfig ,
20
- } ;
18
+ pub use crate :: liquidity:: { LSPS1OrderStatus , LSPS2ServiceConfig } ;
21
19
pub use crate :: logger:: { LogLevel , LogRecord , LogWriter } ;
22
20
pub use crate :: payment:: store:: {
23
21
ConfirmationStatus , LSPFeeLimits , PaymentDirection , PaymentKind , PaymentStatus ,
@@ -607,6 +605,24 @@ impl std::fmt::Display for Bolt11Invoice {
607
605
}
608
606
}
609
607
608
+ /// Details regarding how to pay for an order.
609
+ #[ derive( Clone , Debug , PartialEq , Eq ) ]
610
+ pub struct LSPS1PaymentInfo {
611
+ /// A Lightning payment using BOLT 11.
612
+ pub bolt11 : Option < crate :: uniffi_types:: LSPS1Bolt11PaymentInfo > ,
613
+ /// An onchain payment.
614
+ pub onchain : Option < LSPS1OnchainPaymentInfo > ,
615
+ }
616
+
617
+ impl From < lightning_liquidity:: lsps1:: msgs:: LSPS1PaymentInfo > for LSPS1PaymentInfo {
618
+ fn from ( value : lightning_liquidity:: lsps1:: msgs:: LSPS1PaymentInfo ) -> Self {
619
+ LSPS1PaymentInfo {
620
+ bolt11 : value. bolt11 . map ( |b| b. into ( ) ) ,
621
+ onchain : value. onchain . map ( |o| o. into ( ) ) ,
622
+ }
623
+ }
624
+ }
625
+
610
626
/// A Lightning payment using BOLT 11.
611
627
#[ derive( Clone , Debug , PartialEq , Eq ) ]
612
628
pub struct LSPS1Bolt11PaymentInfo {
@@ -634,6 +650,45 @@ impl From<lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo> for LSPS1Bol
634
650
}
635
651
}
636
652
653
+ /// An onchain payment.
654
+ #[ derive( Clone , Debug , PartialEq , Eq ) ]
655
+ pub struct LSPS1OnchainPaymentInfo {
656
+ /// Indicates the current state of the payment.
657
+ pub state : lightning_liquidity:: lsps1:: msgs:: LSPS1PaymentState ,
658
+ /// The datetime when the payment option expires.
659
+ pub expires_at : LSPSDateTime ,
660
+ /// The total fee the LSP will charge to open this channel in satoshi.
661
+ pub fee_total_sat : u64 ,
662
+ /// The amount the client needs to pay to have the requested channel openend.
663
+ pub order_total_sat : u64 ,
664
+ /// An on-chain address the client can send [`Self::order_total_sat`] to to have the channel
665
+ /// opened.
666
+ pub address : bitcoin:: Address ,
667
+ /// The minimum number of block confirmations that are required for the on-chain payment to be
668
+ /// considered confirmed.
669
+ pub min_onchain_payment_confirmations : Option < u16 > ,
670
+ /// The minimum fee rate for the on-chain payment in case the client wants the payment to be
671
+ /// confirmed without a confirmation.
672
+ pub min_fee_for_0conf : Arc < bitcoin:: FeeRate > ,
673
+ /// The address where the LSP will send the funds if the order fails.
674
+ pub refund_onchain_address : Option < bitcoin:: Address > ,
675
+ }
676
+
677
+ impl From < lightning_liquidity:: lsps1:: msgs:: LSPS1OnchainPaymentInfo > for LSPS1OnchainPaymentInfo {
678
+ fn from ( value : lightning_liquidity:: lsps1:: msgs:: LSPS1OnchainPaymentInfo ) -> Self {
679
+ Self {
680
+ state : value. state ,
681
+ expires_at : value. expires_at ,
682
+ fee_total_sat : value. fee_total_sat ,
683
+ order_total_sat : value. order_total_sat ,
684
+ address : value. address ,
685
+ min_onchain_payment_confirmations : value. min_onchain_payment_confirmations ,
686
+ min_fee_for_0conf : Arc :: new ( value. min_fee_for_0conf ) ,
687
+ refund_onchain_address : value. refund_onchain_address ,
688
+ }
689
+ }
690
+ }
691
+
637
692
impl UniffiCustomTypeConverter for LSPS1OrderId {
638
693
type Builtin = String ;
639
694
0 commit comments