degenbot.types.rpc_types¶

TypedDict definitions for Ethereum RPC response data returned by the Rust extension provider.

Field types correspond to the Rust converters in rust/src/py_converters.rs. All hash/data fields use bytes, all addresses are EIP-55 checksummed strings, and all numeric values are Python ints.

Key naming: Block/transaction dicts use snake_case (produced by the typed Rust converters). Log dicts use camelCase (matching the web3.py convention, as produced by log_to_py_dict).

The web3.types imports (BlockIdentifier, BlockData, FilterParams, LogReceipt, RPCEndpoint, RPCResponse, TxParams) are reproduced here natively so the codebase carries zero web3 type imports (no web3.types.* anywhere). The shapes are deliberately loose (total=False TypedDicts with the fields actually produced/consumed) so they survive the full web3py retirement epic (Pass C) without type-check churn.

Module Contents¶

degenbot.types.rpc_types.BlockIdentifier¶
class degenbot.types.rpc_types.BlockTag¶

Bases: enum.StrEnum

The canonical block-position tags (the eth_getBlockBy* ladder).

Public provider APIs keep accepting the wire strings; parse() is the ONE string → member conversion and provider internals dispatch on members.

Member values are the wire spellings — StrEnum keeps them comparable with the persisted/over-the-wire strings at the read boundary only.

EARLIEST = 'earliest'¶
LATEST = 'latest'¶
PENDING = 'pending'¶
classmethod parse(raw: str) → BlockTag¶

Parse one canonical tag string.

Parameters:

raw – The wire spelling ("latest", "earliest", "pending").

Returns:

The matching member.

Raises:

ValueError – On any other string — the provider ladder’s loud unsupported-identifier contract.

to_block_number(head: int) → int¶

Resolve the tag against the current head block number.

Parameters:

head – The provider’s current block number.

Returns:

The concrete block number the tag names (latest → head, earliest → 0, pending → head + 1).

degenbot.types.rpc_types.TxParams¶
degenbot.types.rpc_types.TransactionData¶
class degenbot.types.rpc_types.BlockData¶

Bases: TypedDict

Full block data returned by get_block().

All fields are optional at the type level because the set of present fields varies by network and hardfork. In practice, hash, parent_hash, sha3_uncles, miner, state_root, transactions_root, receipts_root, logs_bloom, difficulty, number, gas_limit, gas_used, timestamp, extra_data, mix_hash, and nonce are always present for post-merge blocks.

hash: bytes¶
parent_hash: bytes¶
sha3_uncles: bytes¶
miner: str¶
state_root: bytes¶
transactions_root: bytes¶
receipts_root: bytes¶
logs_bloom: bytes¶
difficulty: int¶
number: int¶
gas_limit: int¶
gas_used: int¶
timestamp: int¶
extra_data: bytes¶
mix_hash: bytes¶
nonce: bytes¶
base_fee_per_gas: int | None¶
withdrawals_root: bytes | None¶
blob_gas_used: int | None¶
excess_blob_gas: int | None¶
parent_beacon_block_root: bytes | None¶
requests_hash: bytes | None¶
block_access_list_hash: bytes | None¶
slot_number: int | None¶
total_difficulty: int | None¶
size: int | None¶
uncles: list[bytes]¶
transactions: list[bytes] | list[TransactionData] | None¶
withdrawals: list[_WithdrawalData] | None¶
degenbot.types.rpc_types.TransactionReceiptData¶
class degenbot.types.rpc_types.LogData¶

Bases: TypedDict

Loose log entry data — eth_getLogs / subscription stream entries.

Some fields may be None for pending (un-mined) entries. Uses camelCase keys matching the web3.py convention.

address: str¶
topics: list[bytes]¶
data: bytes¶
blockNumber: int | None¶
blockHash: bytes | None¶
transactionHash: bytes | None¶
transactionIndex: int | None¶
logIndex: int | None¶
removed: bool¶
class degenbot.types.rpc_types.LogReceipt¶

Bases: TypedDict

Confirmed-log entry shape — was web3.types.LogReceipt.

Strict TypedDict (all fields required) for log entries consumed from confirmed blocks: consumers expect plain int (not int | None), matching web3’s exact shape without the looseness the pending-aware LogData carries.

address: degenbot._ffi.ChecksummedAddress¶
blockHash: bytes¶
blockNumber: int¶
data: bytes¶
logIndex: int¶
removed: bool¶
topics: list[bytes]¶
transactionHash: bytes¶
transactionIndex: int¶