miden_client/pswap/
errors.rs1use alloc::boxed::Box;
4
5use miden_protocol::Felt;
6use miden_protocol::account::AccountId;
7use miden_protocol::note::NoteId;
8
9use super::lineage::PswapLineageState;
10use crate::store::StoreError;
11
12#[derive(Debug, thiserror::Error)]
14pub enum PswapLineageError {
15 #[error("no PSWAP lineage tracked for order_id {0}")]
17 NotFound(Felt),
18
19 #[error("PSWAP lineage is not active (state = {0:?}); no further rounds expected")]
21 NotActive(PswapLineageState),
22
23 #[error(
26 "PSWAP creator account {0} is not local; reclaim requires the creator's signing authority"
27 )]
28 CreatorNotLocal(AccountId),
29
30 #[error("current tip note is missing from the local store; the tracked lineage is out of sync")]
33 TipMissing,
34
35 #[error(
40 "PSWAP original note {0} is unavailable in the output-note store or lacks recipient details"
41 )]
42 OriginalNoteUnavailable(NoteId),
43
44 #[error("unknown PSWAP lineage state byte: {0}")]
46 UnknownState(u8),
47
48 #[error("PSWAP store call failed: {0}")]
50 Store(#[from] StoreError),
51}
52
53impl From<PswapLineageError> for crate::ClientError {
54 fn from(err: PswapLineageError) -> Self {
55 crate::ClientError::Observer(Box::new(err))
56 }
57}