@@ -61,7 +61,8 @@ use crate::io::{
6161 self , PAYMENT_INFO_PERSISTENCE_PRIMARY_NAMESPACE , PAYMENT_INFO_PERSISTENCE_SECONDARY_NAMESPACE ,
6262} ;
6363use crate :: liquidity:: {
64- LSPS1ClientConfig , LSPS2ClientConfig , LSPS2ServiceConfig , LiquiditySourceBuilder ,
64+ LSPS1ClientConfig , LSPS2ClientConfig , LSPS2ServiceConfig , LSPS5ClientConfig ,
65+ LiquiditySourceBuilder ,
6566} ;
6667use crate :: logger:: { log_error, LdkLogger , LogLevel , LogWriter , Logger } ;
6768use crate :: message_handler:: NodeCustomMessageHandler ;
@@ -71,7 +72,8 @@ use crate::runtime::Runtime;
7172use crate :: tx_broadcaster:: TransactionBroadcaster ;
7273use crate :: types:: {
7374 ChainMonitor , ChannelManager , DynStore , DynStoreWrapper , GossipSync , Graph , KeysManager ,
74- MessageRouter , OnionMessenger , PaymentStore , PeerManager , Persister , SyncAndAsyncKVStore ,
75+ LSPS5ServiceConfig , MessageRouter , OnionMessenger , PaymentStore , PeerManager , Persister ,
76+ SyncAndAsyncKVStore ,
7577} ;
7678use crate :: wallet:: persist:: KVStoreWalletPersister ;
7779use crate :: wallet:: Wallet ;
@@ -119,6 +121,10 @@ struct LiquiditySourceConfig {
119121 lsps2_client : Option < LSPS2ClientConfig > ,
120122 // Act as an LSPS2 service.
121123 lsps2_service : Option < LSPS2ServiceConfig > ,
124+ // Act as an LSPS5 client connecting to the given service.
125+ lsps5_client : Option < LSPS5ClientConfig > ,
126+ // Act as an LSPS5 service.
127+ lsps5_service : Option < LSPS5ServiceConfig > ,
122128}
123129
124130#[ derive( Clone ) ]
@@ -444,6 +450,36 @@ impl NodeBuilder {
444450 self
445451 }
446452
453+ /// Configures the [`Node`] instance to source webhook notifications from the given
454+ /// [bLIP-55 / LSPS5] service.
455+ ///
456+ /// This allows the client to register webhook endpoints with the LSP to receive
457+ /// push notifications for Lightning events when the client is offline.
458+ ///
459+ /// [bLIP-55 / LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
460+ pub fn set_liquidity_source_lsps5 (
461+ & mut self , node_id : PublicKey , address : SocketAddress ,
462+ ) -> & mut Self {
463+ let liquidity_source_config =
464+ self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
465+ let lsps5_client_config = LSPS5ClientConfig { node_id, address } ;
466+ liquidity_source_config. lsps5_client = Some ( lsps5_client_config) ;
467+ self
468+ }
469+
470+ /// Configures the [`Node`] instance to provide an [LSPS5] service, enabling clients
471+ /// to register webhooks for push notifications.
472+ ///
473+ /// [LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
474+ pub fn set_liquidity_provider_lsps5 (
475+ & mut self , service_config : LSPS5ServiceConfig ,
476+ ) -> & mut Self {
477+ let liquidity_source_config =
478+ self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
479+ liquidity_source_config. lsps5_service = Some ( service_config) ;
480+ self
481+ }
482+
447483 /// Sets the used storage directory path.
448484 pub fn set_storage_dir_path ( & mut self , storage_dir_path : String ) -> & mut Self {
449485 self . config . storage_dir_path = storage_dir_path;
@@ -845,6 +881,25 @@ impl ArcedNodeBuilder {
845881 self . inner . write ( ) . unwrap ( ) . set_liquidity_provider_lsps2 ( service_config) ;
846882 }
847883
884+ /// Configures the [`Node`] instance to source webhook notifications from the given
885+ /// [bLIP-55 / LSPS5] service.
886+ ///
887+ /// This allows the client to register webhook endpoints with the LSP to receive
888+ /// push notifications for Lightning events when the client is offline.
889+ ///
890+ /// [bLIP-55 / LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
891+ pub fn set_liquidity_source_lsps5 ( & self , node_id : PublicKey , address : SocketAddress ) {
892+ self . inner . write ( ) . unwrap ( ) . set_liquidity_source_lsps5 ( node_id, address) ;
893+ }
894+
895+ /// Configures the [`Node`] instance to provide an [LSPS5] service, enabling clients
896+ /// to register webhooks for push notifications.
897+ ///
898+ /// [LSPS5]: https://github.com/lightning/blips/blob/master/blip-0055.md
899+ pub fn set_liquidity_provider_lsps5 ( & self , service_config : LSPS5ServiceConfig ) {
900+ self . inner . write ( ) . unwrap ( ) . set_liquidity_provider_lsps5 ( service_config) ;
901+ }
902+
848903 /// Sets the used storage directory path.
849904 pub fn set_storage_dir_path ( & self , storage_dir_path : String ) {
850905 self . inner . write ( ) . unwrap ( ) . set_storage_dir_path ( storage_dir_path) ;
@@ -1547,6 +1602,14 @@ fn build_with_store_internal(
15471602 liquidity_source_builder. lsps2_service ( promise_secret, config. clone ( ) )
15481603 } ) ;
15491604
1605+ lsc. lsps5_client . as_ref ( ) . map ( |config| {
1606+ liquidity_source_builder. lsps5_client ( config. node_id , config. address . clone ( ) )
1607+ } ) ;
1608+
1609+ lsc. lsps5_service
1610+ . as_ref ( )
1611+ . map ( |config| liquidity_source_builder. lsps5_service ( config. clone ( ) ) ) ;
1612+
15501613 let liquidity_source = runtime
15511614 . block_on ( async move { liquidity_source_builder. build ( ) . await . map ( Arc :: new) } ) ?;
15521615 let custom_message_handler =
0 commit comments