Structs containing any Bytes types would error out with the standard json.dumps call, since it does not support json-encoding bytes by default.
Major new additions:
EIP712Struct().to_message_json() provides a JSON dump using a custom JSONEncoder class which can serialize bytes objects into hexstrings.
The Bytes type can now accept a string. Strings are assumed as hexstrings, and are converted into the bytes format.
Additionally, this adds __eq__ and __hash__ functions to EIP712Struct - the need arose due to some comparisons I wanted to make during new tests, but it should prove useful to general development efforts.
Structs containing any Bytes types would error out with the standard
json.dumps
call, since it does not support json-encoding bytes by default.Major new additions:
EIP712Struct().to_message_json()
provides a JSON dump using a customJSONEncoder
class which can serializebytes
objects into hexstrings.Bytes
type can now accept a string. Strings are assumed as hexstrings, and are converted into thebytes
format.__eq__
and__hash__
functions to EIP712Struct - the need arose due to some comparisons I wanted to make during new tests, but it should prove useful to general development efforts.