lit_rust_sdk/client/
state.rs1use crate::types::ConnectionState;
2use std::collections::HashMap;
3
4impl<P: alloy::providers::Provider> super::LitNodeClient<P> {
5 pub fn is_ready(&self) -> bool {
6 self.ready
7 }
8
9 pub fn connected_nodes(&self) -> Vec<String> {
10 self.connection_state
11 .iter()
12 .map(|entry| entry.key().clone())
13 .collect()
14 }
15
16 pub fn get_connection_state(&self) -> ConnectionState {
17 let mut server_keys = HashMap::new();
18 let connected_nodes: Vec<String> = self
19 .connection_state
20 .iter()
21 .map(|entry| {
22 server_keys.insert(entry.key().clone(), entry.handshake_response.clone());
23 entry.key().clone()
24 })
25 .collect();
26
27 ConnectionState {
28 connected_nodes,
29 server_keys,
30 subnet_pub_key: self.subnet_pub_key.clone(),
31 network_pub_key: self.network_pub_key.clone(),
32 network_pub_key_set: self.network_pub_key_set.clone(),
33 hd_root_pubkeys: self.hd_root_pubkeys.clone(),
34 latest_blockhash: self.latest_blockhash.clone(),
35 }
36 }
37}