@@ -66,7 +66,8 @@ use crate::io::{
6666 PENDING_PAYMENT_INFO_PERSISTENCE_SECONDARY_NAMESPACE ,
6767} ;
6868use crate :: liquidity:: {
69- LSPS1ClientConfig , LSPS2ClientConfig , LSPS2ServiceConfig , LiquiditySourceBuilder ,
69+ LSPS1ClientConfig , LSPS2ClientConfig , LSPS2ServiceConfig , LSPS5ClientConfig ,
70+ LiquiditySourceBuilder ,
7071} ;
7172use crate :: logger:: { log_error, LdkLogger , LogLevel , LogWriter , Logger } ;
7273use crate :: message_handler:: NodeCustomMessageHandler ;
@@ -76,8 +77,8 @@ use crate::runtime::{Runtime, RuntimeSpawner};
7677use crate :: tx_broadcaster:: TransactionBroadcaster ;
7778use crate :: types:: {
7879 AsyncPersister , ChainMonitor , ChannelManager , DynStore , DynStoreWrapper , GossipSync , Graph ,
79- KeysManager , MessageRouter , OnionMessenger , PaymentStore , PeerManager , PendingPaymentStore ,
80- Persister , SyncAndAsyncKVStore ,
80+ KeysManager , LSPS5ServiceConfig , MessageRouter , OnionMessenger , PaymentStore , PeerManager ,
81+ PendingPaymentStore , Persister , SyncAndAsyncKVStore ,
8182} ;
8283use crate :: wallet:: persist:: KVStoreWalletPersister ;
8384use crate :: wallet:: Wallet ;
@@ -125,6 +126,10 @@ struct LiquiditySourceConfig {
125126 lsps2_client : Option < LSPS2ClientConfig > ,
126127 // Act as an LSPS2 service.
127128 lsps2_service : Option < LSPS2ServiceConfig > ,
129+ // Act as an LSPS5 client connecting to the given service.
130+ lsps5_client : Option < LSPS5ClientConfig > ,
131+ // Act as an LSPS5 service.
132+ lsps5_service : Option < LSPS5ServiceConfig > ,
128133}
129134
130135#[ derive( Clone ) ]
@@ -450,6 +455,36 @@ impl NodeBuilder {
450455 self
451456 }
452457
458+ /// Configures the [`Node`] instance to source webhook notifications from the given
459+ /// [bLIP-55 / LSPS5] service.
460+ ///
461+ /// This allows the client to register webhook endpoints with the LSP to receive
462+ /// push notifications for Lightning events when the client is offline.
463+ ///
464+ /// [bLIP-55 / LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
465+ pub fn set_liquidity_source_lsps5 (
466+ & mut self , node_id : PublicKey , address : SocketAddress ,
467+ ) -> & mut Self {
468+ let liquidity_source_config =
469+ self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
470+ let lsps5_client_config = LSPS5ClientConfig { node_id, address } ;
471+ liquidity_source_config. lsps5_client = Some ( lsps5_client_config) ;
472+ self
473+ }
474+
475+ /// Configures the [`Node`] instance to provide an [LSPS5] service, enabling clients
476+ /// to register webhooks for push notifications.
477+ ///
478+ /// [LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
479+ pub fn set_liquidity_provider_lsps5 (
480+ & mut self , service_config : LSPS5ServiceConfig ,
481+ ) -> & mut Self {
482+ let liquidity_source_config =
483+ self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
484+ liquidity_source_config. lsps5_service = Some ( service_config) ;
485+ self
486+ }
487+
453488 /// Sets the used storage directory path.
454489 pub fn set_storage_dir_path ( & mut self , storage_dir_path : String ) -> & mut Self {
455490 self . config . storage_dir_path = storage_dir_path;
@@ -851,6 +886,25 @@ impl ArcedNodeBuilder {
851886 self . inner . write ( ) . unwrap ( ) . set_liquidity_provider_lsps2 ( service_config) ;
852887 }
853888
889+ /// Configures the [`Node`] instance to source webhook notifications from the given
890+ /// [bLIP-55 / LSPS5] service.
891+ ///
892+ /// This allows the client to register webhook endpoints with the LSP to receive
893+ /// push notifications for Lightning events when the client is offline.
894+ ///
895+ /// [bLIP-55 / LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
896+ pub fn set_liquidity_source_lsps5 ( & self , node_id : PublicKey , address : SocketAddress ) {
897+ self . inner . write ( ) . unwrap ( ) . set_liquidity_source_lsps5 ( node_id, address) ;
898+ }
899+
900+ /// Configures the [`Node`] instance to provide an [LSPS5] service, enabling clients
901+ /// to register webhooks for push notifications.
902+ ///
903+ /// [LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
904+ pub fn set_liquidity_provider_lsps5 ( & self , service_config : LSPS5ServiceConfig ) {
905+ self . inner . write ( ) . unwrap ( ) . set_liquidity_provider_lsps5 ( service_config) ;
906+ }
907+
854908 /// Sets the used storage directory path.
855909 pub fn set_storage_dir_path ( & self , storage_dir_path : String ) {
856910 self . inner . write ( ) . unwrap ( ) . set_storage_dir_path ( storage_dir_path) ;
@@ -1627,6 +1681,14 @@ fn build_with_store_internal(
16271681 liquidity_source_builder. lsps2_service ( promise_secret, config. clone ( ) )
16281682 } ) ;
16291683
1684+ lsc. lsps5_client . as_ref ( ) . map ( |config| {
1685+ liquidity_source_builder. lsps5_client ( config. node_id , config. address . clone ( ) )
1686+ } ) ;
1687+
1688+ lsc. lsps5_service
1689+ . as_ref ( )
1690+ . map ( |config| liquidity_source_builder. lsps5_service ( config. clone ( ) ) ) ;
1691+
16301692 let liquidity_source = runtime
16311693 . block_on ( async move { liquidity_source_builder. build ( ) . await . map ( Arc :: new) } ) ?;
16321694 let custom_message_handler =
0 commit comments