Skip to content

Conversation

@ilijapet
Copy link
Contributor

What was wrong?

Related to Issue #1628
Closes #1628

The web3.types module contains 53 TypedDict definitions that enable IDE autocompletion and type checking, but these types were not documented. Third-party developers had to read the source code to understand the available types and their fields.

How was it fixed?

Added comprehensive documentation for TypedDict types in docs/types.rst:

  • 28 TypedDicts with detailed field documentation including types and descriptions
  • Complete Type Reference listing all 53 types organized by category
  • Usage examples showing how to import and use types for better IDE support
  • Type checker integration guide for mypy and pyright
  • EIP transaction type fields documented (EIP-2930, EIP-1559, EIP-4844, EIP-7702)

Validation performed:

  1. Created test script exercising all documented types against Anvil fork (10/10 tests pass)
  2. Wrote script comparing types.py vs types.rst to verify complete coverage (53/53 types documented)
  3. Verified EIP transaction fields against official specifications

Notable clarification added:

  • SignedTx docs now clarify that sign_transaction() returns an eth_account.SignedTransaction object (with .raw_transaction), not a SignedTx TypedDict

Todo:

Cute Animal Picture

https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Ball_python_lucy.JPG/1280px-Ball_python_lucy.JPG

…module, enabling better IDE autocompletion and type checking support. Closes ethereum#1628
  - Add BlockReceipts to Transactions section
  - Add EthSubscriptionResult and GethSyncingSubscriptionResponse to Subscriptions
  - Add RPCEndpoint to Aliases section
  - Clarify that sign_transaction() returns eth_account.SignedTransaction object,
    not a SignedTx TypedDict, with correct usage examples
@fselmo
Copy link
Collaborator

fselmo commented Jan 12, 2026

@ilijapet is this still in draft? Are you ready for this to be reviewed? Can you mark it Ready for review if so?

@ilijapet ilijapet marked this pull request as ready for review January 12, 2026 17:44
@ilijapet
Copy link
Contributor Author

ilijapet commented Jan 12, 2026

@ilijapet is this still in draft? Are you ready for this to be reviewed? Can you mark it Ready for review if so?

@fselmo It is ready for review now...Only thing is that I see that some lint error just appear. Hmmm, I see also on one PR bellow. + when I make lint locally all check are passing

@ilijapet
Copy link
Contributor Author

ilijapet commented Jan 12, 2026

@fselmo here you can found script that I run https://gist.github.com/ilijapet/f3132324e648521882ed8b964755802f

  • main.py - Test script (10/10 tests against Anvil mainnet fork)
  • check_types_coverage.py - Coverage checker (77/77 types documented)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation for TypedDict return values of methods usable by 3rd parties

2 participants