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(
41 "PSWAP original note {0} is unavailable in the output-note store or lacks recipient details"
42 )]
43 OriginalNoteUnavailable(NoteId),
44
45 #[error("unknown PSWAP lineage state byte: {0}")]
47 UnknownState(u8),
48
49 #[error("PSWAP store call failed: {0}")]
51 Store(#[from] StoreError),
52}
53
54impl From<PswapLineageError> for crate::ClientError {
55 fn from(err: PswapLineageError) -> Self {
56 crate::ClientError::Observer(Box::new(err))
57 }
58}