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 @@ -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 @@ -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