fedimint_empty_client/
states.rs

1use fedimint_client_module::DynGlobalClientContext;
2use fedimint_client_module::sm::{DynState, State, StateTransition};
3use fedimint_core::core::{IntoDynInstance, ModuleInstanceId, OperationId};
4use fedimint_core::encoding::{Decodable, Encodable};
5use serde::{Deserialize, Serialize};
6use thiserror::Error;
7
8use crate::EmptyClientContext;
9
10/// Tracks a transaction
11#[derive(Debug, Clone, Eq, PartialEq, Hash, Decodable, Encodable)]
12pub enum EmptyStateMachine {}
13
14impl State for EmptyStateMachine {
15    type ModuleContext = EmptyClientContext;
16
17    fn transitions(
18        &self,
19        _context: &Self::ModuleContext,
20        _global_context: &DynGlobalClientContext,
21    ) -> Vec<StateTransition<Self>> {
22        unreachable!()
23    }
24
25    fn operation_id(&self) -> OperationId {
26        unreachable!()
27    }
28}
29
30// TODO: Boiler-plate
31impl IntoDynInstance for EmptyStateMachine {
32    type DynType = DynState;
33
34    fn into_dyn(self, instance_id: ModuleInstanceId) -> Self::DynType {
35        DynState::from_typed(instance_id, self)
36    }
37}
38
39#[derive(Error, Debug, Serialize, Deserialize, Encodable, Decodable, Clone, Eq, PartialEq)]
40pub enum EmptyError {
41    #[error("Empty module had an internal error")]
42    EmptyInternalError,
43}