poascan 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.
poascan-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jake Gallen
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.
poascan-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: poascan
3
+ Version: 0.1.0
4
+ Summary: Python SDK for POAScan and POASwap: read-only Proof of Agent explorer and swap book, with webhook signature checks.
5
+ Author: Jake Gallen
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://poascan.io
8
+ Project-URL: Documentation, https://poascan.io/llms.txt
9
+ Project-URL: Source, https://github.com/jakegallen/poascan/tree/main/sdk/python
10
+ Project-URL: Changelog, https://github.com/jakegallen/poascan/blob/main/CHANGELOG.md
11
+ Keywords: poascan,proof-of-agent,explorer,poaswap,api,sdk,agents
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Intended Audience :: Developers
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Dynamic: license-file
19
+
20
+ # poascan
21
+
22
+ One Python client for [POAScan](https://poascan.io), the explorer for Proof of Agent (poa-mainnet-1), and [POASwap](https://poaswap.io), its swap book. `client.scan` covers chain and Agent data; `client.swap` covers offers, quotes and the dry run compose. No keys, no sign in. Standard library only.
23
+
24
+ ```
25
+ pip install poascan
26
+ ```
27
+
28
+ ## Use
29
+
30
+ ```python
31
+ from poascan import Client
32
+
33
+ c = Client() # https://poascan.io and https://poaswap.io/api/v1
34
+ p = c.scan.agent_profile("poa1...") # balance, rewards, standing, earn verdict, governance, 20 txs
35
+ for tx in c.scan.paginate("agent_profile", "poa1...", max_items=100):
36
+ print(tx["id"], tx["type"])
37
+ rows = c.scan.addresses_batch(ids="poa1...,poa1...") # up to 20
38
+
39
+ q = c.swap.quote(pair="SOL-solana", side="buy", amount=0.1)
40
+ book = c.swap.book()
41
+ plan = c.swap.compose(pair="SOL-solana", side="buy", amount=0.1) # a prompt and unsigned requests for your own Agent
42
+ ```
43
+
44
+ Every operation is a method. `client.scan` is generated from [POAScan's openapi.json](https://poascan.io/openapi.json) (`agentProfile` is `agent_profile`). `client.swap` is generated from [POASwap's public OpenAPI](https://poaswap.io/api/v1/openapi.json), named from the path (`/swaps/{offer_id}` is `swaps_by_offer_id`). Each returns the parsed JSON. `ScanClient` and `SwapClient` work on their own too.
45
+
46
+ ## Safety
47
+
48
+ The SDK is read only. It never signs, never holds keys and never sends payment. On the POASwap side it calls reads, the dry run compose and the Relay quote, nothing that posts or pays. Never send payment outside the network. To sign, use [Emblem Wallet](https://emblemvault.ai): `npx -y -p @emblemvault/agentwallet@3.3.0 emblemai --hustle-url https://emblemvault.ai` (pinned with npx, never installed globally).
49
+
50
+ Secrets and tokens travel in headers, never in a URL: a query argument named `token`, `secret` or `key` is refused. POAScan webhook calls take `secret=` (sent as `X-POAScan-Secret`). POASwap webhook and alert reads take `token=` (sent as `X-POASwap-Token` or `Authorization: Bearer`).
51
+
52
+ ## Stability
53
+
54
+ Both specs are pinned in the package and CI diffs each live spec daily, failing on a breaking change. `c.swap.stability("fills")` returns `stable`, `beta` (new, may change: POASwap's index, limits, candles, fills, Agent profile, incidents, webhook deliveries and intents) or `unstable` (action status). Event streams are not in 0.1.
55
+
56
+ ## Errors and retries
57
+
58
+ Non 2xx answers raise `BadRequest`, `Forbidden`, `NotFound`, `RateLimited` or `Unavailable` (all `PoascanError`, with `status`, `code` and `retry_after`). On 429 and 503 the client waits `Retry-After` and tries again, 3 times by default (`Client(max_retries=...)`). Cache and poll at most once a minute; `c.scan.limits()` and `c.swap.limits()` show your budget.
59
+
60
+ ## Webhooks
61
+
62
+ ```python
63
+ from poascan import Client, verify_any, SignatureError
64
+
65
+ hook = Client().scan.webhook_create({"url": "https://your.host/hook", "events": ["close", "payout"], "address": "poa1..."})
66
+ secret = hook["secret"] # shown once: keep it on your server
67
+
68
+ # in your handler, with the raw body bytes and the headers
69
+ try:
70
+ side = verify_any(secret, raw_body, headers) # "scan" or "swap"
71
+ except SignatureError:
72
+ ... # answer 400 and drop it
73
+ ```
74
+
75
+ Both sides sign `HMAC-SHA256(secret, timestamp + "." + raw body)` in hex and allow 300 seconds of clock skew. POAScan sends `X-POAScan-Signature: sha256=<hex>` with `X-POAScan-Timestamp`. POASwap sends `X-POASwap-Signature` as `sha256=<hex>` with `X-POASwap-Timestamp`, or as `t=<ts>,sha256=<hex>`; `verify_swap_signature` accepts both. `parse_event` and `parse_swap_event` verify and return the JSON. Add `dry_run=1` to any POAScan write to check it first.
76
+
77
+ ## Develop
78
+
79
+ `python3 sdk/gen.py` regenerates `poascan/_scan.py` and `poascan/_swap.py` from `sdk/specs/`; `--refresh` re-pins both specs first. `python3 sdk/spec_diff.py --side swap` diffs a live spec against the pin. Tests: `python3 -m unittest discover -s sdk/python/tests`.
80
+
81
+ MIT licensed.
@@ -0,0 +1,62 @@
1
+ # poascan
2
+
3
+ One Python client for [POAScan](https://poascan.io), the explorer for Proof of Agent (poa-mainnet-1), and [POASwap](https://poaswap.io), its swap book. `client.scan` covers chain and Agent data; `client.swap` covers offers, quotes and the dry run compose. No keys, no sign in. Standard library only.
4
+
5
+ ```
6
+ pip install poascan
7
+ ```
8
+
9
+ ## Use
10
+
11
+ ```python
12
+ from poascan import Client
13
+
14
+ c = Client() # https://poascan.io and https://poaswap.io/api/v1
15
+ p = c.scan.agent_profile("poa1...") # balance, rewards, standing, earn verdict, governance, 20 txs
16
+ for tx in c.scan.paginate("agent_profile", "poa1...", max_items=100):
17
+ print(tx["id"], tx["type"])
18
+ rows = c.scan.addresses_batch(ids="poa1...,poa1...") # up to 20
19
+
20
+ q = c.swap.quote(pair="SOL-solana", side="buy", amount=0.1)
21
+ book = c.swap.book()
22
+ plan = c.swap.compose(pair="SOL-solana", side="buy", amount=0.1) # a prompt and unsigned requests for your own Agent
23
+ ```
24
+
25
+ Every operation is a method. `client.scan` is generated from [POAScan's openapi.json](https://poascan.io/openapi.json) (`agentProfile` is `agent_profile`). `client.swap` is generated from [POASwap's public OpenAPI](https://poaswap.io/api/v1/openapi.json), named from the path (`/swaps/{offer_id}` is `swaps_by_offer_id`). Each returns the parsed JSON. `ScanClient` and `SwapClient` work on their own too.
26
+
27
+ ## Safety
28
+
29
+ The SDK is read only. It never signs, never holds keys and never sends payment. On the POASwap side it calls reads, the dry run compose and the Relay quote, nothing that posts or pays. Never send payment outside the network. To sign, use [Emblem Wallet](https://emblemvault.ai): `npx -y -p @emblemvault/agentwallet@3.3.0 emblemai --hustle-url https://emblemvault.ai` (pinned with npx, never installed globally).
30
+
31
+ Secrets and tokens travel in headers, never in a URL: a query argument named `token`, `secret` or `key` is refused. POAScan webhook calls take `secret=` (sent as `X-POAScan-Secret`). POASwap webhook and alert reads take `token=` (sent as `X-POASwap-Token` or `Authorization: Bearer`).
32
+
33
+ ## Stability
34
+
35
+ Both specs are pinned in the package and CI diffs each live spec daily, failing on a breaking change. `c.swap.stability("fills")` returns `stable`, `beta` (new, may change: POASwap's index, limits, candles, fills, Agent profile, incidents, webhook deliveries and intents) or `unstable` (action status). Event streams are not in 0.1.
36
+
37
+ ## Errors and retries
38
+
39
+ Non 2xx answers raise `BadRequest`, `Forbidden`, `NotFound`, `RateLimited` or `Unavailable` (all `PoascanError`, with `status`, `code` and `retry_after`). On 429 and 503 the client waits `Retry-After` and tries again, 3 times by default (`Client(max_retries=...)`). Cache and poll at most once a minute; `c.scan.limits()` and `c.swap.limits()` show your budget.
40
+
41
+ ## Webhooks
42
+
43
+ ```python
44
+ from poascan import Client, verify_any, SignatureError
45
+
46
+ hook = Client().scan.webhook_create({"url": "https://your.host/hook", "events": ["close", "payout"], "address": "poa1..."})
47
+ secret = hook["secret"] # shown once: keep it on your server
48
+
49
+ # in your handler, with the raw body bytes and the headers
50
+ try:
51
+ side = verify_any(secret, raw_body, headers) # "scan" or "swap"
52
+ except SignatureError:
53
+ ... # answer 400 and drop it
54
+ ```
55
+
56
+ Both sides sign `HMAC-SHA256(secret, timestamp + "." + raw body)` in hex and allow 300 seconds of clock skew. POAScan sends `X-POAScan-Signature: sha256=<hex>` with `X-POAScan-Timestamp`. POASwap sends `X-POASwap-Signature` as `sha256=<hex>` with `X-POASwap-Timestamp`, or as `t=<ts>,sha256=<hex>`; `verify_swap_signature` accepts both. `parse_event` and `parse_swap_event` verify and return the JSON. Add `dry_run=1` to any POAScan write to check it first.
57
+
58
+ ## Develop
59
+
60
+ `python3 sdk/gen.py` regenerates `poascan/_scan.py` and `poascan/_swap.py` from `sdk/specs/`; `--refresh` re-pins both specs first. `python3 sdk/spec_diff.py --side swap` diffs a live spec against the pin. Tests: `python3 -m unittest discover -s sdk/python/tests`.
61
+
62
+ MIT licensed.
@@ -0,0 +1,15 @@
1
+ """POAScan SDK: one read-only client for POAScan (Proof of Agent explorer) and POASwap (the swap book and quotes).
2
+
3
+ from poascan import Client
4
+ c = Client()
5
+ c.scan.agent_profile("poa1...")
6
+ c.swap.quote(pair="SOL-solana", side="buy", amount=0.1)
7
+
8
+ It never signs, never holds keys and never sends payment. Never send payment outside the network."""
9
+ from .client import Client, ScanClient, SwapClient, DEFAULT_BASE, SWAP_BASE, VERSION as __version__
10
+ from .errors import PoascanError, BadRequest, Forbidden, NotFound, RateLimited, Unavailable
11
+ from .webhooks import (verify_signature, parse_event, verify_swap_signature, parse_swap_event, verify_any, SignatureError)
12
+
13
+ __all__ = ["Client", "ScanClient", "SwapClient", "DEFAULT_BASE", "SWAP_BASE", "PoascanError", "BadRequest", "Forbidden", "NotFound",
14
+ "RateLimited", "Unavailable", "verify_signature", "parse_event", "verify_swap_signature", "parse_swap_event", "verify_any",
15
+ "SignatureError", "__version__"]