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 auth(&self) -> Option<ApiAuth>;
19
20 async fn connected_peers(&self) -> Vec<String>;
22
23 fn available_modules(&self) -> BTreeSet<ModuleKind>;
25
26 async fn reset_setup_codes(&self);
28
29 async fn set_local_parameters(
31 &self,
32 auth: ApiAuth,
33 name: String,
34 federation_name: Option<String>,
35 disable_base_fees: Option<bool>,
36 enabled_modules: Option<BTreeSet<ModuleKind>>,
37 ) -> Result<String>;
38
39 async fn add_peer_setup_code(&self, info: String) -> Result<String>;
41
42 async fn start_dkg(&self) -> Result<()>;
44
45 fn into_dyn(self) -> DynSetupApi
47 where
48 Self: Sized + Send + Sync + 'static,
49 {
50 Arc::new(self)
51 }
52}