chore(sdk): define trait Receipt (#11643)

This commit is contained in:
Emilia Hane
2024-10-14 11:12:29 +02:00
committed by GitHub
parent a049dff0b7
commit 482468579f
3 changed files with 33 additions and 1 deletions

View File

@ -64,4 +64,4 @@ arbitrary = [
"dep:proptest",
"dep:proptest-arbitrary-interop",
]
serde-bincode-compat = ["serde_with", "alloy-consensus/serde-bincode-compat"]
serde-bincode-compat = ["serde_with", "alloy-consensus/serde-bincode-compat"]

View File

@ -20,6 +20,9 @@ pub use constants::gas_units::{format_gas, format_gas_throughput};
pub mod account;
pub use account::{Account, Bytecode};
pub mod receipt;
pub use receipt::Receipt;
mod integer_list;
pub use integer_list::{IntegerList, IntegerListError};

View File

@ -0,0 +1,29 @@
//! Receipt abstraction
use alloc::fmt;
use alloy_consensus::TxReceipt;
use reth_codecs::Compact;
use serde::{Deserialize, Serialize};
/// Helper trait that unifies all behaviour required by receipt to support full node operations.
pub trait FullReceipt: Receipt + Compact {}
impl<T> FullReceipt for T where T: Receipt + Compact {}
/// Abstraction of a receipt.
pub trait Receipt:
TxReceipt
+ Clone
+ fmt::Debug
+ PartialEq
+ Eq
+ Default
+ alloy_rlp::Encodable
+ alloy_rlp::Decodable
+ Serialize
+ for<'de> Deserialize<'de>
{
/// Returns transaction type.
fn tx_type(&self) -> u8;
}