eip712: Message classes for typed structured data hashing and signing in Ethereum
Message classes for typed structured data hashing and signing in Ethereum. See EIP-712 for details.
pip
You can install the latest release via pip
:
pip install eip712
setuptools
You can clone the repository and use setuptools
for the most up-to-date version:
git clone https://github.com/ApeWorX/eip712.git
cd eip712
python3 setup.py install
Define EIP-712 models:
from eip712.messages import EIP712Message, EIP712Type
class Person(EIP712Type):
name: "string"
wallet: "address"
class Mail(EIP712Message):
_chainId_ = 1
_name_ = "Ether Mail"
_verifyingContract_ = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
_version_ = "1"
sender: Person
receiver: Person
person = Person(name="Joe", wallet="0xa27CEF8aF2B6575903b676e5644657FAe96F491F")