1#![doc = include_str!("../README.md")]
2#![doc(
3 html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
4 html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
5)]
6#![cfg_attr(not(test), warn(unused_crate_dependencies))]
7#![cfg_attr(docsrs, feature(doc_cfg))]
8#![cfg_attr(not(feature = "std"), no_std)]
9
10extern crate alloc;
11
12use alloy_primitives::{hex, B256};
13use serde::Serializer;
14
15pub mod displayfromstr;
16
17pub mod checksum;
18
19mod optional;
20pub use self::optional::*;
21
22pub mod quantity;
23
24pub mod storage;
26pub use storage::JsonStorageKey;
27
28pub mod ttd;
29pub use ttd::*;
30
31mod other;
32pub use other::{OtherFields, WithOtherFields};
33
34pub fn serialize_hex_string_no_prefix<S, T>(x: T, s: S) -> Result<S::Ok, S::Error>
38where
39 S: Serializer,
40 T: AsRef<[u8]>,
41{
42 s.serialize_str(&hex::encode(x.as_ref()))
43}
44
45pub fn serialize_b256_hex_string_no_prefix<S>(x: &B256, s: S) -> Result<S::Ok, S::Error>
47where
48 S: Serializer,
49{
50 s.collect_str(&format_args!("{x:x}"))
51}