ethereum / eth-account

Account abstraction library for web3.py
http://eth-account.readthedocs.io/
MIT License
258 stars 155 forks source link

DeprecationWarning: `encode_structured_data` #243

Closed DvScripts closed 9 months ago

DvScripts commented 9 months ago

What happened?

So i was using encode_structured_data and i received this ->

DeprecationWarning: encode_structured_data is deprecated and will be removed in a future release. Use encode_typed_data instead. So i changed it to -> encode_typed_data and i have error like this ->

structure_message = encode_typed_data(sign_structure)

raise ValueError(f"Invalid domain key: {k}")

ValueError: Invalid domain key: 'domain`

how to solve this ? I can add that with -> encode_structured_data it works correctly

Code that produced the error

Full error output

No response

Fill this section in if you know how this could or should be fixed

No response

eth-account Version

0.10.0

Python Version

3.9.0

Operating System

Windows

Output from pip freeze

No response

pacrob commented 9 months ago

The interface changed slightly from encode_structured_data to encode_typed_data to allow for different formats for the message data.

Short answer: structure_message = encode_typed_data(full_message = sign_structure) should do the trick.

You can see updated docs with examples here. The method is new, feedback welcome!

DvScripts commented 9 months ago

The interface changed slightly from encode_structured_data to encode_typed_data to allow for different formats for the message data.

Short answer: structure_message = encode_typed_data(full_message = sign_structure) should do the trick.

You can see updated docs with examples here. The method is new, feedback welcome!

Thanks, that one helped. i was missing full message=