-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- renamed the primary branch from `master` to `main` - code fully typed - dependencies cleaned up - Python 3.8 - 3.12 support - code modernization, including Sourcery clean-up - 99% tests coverage - simplified testing (no more need for docker) - move CI from Travis to GitHub It implicitly fixes issues with `pysha3`, and any compilation errors at installation. Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b05c1df
commit 38fa187
Showing
33 changed files
with
1,513 additions
and
1,116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
updates: | ||
# GitHub Actions | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: daily | ||
|
||
# Python requirements | ||
- package-ecosystem: pip | ||
directory: / | ||
schedule: | ||
interval: daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
cache: pip | ||
- name: Install build dependencies | ||
run: | | ||
python -m pip install -U pip | ||
python -m pip install -e '.[dev]' | ||
- name: Build | ||
run: python -m build | ||
- name: Check | ||
run: twine check --strict dist/* | ||
- name: What will we publish? | ||
run: ls -l dist | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
skip_existing: true | ||
print_hash: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
quality: | ||
name: Quality | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
cache: pip | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip | ||
python -m pip install -e '.[tests]' | ||
- name: Tests | ||
run: ./checks.sh | ||
|
||
tests: | ||
name: "${{ matrix.os.emoji }} ${{ matrix.python.name }}" | ||
runs-on: ${{ matrix.os.runs-on }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- emoji: 🐧 | ||
runs-on: [ubuntu-latest] | ||
- emoji: 🍎 | ||
runs-on: [macos-latest] | ||
- emoji: 🪟 | ||
runs-on: [windows-latest] | ||
python: | ||
- name: CPython 3.8 | ||
runs-on: "3.8" | ||
- name: CPython 3.9 | ||
runs-on: "3.9" | ||
- name: CPython 3.10 | ||
runs-on: "3.10" | ||
- name: CPython 3.11 | ||
runs-on: "3.11" | ||
# Following are disabled because of https://github.com/ethereum/eth-tester/issues/276 | ||
# - name: CPython 3.12 | ||
# runs-on: "3.12" | ||
# Waaaay to soon for 3.13 | ||
# - name: CPython 3.13-dev | ||
# runs-on: "3.13-dev" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python.runs-on }} | ||
cache: pip | ||
check-latest: true | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip | ||
python -m pip install -e '.[tests]' | ||
- name: Tests | ||
run: python -m pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
.eggs/ | ||
*.egg-info/ | ||
dist/ | ||
build/ | ||
.pytest_cache/ | ||
# Files | ||
.coverage | ||
|
||
tests/contracts/build | ||
# Folders | ||
dist/ | ||
.mypy_cache/ | ||
__pycache__/ | ||
.pytest_cache/ | ||
.ruff_cache/ | ||
venv/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
# API | ||
|
||
### `class EIP712Struct` | ||
#### Important methods | ||
## `class EIP712Struct` | ||
|
||
### Primary Methods | ||
|
||
- `.from_message(message_dict: dict)` **(class method)** - Given a standard EIP-712 message dictionary (such as produced from `.to_message`), returns a `NamedTuple` containing the `message` and `domain` `EIP712Struct`s. | ||
- `.to_message(domain: EIP712Struct)` - Convert the struct (and given domain struct) into the standard EIP-712 message structure. | ||
- `.signable_bytes(domain: EIP712Struct)` - Get the standard EIP-712 bytes hash, suitable for signing. | ||
- `.from_message(message_dict: dict)` **(Class method)** - Given a standard EIP-712 message dictionary (such as produced from `.to_message`), returns a NamedTuple containing the `message` and `domain` EIP712Structs. | ||
|
||
#### Other stuff | ||
- `.encode_value()` - Returns a `bytes` object containing the ordered concatenation of each members bytes32 representation. | ||
- `.encode_type()` **(Class method)** - Gets the "signature" of the struct class. Includes nested structs too! | ||
- `.type_hash()` **(Class method)** - The keccak256 hash of the result of `.encode_type()`. | ||
- `.hash_struct()` - Gets the keccak256 hash of the concatenation of `.type_hash()` and `.encode_value()` | ||
### Secundary Methods | ||
|
||
- `.data_dict()` - Returns a dictionary with all data in this struct. Includes nested struct data, if exists. | ||
- `.encode_type()` **(class method)** - Gets the "signature" of the struct class. Includes nested structs too! | ||
- `.encode_value()` - Returns a `bytes` object containing the ordered concatenation of each members `bytes32` representation. | ||
- `.hash_struct()` - Gets the `keccak256` hash of the concatenation of `.type_hash()` and `.encode_value()` | ||
- `.get_data_value(member_name: str)` - Get the value of the given struct member | ||
- `.set_data_value(member_name: str, value: Any)` - Set the value of the given struct member | ||
- `.data_dict()` - Returns a dictionary with all data in this struct. Includes nested struct data, if exists. | ||
- `.get_members()` **(Class method)** - Returns a dictionary mapping each data member's name to it's type. | ||
- `.get_members()` **(class method)** - Returns a dictionary mapping each data member's name to it's type. | ||
- `.type_hash()` **(class method)** - The `keccak256` hash of the result of `.encode_type()`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.