Skip to content

Commit

Permalink
fix(tap-core): implement serialize for failed state
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Delgado <[email protected]>
  • Loading branch information
LNSD committed Jun 25, 2024
1 parent 483a712 commit 39d76b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tap_core/src/receipt/received_receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//! their progress through various checks and stages of inclusion in RAV requests and received RAVs.
use alloy_sol_types::Eip712Domain;
use serde::{Deserialize, Serialize};

use super::{Receipt, ReceiptError, ReceiptResult, SignedReceipt};
use crate::receipt::state::{AwaitingReserve, Checking, Failed, ReceiptState, Reserved};
Expand All @@ -37,7 +38,7 @@ pub type ResultReceipt<S> = std::result::Result<ReceiptWithState<S>, ReceiptWith
/// awaiting escrow reservation.
/// - The [ `Reserved` ] state is used to represent a receipt that has
/// successfully reserved escrow.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReceiptWithState<S>
where
S: ReceiptState,
Expand Down
9 changes: 5 additions & 4 deletions tap_core/src/receipt/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
//! The `ReceiptState` trait represents the different states a receipt can be in.
use crate::receipt::ReceiptError;
use serde::{Deserialize, Serialize};

/// Checking state represents a receipt that is currently being checked.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Checking;

/// Failed state represents a receipt that has failed a check or validation.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Failed {
/// A list of checks to be completed for the receipt, along with their
/// current result
Expand All @@ -23,11 +24,11 @@ pub struct Failed {

/// AwaitingReserve state represents a receipt that has passed all checks
/// and is awaiting escrow reservation.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AwaitingReserve;

/// Reserved state represents a receipt that has successfully reserved escrow.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Reserved;

/// Trait for the different states a receipt can be in.
Expand Down

0 comments on commit 39d76b0

Please sign in to comment.