2n20 0.1.0__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.
- 2n20-0.1.0/LICENSE +21 -0
- 2n20-0.1.0/MANIFEST.in +8 -0
- 2n20-0.1.0/PKG-INFO +145 -0
- 2n20-0.1.0/README.md +104 -0
- 2n20-0.1.0/dependency-review.json +859 -0
- 2n20-0.1.0/pyproject.toml +59 -0
- 2n20-0.1.0/requirements-release.txt +695 -0
- 2n20-0.1.0/scripts/build_release.py +100 -0
- 2n20-0.1.0/setup.cfg +4 -0
- 2n20-0.1.0/src/2n20.egg-info/PKG-INFO +145 -0
- 2n20-0.1.0/src/2n20.egg-info/SOURCES.txt +30 -0
- 2n20-0.1.0/src/2n20.egg-info/dependency_links.txt +1 -0
- 2n20-0.1.0/src/2n20.egg-info/entry_points.txt +2 -0
- 2n20-0.1.0/src/2n20.egg-info/requires.txt +22 -0
- 2n20-0.1.0/src/2n20.egg-info/top_level.txt +1 -0
- 2n20-0.1.0/src/twon20/__init__.py +3 -0
- 2n20-0.1.0/src/twon20/__main__.py +3 -0
- 2n20-0.1.0/src/twon20/cli.py +116 -0
- 2n20-0.1.0/src/twon20/consent.py +99 -0
- 2n20-0.1.0/src/twon20/deployments.json +50 -0
- 2n20-0.1.0/src/twon20/discovery.py +201 -0
- 2n20-0.1.0/src/twon20/errors.py +7 -0
- 2n20-0.1.0/src/twon20/files.py +133 -0
- 2n20-0.1.0/src/twon20/rpc.py +93 -0
- 2n20-0.1.0/src/twon20/status.py +93 -0
- 2n20-0.1.0/tests/fixtures/consent.public.json +10 -0
- 2n20-0.1.0/tests/fixtures/interoperability.public.json +8 -0
- 2n20-0.1.0/tests/support.py +97 -0
- 2n20-0.1.0/tests/test_consent.py +86 -0
- 2n20-0.1.0/tests/test_discovery.py +95 -0
- 2n20-0.1.0/tests/test_files_cli.py +127 -0
- 2n20-0.1.0/tests/test_status_transport.py +82 -0
2n20-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 2n20
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
2n20-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
include LICENSE README.md requirements-release.txt dependency-review.json
|
|
2
|
+
recursive-include src/twon20 *.py *.json
|
|
3
|
+
recursive-include tests *.py *.public.json
|
|
4
|
+
include scripts/build_release.py
|
|
5
|
+
prune .venv
|
|
6
|
+
prune build
|
|
7
|
+
prune dist
|
|
8
|
+
global-exclude *.key *.pem .env .env.* config.json notes.txt
|
2n20-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 2n20
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local trading-key setup and public connection checks for 2n20 creators
|
|
5
|
+
Author: 2n20
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://2n20.org
|
|
8
|
+
Project-URL: Documentation, https://2n20.org/docs/quickstart
|
|
9
|
+
Project-URL: Repository, https://github.com/2n20/2n20
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Topic :: Utilities
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: annotated-types==0.8.0
|
|
19
|
+
Requires-Dist: bitarray==3.11.0
|
|
20
|
+
Requires-Dist: ckzg==2.1.8
|
|
21
|
+
Requires-Dist: cytoolz==1.1.0
|
|
22
|
+
Requires-Dist: eth-account==0.13.7
|
|
23
|
+
Requires-Dist: eth-hash==0.8.0
|
|
24
|
+
Requires-Dist: eth-keyfile==0.8.1
|
|
25
|
+
Requires-Dist: eth-keys==0.8.0
|
|
26
|
+
Requires-Dist: eth-rlp==3.0.0
|
|
27
|
+
Requires-Dist: eth-typing==6.0.0
|
|
28
|
+
Requires-Dist: eth-utils==6.0.0
|
|
29
|
+
Requires-Dist: eth_abi==6.0.0
|
|
30
|
+
Requires-Dist: hexbytes==2.0.0
|
|
31
|
+
Requires-Dist: parsimonious==0.10.0
|
|
32
|
+
Requires-Dist: pycryptodome==3.23.0
|
|
33
|
+
Requires-Dist: pydantic==2.13.5
|
|
34
|
+
Requires-Dist: pydantic_core==2.46.5
|
|
35
|
+
Requires-Dist: regex==2026.9.10
|
|
36
|
+
Requires-Dist: rlp==5.0.0
|
|
37
|
+
Requires-Dist: toolz==1.1.0
|
|
38
|
+
Requires-Dist: typing-inspection==0.4.4
|
|
39
|
+
Requires-Dist: typing_extensions==4.16.0
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# 2n20 creator setup
|
|
43
|
+
|
|
44
|
+
The official 2n20 CLI prepares trading-key consent on the computer or server
|
|
45
|
+
where your existing strategy runs. It supplies public account configuration
|
|
46
|
+
and read-only checks. You supply and run your own strategy in any language.
|
|
47
|
+
|
|
48
|
+
Requires Python 3.10 or later on Linux, macOS or WSL. Run commands in your
|
|
49
|
+
strategy's working directory with its Python environment activated.
|
|
50
|
+
|
|
51
|
+
Copy the setup command from Step 2 of your vault page:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
2n20 setup --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The CLI verifies the chain, factory, deployed contract code, vault bindings,
|
|
58
|
+
trading-account bindings, consent capability and next approval nonce from
|
|
59
|
+
public contract reads. This release bundles the currently supported HyperEVM
|
|
60
|
+
mainnet deployment. Other networks and unsupported deployments fail closed.
|
|
61
|
+
Vault URLs can select only a vault address and network. They cannot override
|
|
62
|
+
RPC endpoints or supply an approval contract, trading account or nonce.
|
|
63
|
+
|
|
64
|
+
Setup creates a new directory with mode `700` under your current working
|
|
65
|
+
directory. Use `--output <new-directory>` to choose its name. The parent must
|
|
66
|
+
already exist. Setup never reuses an existing output directory.
|
|
67
|
+
|
|
68
|
+
- `strategy.key`: your new private trading key, mode `600`. Keep it only on
|
|
69
|
+
your strategy machine. Never paste, import, upload, commit or log this file.
|
|
70
|
+
- `consent.public.json`: a public signature, trading-key address, vault,
|
|
71
|
+
approval contract, nonce and expiry. Import or paste only this file into
|
|
72
|
+
Step 2 and approve it with your creator wallet.
|
|
73
|
+
- `setup.public.json`: public recovery metadata used by `renew`.
|
|
74
|
+
- `strategy.public.json`: public account settings for your existing strategy.
|
|
75
|
+
|
|
76
|
+
Keep the directory and key when a network read fails. If consent expires
|
|
77
|
+
(after one hour), or another approval changes its nonce, run on that same
|
|
78
|
+
strategy machine:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
2n20 renew --directory ./<your-setup-directory>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Renew retains the existing private key and writes a new uniquely named
|
|
85
|
+
`consent.<time>-<random>.public.json`. Import that new public file. If the key
|
|
86
|
+
has already been used, create a fresh setup in a new directory. Existing keys
|
|
87
|
+
and files are never replaced. The app and contract recheck nonce and expiry
|
|
88
|
+
when you approve.
|
|
89
|
+
|
|
90
|
+
After Step 2 confirms trading access, get the public settings for Step 3:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
2n20 config --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet'
|
|
94
|
+
2n20 status --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use `tradingAccount` as your strategy's Hyperliquid account address. It is
|
|
98
|
+
separate from the `vault` holding shares and the `approvalContract` your
|
|
99
|
+
creator wallet calls. Load the private key locally using your strategy's own
|
|
100
|
+
key configuration. The CLI does not load your existing strategy's secrets.
|
|
101
|
+
|
|
102
|
+
Status checks the current public key approval, account binding and funding.
|
|
103
|
+
Missing or inconsistent public evidence never counts as trading readiness.
|
|
104
|
+
Exit code `0` means public trading access was verified, `2` means it is
|
|
105
|
+
pending or unverified, and `1` means verification could not complete. This
|
|
106
|
+
check does not prove your strategy is running. Run its own connection check
|
|
107
|
+
before starting it. These commands submit no transactions, move no collateral
|
|
108
|
+
and place no orders. Setup does not depend on temporary Hyperliquid balance or
|
|
109
|
+
funding API availability.
|
|
110
|
+
|
|
111
|
+
To check a public consent before importing it:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
2n20 check-consent --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet' --consent ./<your-setup-directory>/consent.public.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Reproducible development and release
|
|
118
|
+
|
|
119
|
+
`requirements-release.txt` contains the reviewed, fully pinned build and
|
|
120
|
+
runtime graph with registry SHA-256 hashes. `dependency-review.json` records
|
|
121
|
+
its registry publication dates. All third-party release files were at least
|
|
122
|
+
14 days old when reviewed on October 3, 2026. The wheel also pins the complete
|
|
123
|
+
runtime graph to retain these reviewed versions for ordinary installs.
|
|
124
|
+
The only underlying runtime library is `eth-account` and its dependencies;
|
|
125
|
+
Hyperliquid's SDK is not required.
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
python3 -m venv .venv
|
|
129
|
+
.venv/bin/python -m pip install --require-hashes -r requirements-release.txt
|
|
130
|
+
PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -v
|
|
131
|
+
SOURCE_DATE_EPOCH=1790985600 .venv/bin/python scripts/build_release.py
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The release script calls standard `python -m build --no-isolation`, verifies
|
|
135
|
+
archive paths, and normalizes the source archive ownership, timestamps and
|
|
136
|
+
gzip header. Keep `SOURCE_DATE_EPOCH` fixed for a release. Repeated builds from
|
|
137
|
+
the same source and reviewed environment produce identical wheel and source
|
|
138
|
+
archive bytes. Use `--outdir <directory>` to compare independent builds.
|
|
139
|
+
|
|
140
|
+
Release trust anchors are copied from the repository's reviewed active
|
|
141
|
+
`deployments/development.json`, never fetched as authority from a website.
|
|
142
|
+
A supported deployment change requires reviewing and releasing the package.
|
|
143
|
+
Publishing uses GitHub Actions OIDC Trusted Publishing with dedicated PyPI
|
|
144
|
+
and TestPyPI environments, not stored API tokens. Maintainer release steps
|
|
145
|
+
and publisher identities are in the repository operations runbook.
|
2n20-0.1.0/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# 2n20 creator setup
|
|
2
|
+
|
|
3
|
+
The official 2n20 CLI prepares trading-key consent on the computer or server
|
|
4
|
+
where your existing strategy runs. It supplies public account configuration
|
|
5
|
+
and read-only checks. You supply and run your own strategy in any language.
|
|
6
|
+
|
|
7
|
+
Requires Python 3.10 or later on Linux, macOS or WSL. Run commands in your
|
|
8
|
+
strategy's working directory with its Python environment activated.
|
|
9
|
+
|
|
10
|
+
Copy the setup command from Step 2 of your vault page:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
2n20 setup --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The CLI verifies the chain, factory, deployed contract code, vault bindings,
|
|
17
|
+
trading-account bindings, consent capability and next approval nonce from
|
|
18
|
+
public contract reads. This release bundles the currently supported HyperEVM
|
|
19
|
+
mainnet deployment. Other networks and unsupported deployments fail closed.
|
|
20
|
+
Vault URLs can select only a vault address and network. They cannot override
|
|
21
|
+
RPC endpoints or supply an approval contract, trading account or nonce.
|
|
22
|
+
|
|
23
|
+
Setup creates a new directory with mode `700` under your current working
|
|
24
|
+
directory. Use `--output <new-directory>` to choose its name. The parent must
|
|
25
|
+
already exist. Setup never reuses an existing output directory.
|
|
26
|
+
|
|
27
|
+
- `strategy.key`: your new private trading key, mode `600`. Keep it only on
|
|
28
|
+
your strategy machine. Never paste, import, upload, commit or log this file.
|
|
29
|
+
- `consent.public.json`: a public signature, trading-key address, vault,
|
|
30
|
+
approval contract, nonce and expiry. Import or paste only this file into
|
|
31
|
+
Step 2 and approve it with your creator wallet.
|
|
32
|
+
- `setup.public.json`: public recovery metadata used by `renew`.
|
|
33
|
+
- `strategy.public.json`: public account settings for your existing strategy.
|
|
34
|
+
|
|
35
|
+
Keep the directory and key when a network read fails. If consent expires
|
|
36
|
+
(after one hour), or another approval changes its nonce, run on that same
|
|
37
|
+
strategy machine:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
2n20 renew --directory ./<your-setup-directory>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Renew retains the existing private key and writes a new uniquely named
|
|
44
|
+
`consent.<time>-<random>.public.json`. Import that new public file. If the key
|
|
45
|
+
has already been used, create a fresh setup in a new directory. Existing keys
|
|
46
|
+
and files are never replaced. The app and contract recheck nonce and expiry
|
|
47
|
+
when you approve.
|
|
48
|
+
|
|
49
|
+
After Step 2 confirms trading access, get the public settings for Step 3:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
2n20 config --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet'
|
|
53
|
+
2n20 status --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use `tradingAccount` as your strategy's Hyperliquid account address. It is
|
|
57
|
+
separate from the `vault` holding shares and the `approvalContract` your
|
|
58
|
+
creator wallet calls. Load the private key locally using your strategy's own
|
|
59
|
+
key configuration. The CLI does not load your existing strategy's secrets.
|
|
60
|
+
|
|
61
|
+
Status checks the current public key approval, account binding and funding.
|
|
62
|
+
Missing or inconsistent public evidence never counts as trading readiness.
|
|
63
|
+
Exit code `0` means public trading access was verified, `2` means it is
|
|
64
|
+
pending or unverified, and `1` means verification could not complete. This
|
|
65
|
+
check does not prove your strategy is running. Run its own connection check
|
|
66
|
+
before starting it. These commands submit no transactions, move no collateral
|
|
67
|
+
and place no orders. Setup does not depend on temporary Hyperliquid balance or
|
|
68
|
+
funding API availability.
|
|
69
|
+
|
|
70
|
+
To check a public consent before importing it:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
2n20 check-consent --vault 'https://2n20.org/vaults/<your-vault-address>?network=mainnet' --consent ./<your-setup-directory>/consent.public.json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Reproducible development and release
|
|
77
|
+
|
|
78
|
+
`requirements-release.txt` contains the reviewed, fully pinned build and
|
|
79
|
+
runtime graph with registry SHA-256 hashes. `dependency-review.json` records
|
|
80
|
+
its registry publication dates. All third-party release files were at least
|
|
81
|
+
14 days old when reviewed on October 3, 2026. The wheel also pins the complete
|
|
82
|
+
runtime graph to retain these reviewed versions for ordinary installs.
|
|
83
|
+
The only underlying runtime library is `eth-account` and its dependencies;
|
|
84
|
+
Hyperliquid's SDK is not required.
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
python3 -m venv .venv
|
|
88
|
+
.venv/bin/python -m pip install --require-hashes -r requirements-release.txt
|
|
89
|
+
PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -v
|
|
90
|
+
SOURCE_DATE_EPOCH=1790985600 .venv/bin/python scripts/build_release.py
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The release script calls standard `python -m build --no-isolation`, verifies
|
|
94
|
+
archive paths, and normalizes the source archive ownership, timestamps and
|
|
95
|
+
gzip header. Keep `SOURCE_DATE_EPOCH` fixed for a release. Repeated builds from
|
|
96
|
+
the same source and reviewed environment produce identical wheel and source
|
|
97
|
+
archive bytes. Use `--outdir <directory>` to compare independent builds.
|
|
98
|
+
|
|
99
|
+
Release trust anchors are copied from the repository's reviewed active
|
|
100
|
+
`deployments/development.json`, never fetched as authority from a website.
|
|
101
|
+
A supported deployment change requires reviewing and releasing the package.
|
|
102
|
+
Publishing uses GitHub Actions OIDC Trusted Publishing with dedicated PyPI
|
|
103
|
+
and TestPyPI environments, not stored API tokens. Maintainer release steps
|
|
104
|
+
and publisher identities are in the repository operations runbook.
|