Open fubuloubu opened 3 years ago
@fubuloubu I just came across this - does the eth-typing
library solve this?
@fubuloubu I just came across this - does the
eth-typing
library solve this?
No, not quite. My thinking was to be able to say things like this:
class Order(EIP712Message):
a: abi_types.address
b: abi_types.bytes32
c: abi_types.array[abi_types.uint256]
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: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:
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.