Project: eip712

eip712: Message classes for typed structured data hashing and signing in Ethereum

Project Details

Latest version
0.2.3
Home Page
https://github.com/ApeWorX/eip712
PyPI Page
https://pypi.org/project/eip712/

Project Popularity

PageRank
0.005312328688197113
Number of downloads
38209

Quick Start

Message classes for typed structured data hashing and signing in Ethereum. See EIP-712 for details.

Dependencies

Installation

via pip

You can install the latest release via pip:

pip install eip712

via 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

Quick Usage

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

Initialize a Person object as you would normally

person = Person(name="Joe", wallet="0xa27CEF8aF2B6575903b676e5644657FAe96F491F")