fedimint_server_core/
setup_ui.rs1use std::collections::BTreeSet;
2use std::sync::Arc;
3
4use anyhow::Result;
5use async_trait::async_trait;
6use fedimint_core::core::ModuleKind;
7use fedimint_core::module::ApiAuth;
8
9pub type DynSetupApi = Arc<dyn ISetupApi + Send + Sync + 'static>;
10
11#[async_trait]
13pub trait ISetupApi {
14 async fn setup_code(&self) -> Option<String>;
16
17 async fn guardian_name(&self) -> Option<String>;
19
20 fn auth_ui(&self) -> Option<ApiAuth>;
23
24 async fn connected_peers(&self) -> Vec<String>;
26
27 fn available_modules(&self) -> BTreeSet<ModuleKind>;
29
30 fn default_modules(&self) -> BTreeSet<ModuleKind>;
32
33 async fn reset_setup_codes(&self);
35
36 async fn set_local_parameters(
38 &self,
39 name: String,
40 federation_name: Option<String>,
41 disable_base_fees: Option<bool>,
42 enabled_modules: Option<BTreeSet<ModuleKind>>,
43 federation_size: Option<u32>,
44 ) -> Result<String>;
45
46 async fn add_peer_setup_code(&self, info: String) -> Result<String>;
48
49 async fn start_dkg(&self) -> Result<()>;
51
52 async fn restore_from_backup(&self, password: Option<String>, backup: Vec<u8>) -> Result<()>;
56
57 async fn federation_size(&self) -> Option<u32>;
60
61 async fn cfg_federation_name(&self) -> Option<String>;
63
64 async fn cfg_base_fees_disabled(&self) -> Option<bool>;
66
67 async fn cfg_enabled_modules(&self) -> Option<BTreeSet<ModuleKind>>;
69
70 async fn fedimintd_version(&self) -> String;
72
73 async fn fedimintd_version_hash(&self) -> Option<String>;
76
77 fn into_dyn(self) -> DynSetupApi
79 where
80 Self: Sized + Send + Sync + 'static,
81 {
82 Arc::new(self)
83 }
84}