Skip to content

Commit

Permalink
chore: update docs and setup (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotPeopling2day authored Sep 2, 2022
1 parent 9513404 commit c5b4e48
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 22 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
run: black --check .

- name: Run flake8
run: flake8 ./ape_trezor ./tests ./setup.py
run: flake8 .

- name: Run isort
run: isort --check-only --diff ./ape_trezor ./tests
run: isort --check-only .

type-check:
runs-on: ubuntu-latest
Expand All @@ -48,11 +48,12 @@ jobs:
run: mypy .

functional:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

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

steps:
- uses: actions/checkout@v2
Expand All @@ -68,8 +69,8 @@ jobs:
pip install .[test]
- name: Run Tests
run: pytest -m "not fuzzing"
#
run: pytest -m "not fuzzing" -n 0 -s --cov

# NOTE: uncomment this block after you've marked tests with @pytest.mark.fuzzing
# fuzzing:
# runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
rev: v0.971
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-requests]
additional_dependencies: [types-requests]


default_language_version:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd ape-trezor
python3 -m venv venv
source venv/bin/activate

# Install ape into the virtual environment
# Install ape-trezor into the virtual environment
python setup.py install

# Install the developer dependencies (-e is interactive mode)
Expand Down
44 changes: 39 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,50 @@ python3 setup.py install

## Quick Usage

You must have the Trezor USB device connected.

Then, add accounts:

```bash
ape trezor add [PICK AN ALIAS]
ape trezor add <alias>
```
you can now load the account like any other account in Ape console and then use it to sign transactions.

Trezor accounts have the following capabilities in `ape`:

1. Can sign transactions
2. Can sign messages using the default EIP-191 specification


To list just your Trezor accounts in `ape`, do:

```bash
ape trezor list
```

## Remove accounts

You can also remove accounts:

```bash
ape trezor delete <alias>
ape trezor delete-all
```

## Sign Messages

You can sign messages with your accounts:

```bash
ape trezor sign-message <alias> "hello world"
```

## Verify Messages

You can also verify a message with a signature:

```bash
ape trezor sign-message [YOUR TREZOR ALIAS] "hello world"
ape trezor verify "hello world"
ape trezor verify-message "hello world" <signature>
```
the output of `verify` should be the same address as the account `$account_name`

## Development

Expand Down
10 changes: 5 additions & 5 deletions ape_trezor/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def _list(cli_ctx):
"""List your Trezor accounts in ape"""

trezor_accounts = accounts.get_accounts_by_type(type_=TrezorAccount)
num_of_accts = len(trezor_accounts)

if len(trezor_accounts) == 0:
cli_ctx.logger.warning("No accounts found.")
if num_of_accts == 0:
cli_ctx.logger.warning("No Trezor accounts found.")
return

num_accounts = len(accounts)
header = f"Found {num_accounts} account"
header += "s:" if num_accounts > 1 else ":"
header = f"Found {num_of_accts} Trezor account"
header += "s:" if num_of_accts > 1 else ":"
click.echo(header)

for account in trezor_accounts:
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
include_package_data=True,
install_requires=[
"importlib-metadata ; python_version<'3.8'",
"eth-ape>=0.4.0,<0.5.0",
"eth-ape>=0.4.4,<0.5.0",
"eth-account", # Use same version as eth-ape
"eth-typing>=2.2.2",
"click>=8.1.0",
"trezor>=0.13.0",
"eth-typing>=3.1.0", # Influenced by eth-ape so no upper pin
"click", # Use same version as eth-ape
"trezor>=0.13.3,<0.14",
],
entry_points={
"ape_cli_subcommands": [
Expand Down

0 comments on commit c5b4e48

Please sign in to comment.