Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ApeWorX/eip712
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Jun 12, 2024
2 parents eed3f8d + 422aabb commit 8f0d245
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 44 deletions.
7 changes: 4 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ fixes: #

### Checklist

- [ ] Passes all linting checks (pre-commit and CI jobs)
- [ ] New test cases have been added and are passing
<!-- All PRs must complete the following checklist before being merged -->

- [ ] All changes are completed
- [ ] New test cases have been added
- [ ] Documentation has been updated
- [ ] PR title follows [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) standard (will be automatically included in the changelog)
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
contents: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prtitle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand All @@ -42,10 +42,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand All @@ -62,14 +62,14 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -88,10 +88,10 @@ jobs:
fail-fast: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,7 @@ version.py

# Ape projects
.build/

# IDE files
.idea
.vscode
1 change: 0 additions & 1 deletion .mdformat.toml

This file was deleted.

8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml

Expand All @@ -10,18 +10,18 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.12.0
rev: 24.4.2
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies: [types-setuptools, pydantic]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ See [EIP-712](https://eips.ethereum.org/EIPS/eip-712) for details.

## Dependencies

- [python3](https://www.python.org/downloads) version 3.8 up to 3.12.
- [python3](https://www.python.org/downloads) version 3.9 up to 3.12.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion eip712/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def create_safe_tx_def(
version: str = "1.3.0",
contract_address: Optional[str] = None,
chain_id: Optional[int] = None,
) -> Type[SafeTx]:
) -> type[SafeTx]:
if not contract_address:
raise ValueError("Must define 'contract_address'")

Expand Down
11 changes: 6 additions & 5 deletions eip712/messages.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
Message classes for typed structured data hashing and signing in Ethereum.
"""
from typing import Any, Dict, Optional

from typing import Any, Optional

from dataclassy import asdict, dataclass, fields
from eth_abi import is_encodable_type
from eth_abi.abi import is_encodable_type # type: ignore[import-untyped]
from eth_account.messages import SignableMessage, hash_domain, hash_eip712_message
from eth_utils import keccak
from eth_utils.curried import ValidationError
Expand Down Expand Up @@ -45,7 +46,7 @@ def _types_(self) -> dict:
Recursively built ``dict`` (name of type ``->`` list of subtypes) of
the underlying fields' types.
"""
types: Dict[str, list] = {repr(self): []}
types: dict[str, list] = {repr(self): []}

for field in fields(self.__class__):
value = getattr(self, field)
Expand Down Expand Up @@ -157,8 +158,8 @@ def calculate_hash(msg: SignableMessage) -> HexBytes:
return HexBytes(keccak(b"".join([bytes.fromhex("19"), *msg])))


def _prepare_data_for_hashing(data: Dict) -> Dict:
result: Dict = {}
def _prepare_data_for_hashing(data: dict) -> dict:
result: dict = {}

for key, value in data.items():
item: Any = value
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ force_grid_wrap = 0
include_trailing_comma = true
multi_line_output = 3
use_parentheses = true

[tool.mdformat]
number = true
19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"hypothesis>=6.70.0,<7", # Strategy-based fuzzer
],
"lint": [
"black>=23.12.0,<24", # auto-formatter and linter
"mypy>=1.7.1,<2", # Static type analyzer
"black>=24.4.2,<25", # auto-formatter and linter
"mypy>=1.10.0,<2", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"flake8>=6.1.0,<7", # Style linter
"flake8>=7.0.0,<8", # Style linter
"isort>=5.12.0,<6", # Import sorting linter
"mdformat>=0.7.17,<0.8", # Auto-formatter for markdown
"mdformat-gfm>=0.3.5,<0.4", # Needed for formatting GitHub-flavored markdown
"mdformat-frontmatter>=0.4.1,<0.5", # Needed for headers in GH issue templates
"mdformat-pyproject>=0.0.1", # Allows configuring in pyproject.toml
],
"release": [ # `release` GitHub Action job uses this
"setuptools", # Installation tool
Expand Down Expand Up @@ -64,15 +65,14 @@
url="https://github.com/ApeWorX/eip712",
include_package_data=True,
install_requires=[
"dataclassy>=0.8.2,<1",
"dataclassy>=0.11.1,<1",
"eth-abi>=5.1.0,<6",
"eth-account>=0.12.0,<0.14",
"eth-hash[pycryptodome]", # NOTE: Pinned by eth-abi
"eth-typing>=3.5.2,<4",
"eth-utils>=2.3.1,<3",
"eth-account>=0.12.1,<0.14",
"eth-typing>=4.1.0,<5",
"eth-utils>=4.1.0,<5",
"hexbytes>=1.2.0,<2",
],
python_requires=">=3.8,<4",
python_requires=">=3.9,<4",
extras_require=extras_require,
py_modules=["eip712"],
license="Apache-2.0",
Expand All @@ -88,7 +88,6 @@
"Operating System :: MacOS",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down

0 comments on commit 8f0d245

Please sign in to comment.