1use std::collections::BTreeMap;
23use fedimint_core::PeerId;
4use serde::{Deserialize, Serialize};
56use crate::{MetaKey, MetaValue};
78/// 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";
2021#[derive(Debug, Serialize, Deserialize)]
22pub struct SubmitRequest {
23pub key: MetaKey,
24pub value: MetaValue,
25}
2627#[derive(Debug, Serialize, Deserialize)]
28pub struct GetConsensusRequest(pub MetaKey);
2930#[derive(Debug, Serialize, Deserialize)]
31pub struct GetSubmissionsRequest(pub MetaKey);
3233pub type GetSubmissionResponse = BTreeMap<PeerId, MetaValue>;