alloy-serde
Serde helpers for Ethereum JSON-RPC formats that differ from Serde's defaults.
quantityencodes primitive integers as canonical RPC quantities such as"0x2a". Itsopt,vec,hashmap, andbtreemapmodules cover common containers.ttdhandles geth's mixed number/string representation of terminal total difficulty.storagehandles storage keys and zero-padding cropped storage values.WithOtherFieldspreserves unknown object fields for forwarding or round-tripping RPC payloads.
use ;
let request: Request = from_str?;
assert_eq!;
assert_eq!;
# Ok::
For deserialization-only helpers such as null_as_default, use
deserialize_with and pair it with #[serde(default)] when missing fields should also use the
default. The no-prefix hex helpers are serialization-only and therefore use serialize_with.