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 async fn auth(&self) -> Option<ApiAuth>;
22
23 async fn connected_peers(&self) -> Vec<String>;
25
26 fn available_modules(&self) -> BTreeSet<ModuleKind>;
28
29 fn default_modules(&self) -> BTreeSet<ModuleKind>;
31
32 async fn reset_setup_codes(&self);
34
35 async fn set_local_parameters(
37 &self,
38 auth: ApiAuth,
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 federation_size(&self) -> Option<u32>;
55
56 async fn cfg_federation_name(&self) -> Option<String>;
58
59 async fn cfg_base_fees_disabled(&self) -> Option<bool>;
61
62 async fn cfg_enabled_modules(&self) -> Option<BTreeSet<ModuleKind>>;
64
65 fn into_dyn(self) -> DynSetupApi
67 where
68 Self: Sized + Send + Sync + 'static,
69 {
70 Arc::new(self)
71 }
72}