You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like that eip712_encode_hash encode string bytes also like the following example: "Message": [ {"name": "oneByte", "type": "bytes1"} ] "message": {"oneByte": "0x01"}
Currently this is not possible because eip712_encode_hash is using eth_abi that expects python bytes.
String uint256 feature
I would like that eip712_encode_hash encode string uint also like the following example: "Message": [ {"name": "stringNum", "type": "uint256"} ] "message": {"stringNum": "1234"}
Possible solution
Check in _encode_field(name, typ, value) if is bytes type the value is an instance of str and in that case convert to bytes bytes.fromhex(string).
Similar solution for uint but converting it from string to python int.
Related issues
The text was updated successfully, but these errors were encountered:
moisses89
changed the title
eip712_encode_hash encode string bytes and string uint256
Add EIP712 support for bytes and uint formatted as string
Jan 10, 2023
moisses89
changed the title
Add EIP712 support for bytes and uint formatted as string
eip712_encode_hash encode string bytes and string uint256
Jan 10, 2023
What is needed?
String bytes feature
I would like that
eip712_encode_hash
encode stringbytes
also like the following example:"Message": [ {"name": "oneByte", "type": "bytes1"} ] "message": {"oneByte": "0x01"}
Currently this is not possible because
eip712_encode_hash
is usingeth_abi
that expects python bytes.String uint256 feature
I would like that
eip712_encode_hash
encode stringuint
also like the following example:"Message": [ {"name": "stringNum", "type": "uint256"} ] "message": {"stringNum": "1234"}
Possible solution
Check in _encode_field(name, typ, value) if is bytes type the value is an instance of
str
and in that case convert to bytesbytes.fromhex(string)
.Similar solution for
uint
but converting it from string to python int.Related issues
The text was updated successfully, but these errors were encountered: