dominusnode 2.0.0__py3-none-any.whl

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.
@@ -0,0 +1,177 @@
1
+ Metadata-Version: 2.4
2
+ Name: dominusnode
3
+ Version: 2.0.0
4
+ Summary: Official DominusNode SDK for Python: AI-agent relay network (proxy, nodes, credits, payouts)
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/0xcircuitbreaker/DomiNode/tree/master/sdks/python
7
+ Project-URL: Repository, https://github.com/0xcircuitbreaker/DomiNode
8
+ Project-URL: Issues, https://github.com/0xcircuitbreaker/DomiNode/issues
9
+ Project-URL: Changelog, https://github.com/0xcircuitbreaker/DomiNode/blob/master/sdks/python/CHANGELOG.md
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: httpx>=0.24.0
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=7.0; extra == "dev"
16
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
17
+ Dynamic: license-file
18
+
19
+ # dominusnode — DominusNode Python SDK (v2)
20
+
21
+ Python client for the DominusNode AI-agent relay network: proxy through relay nodes,
22
+ register your own nodes, earn credits and withdraw payouts. It implements
23
+ [`sdks/SDK_SURFACE.md`](../SDK_SURFACE.md) (15 resources, 71 methods), with the Node SDK as
24
+ the reference implementation.
25
+
26
+ - Sync `DominusNodeClient` and asyncio `AsyncDominusNodeClient` with the same methods
27
+ - One dependency (`httpx`), no crypto dependency: you sign through a callback
28
+ - Python 3.9+, type hints, PEP 561
29
+
30
+ ```bash
31
+ pip install dominusnode
32
+ ```
33
+
34
+ Defaults: API `https://api.dominusnode.daedalusdevelopmentgroup.com`, relay gateway `proxy.dominusnode.daedalusdevelopmentgroup.com` (HTTP proxy :8080, SOCKS5 :1080). Both can be overridden in the client configuration.
35
+
36
+ ## Quick start
37
+
38
+ ```python
39
+ import os
40
+ from dominusnode import DominusNodeClient
41
+
42
+ with DominusNodeClient() as dn:
43
+ dn.connect_with_key(os.environ["DOMINUSNODE_API_KEY"]) # dn_live_... / dn_test_...
44
+
45
+ print(dn.network.pricing()) # live per-GB prices (µUSD); the SDK hardcodes no prices
46
+ res = dn.proxy.fetch("https://example.com", country="US", ip_class="residential")
47
+ print(res.status, res.text()[:200])
48
+ ```
49
+
50
+ Async:
51
+
52
+ ```python
53
+ from dominusnode import AsyncDominusNodeClient
54
+
55
+ async with AsyncDominusNodeClient() as dn:
56
+ await dn.connect_with_key(key)
57
+ stats = await dn.network.stats()
58
+ ```
59
+
60
+ ## Proxy
61
+
62
+ Routing flags go in the proxy **username**, the API key in the **password**:
63
+
64
+ ```python
65
+ dn.proxy.build_username(country="DE", session_id="abc123") # "country-DE-session-abc123"
66
+ url = dn.proxy.build_url(country="US", ip_class="dc") # http://country-US-class-dc:<key>@proxy.dominusnode.daedalusdevelopmentgroup.com:8080
67
+ ```
68
+
69
+ `build_url` returns a URL that **contains your API key: do not log it.**
70
+
71
+ Flags: `country` (ISO-2; OFAC countries CU IR KP RU SY are refused), `ip_class`
72
+ (`residential`/`dc`/`mobile`), `session_id` (sticky, 1-64 alphanumerics),
73
+ `agentic_wallet_id` (UUID, spend from an agentic wallet), `allow_http` (`allowhttp-1`).
74
+ With no flags the username is `relay`.
75
+
76
+ `proxy.fetch(url, ...)` sends GET or HEAD only. Before it opens a connection it checks the
77
+ URL: http(s) only, ports 80/443, no userinfo, no local or private hosts, including
78
+ decimal/hex/octal IPv4 forms and IPv6 forms that embed IPv4. It then resolves the hostname
79
+ and refuses it if *any* address is private (DNS-rebinding check). https goes through a
80
+ CONNECT tunnel with full TLS verification; `http://` needs `allow_http=True`. Redirects are
81
+ returned as they are, not followed, and the body is capped at 10 MB (`truncated=True` when
82
+ cut).
83
+
84
+ ## Signers (EIP-191)
85
+
86
+ Node registration, withdrawals, payout-wallet changes and wallet sign-in need a signature from
87
+ your wallet. Pass any object with an `address` and a `sign_message(message) -> "0x…"` method that
88
+ performs `personal_sign`:
89
+
90
+ ```python
91
+ from eth_account import Account
92
+ from eth_account.messages import encode_defunct
93
+
94
+ acct = Account.from_key(private_key)
95
+
96
+ class Signer:
97
+ address = acct.address
98
+ def sign_message(self, message: str) -> str:
99
+ sig = acct.sign_message(encode_defunct(text=message)).signature.hex()
100
+ return sig if sig.startswith("0x") else "0x" + sig
101
+ ```
102
+
103
+ With `AsyncDominusNodeClient`, `sign_message` may be `async def`.
104
+
105
+ The SDK never signs a server string without checking it. For every signed flow it builds the
106
+ expected message itself and compares it byte for byte with the server's. If they differ, it
107
+ raises `ProtocolError` and the signer is never called.
108
+
109
+ ```python
110
+ node = dn.nodes.register(signer, node_pubkey=ed25519_pub_hex, max_streams=8)
111
+ node_key = node["nodeKey"].reveal() # Secret, shown once
112
+
113
+ dn.payout_wallet.set("0xYourPayoutAddress", signer) # first set
114
+ dn.payout_wallet.set("0xNew...", signer, old_wallet_signer=old) # change: old wallet co-signs
115
+
116
+ r = dn.credits.withdraw(5_000_000, signer) # µUSD (int or digit string, never float); $5
117
+ r["idempotencyKey"] # reuse it to retry safely
118
+ ```
119
+
120
+ ## Money
121
+
122
+ - Server money values are `{"musd": "<integer µUSD>", "usd": "<6 decimals>"}`; 1 USD = 1,000,000 µUSD.
123
+ - µUSD inputs accept an `int` or a digit string and are sent as decimal strings. Floats, NaN and Infinity are rejected.
124
+ - `*_cents` inputs are integers with `0 < x <= 2,147,483,647`, checked before any request is sent.
125
+
126
+ ## Resources
127
+
128
+ | Resource | Methods |
129
+ |---|---|
130
+ | `auth` | `verify_key`, `refresh`, `logout`, `me` |
131
+ | `wallet_auth` | `challenge`, `verify`, `sign_in`, `link` |
132
+ | `keys` | `create`, `list`, `revoke` |
133
+ | `wallet` | `get_balance`, `get_transactions`, `get_forecast`, `top_up_crypto`, `get_crypto_status` |
134
+ | `agentic_wallets` | `create`, `list`, `get`, `fund`, `update_wallet_policy`, `transactions`, `freeze`, `unfreeze`, `delete` |
135
+ | `teams` | 18 methods: team CRUD, wallet, members, invites, keys (`create_key` … `revoke_key`) |
136
+ | `usage` | `get`, `get_daily`, `get_top_hosts`, `export_csv` (`from_`/`to` -> `since`/`until`) |
137
+ | `sessions` | `get_active` (id, startedAt and status only; never IPs), `report` |
138
+ | `x402` | `get_info` |
139
+ | `network` | `policy`, `pricing`, `stats` |
140
+ | `nodes` | `register_challenge`, `register`, `list`, `revoke`, `update_caps`, `tier` |
141
+ | `credits` | `balance`, `transactions`, `convert`, `withdraw` |
142
+ | `payout_wallet` | `get`, `set` |
143
+ | `payouts` | `list` |
144
+ | `proxy` | `build_username`, `build_url`, `fetch`, `get_health`, `get_config` |
145
+
146
+ Client members: `connect_with_key(api_key)` (returns `{"mfaRequired": bool, "userId"?}`),
147
+ `disconnect()` and `is_connected`. Results are the server's JSON as dicts with camelCase keys.
148
+
149
+ Not in the SDK: plans, slots, admin, Stripe and PayPal top-ups, email/password and human MFA.
150
+ Use the dashboard for those.
151
+
152
+ ## Errors
153
+
154
+ `DominusNodeError` (`message`, `status_code`, `code`, `details`) and its subclasses:
155
+ `ValidationError` (HTTP 400, and client-side checks with `code="INVALID_ARGUMENT"`),
156
+ `AuthenticationError`, `InsufficientBalanceError`, `AuthorizationError`, `NotFoundError`,
157
+ `ConflictError`, `RateLimitError` (`retry_after_seconds`), `ServerError`, `NetworkError`,
158
+ `ProtocolError`, `ProxyError`. Error messages are scrubbed of `dn_live_`/`dn_test_`/`dn_node_`/
159
+ `dn_proxy_` keys and JWTs.
160
+
161
+ ## Security behaviour
162
+
163
+ - Redirects are never followed. API responses are capped at 10 MB.
164
+ - On 429 the SDK retries once, waiting `min(Retry-After, 10 s)` ±10 % (at least 100 ms).
165
+ - On 401 it refreshes the JWT once. `/v1` routes send the raw API key and are not refreshed.
166
+ - `Secret` (new API keys, team keys, node keys) prints and serialises as `[REDACTED]`. Use `json.dumps(obj, default=dominusnode.json_default)`.
167
+ - `disconnect()` logs out (best effort), then clears the API key and both tokens.
168
+
169
+ ## Development
170
+
171
+ ```bash
172
+ pip install -e '.[dev]'
173
+ pytest
174
+ ```
175
+
176
+ `tests/fixtures/signed_messages.json` holds the three signed messages as produced by the Node
177
+ SDK builders. `tests/test_signers.py` checks the Python builders against it byte for byte.
@@ -0,0 +1,22 @@
1
+ dominusnode/__init__.py,sha256=8ahNc7lk0-85qmkuYOiTTVvnovKpuxZ1WEoF_Q80IlU,1742
2
+ dominusnode/_ops.py,sha256=39eR8QjFZBREhw3WbPTae5AoHfHoxHXHQ0cgl0nWbrg,4040
3
+ dominusnode/client.py,sha256=8d_5BGbDrOcthExqEy8K-5uG4cr7ENjNi2dhr3BSJUM,7645
4
+ dominusnode/constants.py,sha256=ixevquxzIXYCvob2QkwLUS36b9z-G6Q3YjEyxMjr6No,1036
5
+ dominusnode/errors.py,sha256=HwwMzwbai7HQdykEASkuMaSVbw37mtSclkPzOp8_GTQ,4812
6
+ dominusnode/http_client.py,sha256=sIec9f2lw2yKe1fEsSy5vJGFqgEY27MIdp11r8nV3yU,12743
7
+ dominusnode/messages.py,sha256=9Aq4dVxLwPR4D5q5vDcHJdk5gLMukx65JgaL0sn2oTw,2599
8
+ dominusnode/pow.py,sha256=W7QI2vCNoYUi31um_7ybYrmwtwQfFkbaIFu8Q3Yc2FU,1108
9
+ dominusnode/proxy_fetch.py,sha256=fmwwZ-Dl3X7qqP9yNP2O_N-YxYr0NHSdKzadGzarL54,12576
10
+ dominusnode/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ dominusnode/resources.py,sha256=lZ2G17WLMsRSfCjXMbeMfqxeel68g6EY-mA7JvTuu74,35318
12
+ dominusnode/secret.py,sha256=C8zmibccK3Cs4TAlZTjpUTxZfOoMxZoBBS1yruSW41I,1697
13
+ dominusnode/signer.py,sha256=oqTzS9sy3OSPsUynKWi6Q0KuySG3UT_D2WuZX3nkV0c,2053
14
+ dominusnode/ssrf.py,sha256=tUoDBjKGPzO0zDoXrQ2j1LiiI3RKonrgmnMIZ9nsgsg,6109
15
+ dominusnode/token_manager.py,sha256=HS2lEN8tMU7b1iJr6m3e9zYy08qwNGKmMpb5A64RZIM,4965
16
+ dominusnode/types.py,sha256=7_sNH4dJbwG4zDpNQiI-zVDwLbVb7-jIOcn7BtoKPiQ,1930
17
+ dominusnode/validation.py,sha256=7yoni-aSewGwWvMD-ZdlCec6C6l8nNZXcFE5F0oM_C0,4483
18
+ dominusnode-2.0.0.dist-info/licenses/LICENSE,sha256=NBkjfgN0tpbJjWf7uqsPCOMgq7uuSEW4uaGDCpB8HbI,1069
19
+ dominusnode-2.0.0.dist-info/METADATA,sha256=urbXNUEqWJIIuwA-ZE08-gBWXoaaSvCbYENexJrSqj8,7771
20
+ dominusnode-2.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
21
+ dominusnode-2.0.0.dist-info/top_level.txt,sha256=xUsTotK5cVkWFeLnn6BJMeUjd7M-Y7_Amo8JawImfco,12
22
+ dominusnode-2.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dominus Node
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.
@@ -0,0 +1 @@
1
+ dominusnode