{"id":23659,"library":"eip712","title":"eip712","description":"Message classes for typed structured data hashing and signing in Ethereum, based on EIP-712. Current version 0.3.3, requires Python >=3.10, <4. Maintained actively by ApeWorX.","status":"active","version":"0.3.3","language":"python","source_language":"en","source_url":"https://github.com/ApeWorX/eip712","tags":["eip712","ethereum","structured-data","signing","pydantic"],"install":[{"cmd":"pip install eip712","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"EIP712Message subclasses pydantic.BaseModel.","package":"pydantic","optional":true},{"reason":"Used for signing and hash computation.","package":"eth-account","optional":true}],"imports":[{"note":"Correct import for the main message class.","symbol":"EIP712Message","correct":"from eip712 import EIP712Message"},{"note":"EIP712Type is exported from top-level eip712 since v0.3.0.","wrong":"from eip712.messages import EIP712Type","symbol":"EIP712Type","correct":"from eip712 import EIP712Type"},{"note":"EIP712Domain is now directly available from eip712.","wrong":"from eip712.domain import EIP712Domain","symbol":"EIP712Domain","correct":"from eip712 import EIP712Domain"}],"quickstart":{"code":"from eip712 import EIP712Message, EIP712Domain\n\nclass Person(EIP712Message):\n    name: str\n    wallet: str\n\nclass Mail(EIP712Message):\n    from_: Person = Person(name='Alice', wallet='0x...')  # field alias\n    to: Person\n    contents: str\n\nmessage = Mail(\n    from_=Person(name='Alice', wallet='0x...'),\n    to=Person(name='Bob', wallet='0x...'),\n    contents='Hello!'\n)\nprint(message.to_message())\nprint(message.encode_712())\nprint(message.signable_message())","lang":"python","description":"Define EIP-712 message structures using pydantic-based classes and generate the structured data for signing."},"warnings":[{"fix":"Ensure you use pydantic field types and aliases instead of dataclassy patterns.","message":"v0.3.0 replaced dataclassy with pydantic. If you subclasses EIP712Message directly, you need to adapt to pydantic behavior (e.g., field aliases, validation).","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Remove EIP712Type subclass usage; define nested types as pydantic models directly.","message":"In v0.3.0, EIP712Type was removed as a separate class. Inner types should be plain pydantic models or Python types.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Use from eip712 import EIP712Message, Field; then define from_: str = Field(alias='from')","message":"Field names that conflict with Python keywords (e.g., 'from') must use pydantic aliasing with Field(alias=...).","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"Replace 'uint256' with int and add pydantic validators if needed.","message":"String type annotations like 'uint256' are deprecated; use pydantic numeric types (e.g., int, float) or custom validators.","severity":"deprecated","affected_versions":">=0.3.0"}],"env_vars":null,"search_vec":"'-712':16 '0.3.3':19 '3.10':22 '4':23 'activ':25 'apeworx':27 'base':13 'class':3 'current':17 'data':7,32 'eip':15 'eip712':1,28 'ethereum':12,29 'hash':8 'maintain':24 'messag':2 'pydant':34 'python':21 'requir':20 'sign':10,33 'structur':6,31 'structured-data':30 'type':5 'version':18","created_at":"2026-05-01T08:08:57.041846+00:00","updated_at":"2026-05-01T08:08:57.041846+00:00","problems":[{"fix":"Run 'pip install eip712'","cause":"Library not installed.","error":"ModuleNotFoundError: No module named 'eip712'"},{"fix":"Use pydantic models instead; or upgrade to a version <0.3.0 if you must use EIP712Type.","cause":"EIP712Type was removed in version 0.3.0.","error":"ImportError: cannot import name 'EIP712Type' from 'eip712'"},{"fix":"Define the field with an alias: from_: Person = Field(alias='from')","cause":"Field name 'from_' is used but pydantic treats it as a field name; likely missing alias.","error":"ValidationError: 1 validation error for Mail\nfrom_\n  field required"},{"fix":"Use 'encode_712()' or 'signable_message()' depending on needs. Check docstrings.","cause":"Method 'to_message' may not exist in older versions.","error":"AttributeError: 'EIP712Message' object has no attribute 'to_message'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.3.3","cli_name":"","cli_version":null,"type":"library","homepage":"https://apeworx.io","github":"https://github.com/ApeWorX/eip712","docs":null,"changelog":null,"pypi":"https://pypi.org/project/eip712/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}