Skip to content

Commit 77166f7

Browse files
authored
Merge pull request #159 from semiotic-ai/serde_received_receipt
feat: serde for ReceivedReceipt
2 parents 7e25081 + 1765b5d commit 77166f7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tap_core/src/tap_receipt/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ use ethereum_types::Address;
1010
pub use receipt::Receipt;
1111
pub use receipt_auditor::ReceiptAuditor;
1212
pub use received_receipt::{RAVStatus, ReceiptState, ReceivedReceipt};
13+
use serde::{Deserialize, Serialize};
1314
use strum_macros::{Display, EnumString};
1415
use thiserror::Error;
1516

16-
#[derive(Error, Debug, Clone)]
17+
#[derive(Error, Debug, Clone, Serialize, Deserialize)]
1718
pub enum ReceiptError {
1819
#[error("invalid allocation ID: {received_allocation_id}")]
1920
InvalidAllocationID { received_allocation_id: Address },
@@ -36,7 +37,7 @@ pub enum ReceiptError {
3637

3738
pub type ReceiptResult<T> = Result<T, ReceiptError>;
3839
pub type ReceiptCheckResults = HashMap<ReceiptCheck, Option<ReceiptResult<()>>>;
39-
#[derive(Hash, Eq, PartialEq, Debug, Clone, EnumString, Display)]
40+
#[derive(Hash, Eq, PartialEq, Debug, Clone, EnumString, Display, Serialize, Deserialize)]
4041
pub enum ReceiptCheck {
4142
CheckUnique,
4243
CheckAllocationId,

tap_core/src/tap_receipt/received_receipt.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//! This module is useful for managing and tracking the state of received receipts, as well as
1414
//! their progress through various checks and stages of inclusion in RAV requests and received RAVs.
1515
16+
use serde::{Deserialize, Serialize};
1617
use strum_macros::{Display, EnumString};
1718

1819
use super::{
@@ -26,7 +27,7 @@ use crate::{
2627
Error, Result,
2728
};
2829

29-
#[derive(Eq, PartialEq, Debug, Clone, EnumString, Display)]
30+
#[derive(Eq, PartialEq, Debug, Clone, EnumString, Display, Serialize, Deserialize)]
3031
/// State of the contained receipt
3132
pub enum ReceiptState {
3233
/// Initial state, received with no checks started
@@ -45,7 +46,7 @@ pub enum ReceiptState {
4546
Complete,
4647
}
4748

48-
#[derive(Eq, PartialEq, Debug, Clone)]
49+
#[derive(Eq, PartialEq, Debug, Clone, Serialize, Deserialize)]
4950

5051
/// Status of receipt relating to RAV inclusion
5152
pub enum RAVStatus {
@@ -57,7 +58,7 @@ pub enum RAVStatus {
5758
IncludedInReceived,
5859
}
5960

60-
#[derive(Debug, Clone)]
61+
#[derive(Debug, Clone, Serialize, Deserialize)]
6162
/// Wrapper class for metadata and state of a received receipt
6263
pub struct ReceivedReceipt {
6364
/// An EIP712 signed receipt message

0 commit comments

Comments
 (0)