@@ -94,7 +94,9 @@ pub mod logger;
9494mod message_handler;
9595pub mod payment;
9696mod peer_store;
97+ mod rate_limiter;
9798mod runtime;
99+ mod static_invoice_store;
98100mod tx_broadcaster;
99101mod types;
100102mod wallet;
@@ -150,6 +152,7 @@ pub use types::{ChannelDetails, CustomTlvRecord, PeerDetails, UserChannelId};
150152
151153use logger:: { log_debug, log_error, log_info, log_trace, LdkLogger , Logger } ;
152154
155+ use lightning:: blinded_path:: message:: BlindedMessagePath ;
153156use lightning:: chain:: BestBlock ;
154157use lightning:: events:: bump_transaction:: Wallet as LdkWallet ;
155158use lightning:: impl_writeable_tlv_based;
@@ -170,6 +173,8 @@ use std::sync::atomic::{AtomicBool, Ordering};
170173use std:: sync:: { Arc , Mutex , RwLock } ;
171174use std:: time:: { Duration , Instant , SystemTime , UNIX_EPOCH } ;
172175
176+ use crate :: static_invoice_store:: StaticInvoiceStore ;
177+
173178#[ cfg( feature = "uniffi" ) ]
174179uniffi:: include_scaffolding!( "ldk_node" ) ;
175180
@@ -498,6 +503,8 @@ impl Node {
498503 Arc :: clone ( & self . logger ) ,
499504 ) ) ;
500505
506+ let static_invoice_store = StaticInvoiceStore :: new ( Arc :: clone ( & self . kv_store ) ) ;
507+
501508 let event_handler = Arc :: new ( EventHandler :: new (
502509 Arc :: clone ( & self . event_queue ) ,
503510 Arc :: clone ( & self . wallet ) ,
@@ -509,6 +516,7 @@ impl Node {
509516 self . liquidity_source . clone ( ) ,
510517 Arc :: clone ( & self . payment_store ) ,
511518 Arc :: clone ( & self . peer_store ) ,
519+ static_invoice_store,
512520 Arc :: clone ( & self . runtime ) ,
513521 Arc :: clone ( & self . logger ) ,
514522 Arc :: clone ( & self . config ) ,
@@ -1476,6 +1484,28 @@ impl Node {
14761484 Error :: PersistenceFailed
14771485 } )
14781486 }
1487+
1488+ /// Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build [`Offer`]s with a
1489+ /// static invoice server, so the server can serve [`StaticInvoice`]s to payers on our behalf when we're offline.
1490+ ///
1491+ /// [`Offer`]: lightning::offers::offer::Offer
1492+ /// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
1493+ pub fn set_paths_to_static_invoice_server (
1494+ & self , paths : Vec < BlindedMessagePath > ,
1495+ ) -> Result < ( ) , ( ) > {
1496+ self . channel_manager . set_paths_to_static_invoice_server ( paths)
1497+ }
1498+
1499+ /// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively
1500+ /// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments.
1501+ ///
1502+ /// [`Offer`]: lightning::offers::offer::Offer
1503+ /// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
1504+ pub fn blinded_paths_for_async_recipient (
1505+ & self , recipient_id : Vec < u8 > , relative_expiry : Option < Duration > ,
1506+ ) -> Result < Vec < BlindedMessagePath > , ( ) > {
1507+ self . channel_manager . blinded_paths_for_async_recipient ( recipient_id, relative_expiry)
1508+ }
14791509}
14801510
14811511impl Drop for Node {
0 commit comments