fedimint_core/
admin_client.rs

1use std::fmt::Debug;
2
3use serde::{Deserialize, Serialize};
4
5use crate::encoding::{Decodable, Encodable};
6
7/// The state of the server returned via APIs
8#[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq, Encodable, Decodable)]
9#[serde(rename_all = "snake_case")]
10pub enum ServerStatusLegacy {
11    /// Server needs a password to read configs
12    #[default]
13    AwaitingPassword,
14    /// Waiting for peers to share the config gen params
15    SharingConfigGenParams,
16    /// Ready to run config gen once all peers are ready
17    ReadyForConfigGen,
18    /// We failed running config gen
19    ConfigGenFailed,
20    /// Config is generated, peers should verify the config
21    VerifyingConfigs,
22    /// We have verified all our peer configs
23    VerifiedConfigs,
24    /// Consensus is running
25    ConsensusRunning,
26    /// Restarted setup. All peers need to sync on this state before continuing
27    /// to `SharingConfigGenParams`
28    SetupRestarted,
29}
30
31/// The state of the server returned via APIs
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
33pub enum SetupStatus {
34    /// Waiting for guardian to set the local parameters
35    AwaitingLocalParams,
36    /// Sharing the connection codes with our peers
37    SharingConnectionCodes,
38    /// Consensus is running
39    ConsensusIsRunning,
40}
41
42#[derive(Clone, Debug, Serialize, Deserialize)]
43pub struct SetLocalParamsRequest {
44    /// Name of the peer, used in TLS auth
45    pub name: String,
46    /// Federation name set by the leader
47    pub federation_name: Option<String>,
48    /// Whether to disable base fees, set by the leader
49    pub disable_base_fees: Option<bool>,
50}
51
52/// Archive of all the guardian config files that can be used to recover a lost
53/// guardian node.
54#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
55pub struct GuardianConfigBackup {
56    #[serde(with = "crate::hex::serde")]
57    pub tar_archive_bytes: Vec<u8>,
58}