reth_ethereum_primitives/
lib.rs

1//! Standalone crate for ethereum-specific Reth primitive types.
2
3#![doc(
4    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
5    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
6    issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
7)]
8#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
9#![cfg_attr(not(test), warn(unused_crate_dependencies))]
10#![cfg_attr(not(feature = "std"), no_std)]
11
12extern crate alloc;
13
14mod receipt;
15pub use receipt::*;
16
17mod transaction;
18pub use transaction::*;
19
20#[cfg(feature = "alloy-compat")]
21mod alloy_compat;
22
23/// Bincode-compatible serde implementations.
24#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))]
25pub mod serde_bincode_compat {
26    pub use super::{receipt::serde_bincode_compat::*, transaction::serde_bincode_compat::*};
27}
28
29/// Type alias for the ethereum block
30pub type Block = alloy_consensus::Block<TransactionSigned>;
31
32/// Type alias for the ethereum blockbody
33pub type BlockBody = alloy_consensus::BlockBody<TransactionSigned>;
34
35/// Helper struct that specifies the ethereum
36/// [`NodePrimitives`](reth_primitives_traits::NodePrimitives) types.
37#[derive(Debug, Clone, Default, PartialEq, Eq)]
38#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
39#[non_exhaustive]
40pub struct EthPrimitives;
41
42impl reth_primitives_traits::NodePrimitives for EthPrimitives {
43    type Block = crate::Block;
44    type BlockHeader = alloy_consensus::Header;
45    type BlockBody = crate::BlockBody;
46    type SignedTx = crate::TransactionSigned;
47    type Receipt = crate::Receipt;
48}