Skip to content

Export ABI Types #150

@fubuloubu

Description

@fubuloubu

It would be handy to be able to leverage this package to create type hints for other packages that describe restrictions in abi types for different purposes, e.g. https://github.com/ApeWorX/eip712 where we currently use is_encodeable_type to parse a deferred type when describing an EIP-712 structured message like so:

class Order(EIP712Message):
    a: "address"  # implicit validation using `eth_abi.is_encodeable_type`

It would be much nicer if all of the registered types were made available in mypy-compliant form to use for type checking code as follows:

from eth_abi.types import address

class Order(EIP712Message):
    a: address  # explicit validation provided by eth_abi

Ideally, these types would work as aliases for int, Decimal, str, bytes, etc., doing the proper size and bounds checks as well (or at least allowing us to perform that validation easily) to make it easier to integrate this work into other libraries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions