eip712 0.2.2__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {eip712-0.2.2 → eip712-0.2.3}/.pre-commit-config.yaml +1 -1
- {eip712-0.2.2 → eip712-0.2.3}/PKG-INFO +1 -1
- {eip712-0.2.2 → eip712-0.2.3}/eip712/messages.py +21 -3
- {eip712-0.2.2 → eip712-0.2.3}/eip712/version.py +2 -2
- {eip712-0.2.2 → eip712-0.2.3}/eip712.egg-info/PKG-INFO +1 -1
- {eip712-0.2.2 → eip712-0.2.3}/eip712.egg-info/requires.txt +12 -12
- {eip712-0.2.2 → eip712-0.2.3}/setup.py +8 -8
- {eip712-0.2.2 → eip712-0.2.3}/.github/ISSUE_TEMPLATE/bug.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/ISSUE_TEMPLATE/feature.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/ISSUE_TEMPLATE/work-item.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/release-drafter.yml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/workflows/codeql.yaml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/workflows/commitlint.yaml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/workflows/docs.yaml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/workflows/draft.yaml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/workflows/prtitle.yaml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/workflows/publish.yaml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.github/workflows/test.yaml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.gitignore +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/.mdformat.toml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/CONTRIBUTING.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/LICENSE +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/README.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/build_docs.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/_static/custom.css +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/_static/custom.js +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/_templates/layout.html +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/conf.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/favicon.ico +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/index.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/logo.gif +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/methoddocs/common.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/methoddocs/messages.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/docs/userguides/quickstart.md +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/eip712/__init__.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/eip712/common.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/eip712/py.typed +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/eip712.egg-info/SOURCES.txt +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/eip712.egg-info/dependency_links.txt +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/eip712.egg-info/not-zip-safe +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/eip712.egg-info/top_level.txt +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/pyproject.toml +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/setup.cfg +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/tests/__init__.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/tests/conftest.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/tests/test_common.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/tests/test_fuzzing.py +0 -0
- {eip712-0.2.2 → eip712-0.2.3}/tests/test_messages.py +0 -0
|
@@ -3,7 +3,7 @@ Message classes for typed structured data hashing and signing in Ethereum.
|
|
|
3
3
|
"""
|
|
4
4
|
from typing import Any, Dict, Optional
|
|
5
5
|
|
|
6
|
-
from dataclassy import dataclass, fields
|
|
6
|
+
from dataclassy import asdict, dataclass, fields
|
|
7
7
|
from eth_abi import is_encodable_type
|
|
8
8
|
from eth_account.messages import SignableMessage, hash_domain, hash_eip712_message
|
|
9
9
|
from eth_utils import keccak
|
|
@@ -143,12 +143,30 @@ class EIP712Message(EIP712Type):
|
|
|
143
143
|
The current message as a :class:`SignableMessage` named tuple instance.
|
|
144
144
|
**NOTE**: The 0x19 prefix is NOT included.
|
|
145
145
|
"""
|
|
146
|
+
domain = _prepare_data_for_hashing(self._domain_["domain"])
|
|
147
|
+
types = _prepare_data_for_hashing(self._types_)
|
|
148
|
+
message = _prepare_data_for_hashing(self._body_["message"])
|
|
146
149
|
return SignableMessage(
|
|
147
150
|
HexBytes(1),
|
|
148
|
-
HexBytes(hash_domain(
|
|
149
|
-
HexBytes(hash_eip712_message(
|
|
151
|
+
HexBytes(hash_domain(domain)),
|
|
152
|
+
HexBytes(hash_eip712_message(types, message)),
|
|
150
153
|
)
|
|
151
154
|
|
|
152
155
|
|
|
153
156
|
def calculate_hash(msg: SignableMessage) -> HexBytes:
|
|
154
157
|
return HexBytes(keccak(b"".join([bytes.fromhex("19"), *msg])))
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _prepare_data_for_hashing(data: Dict) -> Dict:
|
|
161
|
+
result: Dict = {}
|
|
162
|
+
|
|
163
|
+
for key, value in data.items():
|
|
164
|
+
item: Any = value
|
|
165
|
+
if isinstance(value, EIP712Type):
|
|
166
|
+
item = asdict(value)
|
|
167
|
+
elif isinstance(value, dict):
|
|
168
|
+
item = _prepare_data_for_hashing(item)
|
|
169
|
+
|
|
170
|
+
result[key] = item
|
|
171
|
+
|
|
172
|
+
return result
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
dataclassy<1,>=0.8.2
|
|
2
|
-
eth-abi<5,>=4.1
|
|
3
|
-
eth-account<0.
|
|
2
|
+
eth-abi<5,>=4.2.1
|
|
3
|
+
eth-account<0.11,>=0.10.0
|
|
4
4
|
eth-hash[pycryptodome]
|
|
5
|
-
eth-typing<4,>=3.
|
|
6
|
-
eth-utils<3,>=2.1
|
|
5
|
+
eth-typing<4,>=3.5.2
|
|
6
|
+
eth-utils<3,>=2.3.1
|
|
7
7
|
hexbytes<1,>=0.3.0
|
|
8
8
|
|
|
9
9
|
[dev]
|
|
@@ -11,12 +11,12 @@ pytest<8,>=6.0
|
|
|
11
11
|
pytest-xdist
|
|
12
12
|
pytest-cov
|
|
13
13
|
hypothesis<7,>=6.70.0
|
|
14
|
-
black<24,>=23.
|
|
15
|
-
mypy<2,>=1.
|
|
14
|
+
black<24,>=23.12.0
|
|
15
|
+
mypy<2,>=1.7.1
|
|
16
16
|
types-setuptools
|
|
17
|
-
flake8<7,>=6.
|
|
17
|
+
flake8<7,>=6.1.0
|
|
18
18
|
isort<6,>=5.12.0
|
|
19
|
-
mdformat<0.8,>=0.7.
|
|
19
|
+
mdformat<0.8,>=0.7.17
|
|
20
20
|
mdformat-gfm<0.4,>=0.3.5
|
|
21
21
|
mdformat-frontmatter<0.5,>=0.4.1
|
|
22
22
|
myst-parser<0.19,>=0.18.1
|
|
@@ -39,12 +39,12 @@ sphinx_rtd_theme<2,>=1.2.0
|
|
|
39
39
|
sphinxcontrib-napoleon>=0.7
|
|
40
40
|
|
|
41
41
|
[lint]
|
|
42
|
-
black<24,>=23.
|
|
43
|
-
mypy<2,>=1.
|
|
42
|
+
black<24,>=23.12.0
|
|
43
|
+
mypy<2,>=1.7.1
|
|
44
44
|
types-setuptools
|
|
45
|
-
flake8<7,>=6.
|
|
45
|
+
flake8<7,>=6.1.0
|
|
46
46
|
isort<6,>=5.12.0
|
|
47
|
-
mdformat<0.8,>=0.7.
|
|
47
|
+
mdformat<0.8,>=0.7.17
|
|
48
48
|
mdformat-gfm<0.4,>=0.3.5
|
|
49
49
|
mdformat-frontmatter<0.5,>=0.4.1
|
|
50
50
|
|
|
@@ -10,12 +10,12 @@ extras_require = {
|
|
|
10
10
|
"hypothesis>=6.70.0,<7", # Strategy-based fuzzer
|
|
11
11
|
],
|
|
12
12
|
"lint": [
|
|
13
|
-
"black>=23.
|
|
14
|
-
"mypy>=1.
|
|
13
|
+
"black>=23.12.0,<24", # auto-formatter and linter
|
|
14
|
+
"mypy>=1.7.1,<2", # Static type analyzer
|
|
15
15
|
"types-setuptools", # Needed for mypy type shed
|
|
16
|
-
"flake8>=6.
|
|
16
|
+
"flake8>=6.1.0,<7", # Style linter
|
|
17
17
|
"isort>=5.12.0,<6", # Import sorting linter
|
|
18
|
-
"mdformat>=0.7.
|
|
18
|
+
"mdformat>=0.7.17,<0.8", # Auto-formatter for markdown
|
|
19
19
|
"mdformat-gfm>=0.3.5,<0.4", # Needed for formatting GitHub-flavored markdown
|
|
20
20
|
"mdformat-frontmatter>=0.4.1,<0.5", # Needed for headers in GH issue templates
|
|
21
21
|
],
|
|
@@ -65,11 +65,11 @@ setup(
|
|
|
65
65
|
include_package_data=True,
|
|
66
66
|
install_requires=[
|
|
67
67
|
"dataclassy>=0.8.2,<1",
|
|
68
|
-
"eth-abi>=4.1
|
|
69
|
-
"eth-account>=0.
|
|
68
|
+
"eth-abi>=4.2.1,<5",
|
|
69
|
+
"eth-account>=0.10.0,<0.11",
|
|
70
70
|
"eth-hash[pycryptodome]", # NOTE: Pinned by eth-abi
|
|
71
|
-
"eth-typing>=3.
|
|
72
|
-
"eth-utils>=2.1
|
|
71
|
+
"eth-typing>=3.5.2,<4",
|
|
72
|
+
"eth-utils>=2.3.1,<3",
|
|
73
73
|
"hexbytes>=0.3.0,<1",
|
|
74
74
|
],
|
|
75
75
|
python_requires=">=3.8,<4",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|