fedimint_meta_common/
endpoint.rs

1use std::collections::BTreeMap;
2
3use fedimint_core::PeerId;
4use serde::{Deserialize, Serialize};
5
6use crate::{MetaKey, MetaValue};
7
8/// Submit a change of value for a given key. Guardians only.
9pub const SUBMIT_ENDPOINT: &str = "submit";
10/// Get consensus on the value of a given key
11pub const GET_CONSENSUS_ENDPOINT: &str = "get_consensus";
12/// Get revision of the consensus on the value of a given key
13///
14/// This is meant to avoid transmitting the whole value over
15/// and over to clients that already have it, and are just checking
16/// if it was updated.
17pub const GET_CONSENSUS_REV_ENDPOINT: &str = "get_consensus_rev";
18/// Get the list of pending submissions for a given key. Guardians only.
19pub const GET_SUBMISSIONS_ENDPOINT: &str = "get_submission";
20
21#[derive(Debug, Serialize, Deserialize)]
22pub struct SubmitRequest {
23    pub key: MetaKey,
24    pub value: MetaValue,
25}
26
27#[derive(Debug, Serialize, Deserialize)]
28pub struct GetConsensusRequest(pub MetaKey);
29
30#[derive(Debug, Serialize, Deserialize)]
31pub struct GetSubmissionsRequest(pub MetaKey);
32
33pub type GetSubmissionResponse = BTreeMap<PeerId, MetaValue>;