reth::rpc::types::serde_helpers

Module quantity

Expand description

Serde functions for encoding primitive numbers using the Ethereum JSON-RPC “quantity” format.

This is defined as a “hex encoded unsigned integer”, with a special case of 0 being 0x0.

A regex for this format is: ^0x([1-9a-f]+[0-9a-f]*|0)$.

This is only valid for human-readable serde implementations. For non-human-readable implementations, the format is unspecified. Currently, it uses a fixed-width big-endian byte-array.

Modules§

  • Serde functions for encoding a BTreeMap of primitive numbers using the Ethereum “quantity” format.
  • Serde functions for encoding a HashMap of primitive numbers using the Ethereum “quantity” format.
  • Serde functions for encoding optional primitive numbers using the Ethereum “quantity” format.
  • serde functions for handling Vec<Vec<u128>> via U128
  • Serde functions for encoding a list of primitive numbers using the Ethereum “quantity” format.

Functions§

  • Deserializes a primitive number from a “quantity” hex string.
  • Serializes a primitive number as a “quantity” hex string.