fedimint_meta_common/
config.rs

1use fedimint_core::core::ModuleKind;
2use fedimint_core::encoding::{Decodable, Encodable};
3use fedimint_core::plugin_types_trait_impl_config;
4use serde::{Deserialize, Serialize};
5
6use crate::MetaCommonInit;
7
8/// Parameters necessary to generate this module's configuration
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct MetaGenParams {
11    pub local: MetaGenParamsLocal,
12    pub consensus: MetaGenParamsConsensus,
13}
14
15/// Local parameters for config generation
16#[derive(Debug, Clone, Serialize, Deserialize, Default)]
17pub struct MetaGenParamsLocal;
18
19/// Consensus parameters for config generation
20#[derive(Debug, Clone, Serialize, Deserialize)]
21pub struct MetaGenParamsConsensus;
22
23impl Default for MetaGenParams {
24    fn default() -> Self {
25        Self {
26            local: MetaGenParamsLocal,
27            consensus: MetaGenParamsConsensus,
28        }
29    }
30}
31
32/// Contains all the configuration for the server
33#[derive(Clone, Debug, Serialize, Deserialize)]
34pub struct MetaConfig {
35    pub local: MetaConfigLocal,
36    pub private: MetaConfigPrivate,
37    pub consensus: MetaConfigConsensus,
38}
39
40/// Contains all the configuration for the client
41#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Encodable, Decodable, Hash)]
42pub struct MetaClientConfig;
43
44/// Locally unencrypted config unique to each member
45#[derive(Clone, Debug, Serialize, Deserialize, Decodable, Encodable)]
46pub struct MetaConfigLocal;
47
48/// Will be the same for every federation member
49#[derive(Clone, Debug, Serialize, Deserialize, Decodable, Encodable)]
50pub struct MetaConfigConsensus;
51
52/// Will be encrypted and not shared such as private key material
53#[derive(Clone, Debug, Serialize, Deserialize)]
54pub struct MetaConfigPrivate;
55
56// Wire together the configs for this module
57plugin_types_trait_impl_config!(
58    MetaCommonInit,
59    MetaGenParams,
60    MetaGenParamsLocal,
61    MetaGenParamsConsensus,
62    MetaConfig,
63    MetaConfigLocal,
64    MetaConfigPrivate,
65    MetaConfigConsensus,
66    MetaClientConfig
67);