This repository was archived by the owner on Feb 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ pub mod labels;
2626mod ldkstorage;
2727pub mod lnurlauth;
2828pub mod logging;
29- mod lsp;
29+ pub mod lsp;
3030mod messagehandler;
3131mod networking;
3232mod node;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ impl<'de> Deserialize<'de> for VoltageConfig {
6565}
6666
6767#[ derive( Clone ) ]
68- pub ( crate ) struct LspClient {
68+ pub struct LspClient {
6969 pub pubkey : PublicKey ,
7070 pub connection_string : String ,
7171 pub url : String ,
Original file line number Diff line number Diff line change @@ -1344,6 +1344,11 @@ impl<S: MutinyStorage> NodeManager<S> {
13441344 Ok ( peers)
13451345 }
13461346
1347+ pub async fn get_configured_lsp ( & self ) -> Result < Option < LspConfig > , MutinyError > {
1348+ let node = self . get_node_by_key_or_first ( None ) . await ?;
1349+ Ok ( node. node_index ( ) . await . lsp )
1350+ }
1351+
13471352 /// Changes all the node's LSPs to the given config. If any of the nodes have an active channel with the
13481353 /// current LSP, it will fail to change the LSP.
13491354 ///
Original file line number Diff line number Diff line change @@ -277,9 +277,9 @@ fn build_preferred_hubs_set() -> HashSet<NodeId> {
277277 . collect ( )
278278}
279279
280- pub ( crate ) type ProbScorer = ProbabilisticScorer < Arc < NetworkGraph > , Arc < MutinyLogger > > ;
280+ pub type ProbScorer = ProbabilisticScorer < Arc < NetworkGraph > , Arc < MutinyLogger > > ;
281281
282- pub ( crate ) struct HubPreferentialScorer {
282+ pub struct HubPreferentialScorer {
283283 inner : ProbScorer ,
284284 preferred_hubs_set : HashSet < NodeId > ,
285285}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ use mutiny_core::{
4747 labels:: LabelStorage ,
4848 nodemanager:: { create_lsp_config, NodeManager } ,
4949} ;
50- use mutiny_core:: { logging:: MutinyLogger , nostr:: ProfileType } ;
50+ use mutiny_core:: { logging:: MutinyLogger , lsp :: LspConfig , nostr:: ProfileType } ;
5151use nostr:: prelude:: Method ;
5252use nostr:: { Keys , ToBech32 } ;
5353use std:: collections:: HashMap ;
@@ -763,6 +763,15 @@ impl MutinyWallet {
763763 Ok ( ( ) )
764764 }
765765
766+ /// Returns the current LSP config
767+ pub async fn get_configured_lsp ( & self ) -> Result < JsValue , MutinyJsError > {
768+ match self . inner . node_manager . get_configured_lsp ( ) . await ? {
769+ Some ( LspConfig :: VoltageFlow ( config) ) => Ok ( JsValue :: from_serde ( & config) ?) ,
770+ Some ( LspConfig :: Lsps ( config) ) => Ok ( JsValue :: from_serde ( & config) ?) ,
771+ None => Ok ( JsValue :: NULL ) ,
772+ }
773+ }
774+
766775 /// Attempts to connect to a peer from the selected node.
767776 #[ wasm_bindgen]
768777 pub async fn connect_to_peer (
You can’t perform that action at this time.
0 commit comments