cryptascreen 0.2.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.
- cryptascreen-0.2.0/.github/dependabot.yml +2 -0
- cryptascreen-0.2.0/.github/workflows/ci.yml +31 -0
- cryptascreen-0.2.0/.github/workflows/publish.yml +41 -0
- cryptascreen-0.2.0/.gitignore +48 -0
- cryptascreen-0.2.0/CHANGELOG.md +25 -0
- cryptascreen-0.2.0/LICENSE +21 -0
- cryptascreen-0.2.0/PKG-INFO +305 -0
- cryptascreen-0.2.0/README.md +277 -0
- cryptascreen-0.2.0/examples/basic_usage.py +11 -0
- cryptascreen-0.2.0/examples/bulk_screening.py +22 -0
- cryptascreen-0.2.0/examples/name_screening.py +10 -0
- cryptascreen-0.2.0/examples/webhook_receiver.py +26 -0
- cryptascreen-0.2.0/pyproject.toml +49 -0
- cryptascreen-0.2.0/src/cryptascreen/__init__.py +61 -0
- cryptascreen-0.2.0/src/cryptascreen/_util.py +111 -0
- cryptascreen-0.2.0/src/cryptascreen/_version.py +3 -0
- cryptascreen-0.2.0/src/cryptascreen/client.py +231 -0
- cryptascreen-0.2.0/src/cryptascreen/config.py +48 -0
- cryptascreen-0.2.0/src/cryptascreen/errors.py +217 -0
- cryptascreen-0.2.0/src/cryptascreen/helpers.py +47 -0
- cryptascreen-0.2.0/src/cryptascreen/operations.py +131 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/__init__.py +1 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/alerts.py +51 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/auth.py +36 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/capabilities.py +36 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/cases.py +198 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/compliance.py +116 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/graph.py +70 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/intelligence.py +69 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/monitoring.py +142 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/names.py +97 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/sanctions.py +50 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/screening.py +379 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/settings.py +115 -0
- cryptascreen-0.2.0/src/cryptascreen/resources/webhooks.py +55 -0
- cryptascreen-0.2.0/src/cryptascreen/retry.py +176 -0
- cryptascreen-0.2.0/src/cryptascreen/signature.py +118 -0
- cryptascreen-0.2.0/src/cryptascreen/types/__init__.py +313 -0
- cryptascreen-0.2.0/src/cryptascreen/types/_account.py +199 -0
- cryptascreen-0.2.0/src/cryptascreen/types/_models.py +1620 -0
- cryptascreen-0.2.0/src/cryptascreen/types/cases.py +31 -0
- cryptascreen-0.2.0/src/cryptascreen/types/common.py +17 -0
- cryptascreen-0.2.0/src/cryptascreen/types/compliance.py +27 -0
- cryptascreen-0.2.0/src/cryptascreen/types/graph.py +25 -0
- cryptascreen-0.2.0/src/cryptascreen/types/intelligence.py +11 -0
- cryptascreen-0.2.0/src/cryptascreen/types/names.py +39 -0
- cryptascreen-0.2.0/src/cryptascreen/types/sanctions.py +13 -0
- cryptascreen-0.2.0/src/cryptascreen/types/screening.py +73 -0
- cryptascreen-0.2.0/src/cryptascreen/types/wallet.py +85 -0
- cryptascreen-0.2.0/src/cryptascreen/types/webhooks.py +13 -0
- cryptascreen-0.2.0/tests/__init__.py +0 -0
- cryptascreen-0.2.0/tests/conftest.py +102 -0
- cryptascreen-0.2.0/tests/contract/__init__.py +0 -0
- cryptascreen-0.2.0/tests/contract/test_local_stack.py +167 -0
- cryptascreen-0.2.0/tests/fixtures/customer-operations.json +76 -0
- cryptascreen-0.2.0/tests/fixtures/ops_spec.json +724 -0
- cryptascreen-0.2.0/tests/fixtures/webhook_vectors.json +422 -0
- cryptascreen-0.2.0/tests/test_client.py +333 -0
- cryptascreen-0.2.0/tests/test_new_resources.py +253 -0
- cryptascreen-0.2.0/tests/test_openapi_parity.py +83 -0
- cryptascreen-0.2.0/tests/test_package.py +20 -0
- cryptascreen-0.2.0/tests/test_resources.py +380 -0
- cryptascreen-0.2.0/tests/test_webhook_signature.py +49 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v5
|
|
22
|
+
with:
|
|
23
|
+
persist-credentials: false
|
|
24
|
+
- uses: actions/setup-python@v6
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
- run: python -m pip install -e ".[dev]"
|
|
28
|
+
- run: ruff check .
|
|
29
|
+
- run: ruff format --check .
|
|
30
|
+
- run: mypy --strict src
|
|
31
|
+
- run: python -m pytest -q
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v5
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
- uses: actions/setup-python@v6
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
- run: python -m pip install build
|
|
23
|
+
- run: python -m build
|
|
24
|
+
- uses: actions/upload-artifact@v4
|
|
25
|
+
with:
|
|
26
|
+
name: dist
|
|
27
|
+
path: dist/
|
|
28
|
+
|
|
29
|
+
publish:
|
|
30
|
+
needs: build
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
environment: pypi
|
|
33
|
+
permissions:
|
|
34
|
+
contents: read
|
|
35
|
+
id-token: write
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/download-artifact@v5
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
# Virtual env
|
|
25
|
+
.venv/
|
|
26
|
+
venv/
|
|
27
|
+
env/
|
|
28
|
+
ENV/
|
|
29
|
+
|
|
30
|
+
# Testing / tooling
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
.coverage
|
|
33
|
+
.tox/
|
|
34
|
+
htmlcov/
|
|
35
|
+
.mypy_cache/
|
|
36
|
+
.ruff_cache/
|
|
37
|
+
|
|
38
|
+
# IDE
|
|
39
|
+
.idea/
|
|
40
|
+
.vscode/
|
|
41
|
+
|
|
42
|
+
# OS
|
|
43
|
+
.DS_Store
|
|
44
|
+
Thumbs.db
|
|
45
|
+
|
|
46
|
+
# Env / secrets
|
|
47
|
+
.env
|
|
48
|
+
.env.local
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- **BREAKING:** `chain` is now required on every screening call; the server returns 400 `CHAIN_REQUIRED` when it is missing. `screening.screen_address` needs `chain`, and `screen_bulk` / `screen_bulk_async` / `screen_bulk_and_wait` need `chains` (one per address); there is no default network. A missing or blank value raises `ValidationError` with `validation_code == "CHAIN_REQUIRED"` (checked before the request is sent, and mapped from the server's 400 as well). `ScreenAddressRequest.chain` and `BulkScreeningRequest.chains` have no default.
|
|
6
|
+
- New resources for the remaining customer API calls usable with an API key: `auth.me`, `capabilities.get`; `settings` (`get_score_thresholds`, `get_score_threshold_audit`, `get_name_matching`, `get_name_matching_audit`, `get_name_lists`, `get_name_list_audit`, `list_vendor_keys`); `monitoring` (`list_wallets`, `add_wallet`, `remove_wallet`, `list_names`, `add_name`, `remove_name`, `get_overview`, `list_breaches`, `get_breach_summary`, `acknowledge_breach`). Sync and async.
|
|
7
|
+
- Changing settings, the allow and block lists and vendor keys, and `auth/refresh`, need a signed-in user in the app and are not wrapped.
|
|
8
|
+
- Webhook models match the API (`WebhookConfig.is_active`, `WebhookDelivery.status`, ...); `webhooks.get_deliveries(webhook_id)` returns the last 50 deliveries as a list and takes no paging arguments. `CreateWebhookRequest` and `WebhookTestResult` are gone.
|
|
9
|
+
- The OpenAPI parity test now has no known gaps: every SDK method is an operation of the customer API contract.
|
|
10
|
+
|
|
11
|
+
## 0.1.0 — unreleased
|
|
12
|
+
|
|
13
|
+
First version of the CryptaScreen Python SDK. API surface = `@cryptascreen/sdk` 0.2.2 (every endpoint method usable with an API key 1:1, same
|
|
14
|
+
request/response fields, error classes and codes, retry policy), plus:
|
|
15
|
+
|
|
16
|
+
- requests go to `https://api.cryptascreen.com`, which routes them by the API key's data region (no region option),
|
|
17
|
+
- webhook signature verification (`verify_webhook_signature`, `construct_webhook_event`).
|
|
18
|
+
|
|
19
|
+
Naming: TS `screenAddress` -> `screen_address`, `CryptaScreenClient` -> `CryptaScreen` (alias `CryptaScreenClient` kept), options objects
|
|
20
|
+
-> keyword arguments, `retries` -> `max_retries`, `timeout` in seconds.
|
|
21
|
+
|
|
22
|
+
Notes found by the local contract run:
|
|
23
|
+
|
|
24
|
+
- `chains[i]` pairs with `addresses[i]`: the lists must have the same length (`400 addresses and chains lists must have the same length`).
|
|
25
|
+
- Webhooks: `webhooks.list` and `webhooks.get_deliveries` only. Registering, deleting and test-sending an endpoint require a signed-in user in the CryptaScreen app (an API key gets `403`), so this SDK does not offer them.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CryptaCount, Inc.
|
|
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,305 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: cryptascreen
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Official Python SDK for the CryptaScreen API — address and name screening, sanctions, exposure, investigations
|
|
5
|
+
Project-URL: Documentation, https://github.com/cryptascreen/cryptascreen-sdk-python#readme
|
|
6
|
+
Project-URL: Repository, https://github.com/cryptascreen/cryptascreen-sdk-python
|
|
7
|
+
Author-email: "CryptaCount Luxembourg S.à r.l." <support@cryptacount.com>
|
|
8
|
+
Maintainer-email: "CryptaCount Luxembourg S.à r.l." <support@cryptacount.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: aml,compliance,cryptascreen,crypto,kyc,sanctions,screening
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: httpx>=0.27
|
|
18
|
+
Requires-Dist: pydantic>=2.0
|
|
19
|
+
Provides-Extra: async
|
|
20
|
+
Requires-Dist: httpx[http2]; extra == 'async'
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
25
|
+
Requires-Dist: respx; extra == 'dev'
|
|
26
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# CryptaScreen Python SDK
|
|
30
|
+
|
|
31
|
+
Official Python SDK for the [CryptaScreen API](https://github.com/cryptascreen/cryptascreen-sdk-python#readme) — address and name screening, sanctions, wallet exposure, investigations, webhooks.
|
|
32
|
+
|
|
33
|
+
[](https://www.python.org/downloads/)
|
|
34
|
+
[](LICENSE)
|
|
35
|
+
|
|
36
|
+
Same API surface as [`@cryptascreen/sdk`](https://github.com/cryptascreen/cryptascreen-sdk-typescript) 0.2.2 (every method maps 1:1; `cryptascreen.operations.OPERATIONS` lists each one with its HTTP method and path).
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Supported Python versions: 3.10, 3.11, 3.12, 3.13.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install cryptascreen
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
With optional extras:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install cryptascreen[async] # HTTP/2 support for the async client
|
|
50
|
+
pip install cryptascreen[dev] # Development tools (pytest, mypy, ruff, respx)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> Not published yet: until the first release, install from a local checkout (`pip install -e .`).
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from cryptascreen import CryptaScreen
|
|
59
|
+
|
|
60
|
+
client = CryptaScreen(api_key="csk_...")
|
|
61
|
+
|
|
62
|
+
result = client.screening.screen_address(
|
|
63
|
+
{"address": "0x1111111111111111111111111111111111111111", "chain": "ethereum"}
|
|
64
|
+
)
|
|
65
|
+
print(result.risk_level, result.risk_score, result.sanctions_match)
|
|
66
|
+
# "no match" means no match in the layers listed in result.layers; check result.assessment_status before treating it as clear
|
|
67
|
+
|
|
68
|
+
client.close()
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Context Manager
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
with CryptaScreen(api_key="csk_...") as client:
|
|
75
|
+
status = client.sanctions.get_status()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Async Client
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from cryptascreen import AsyncCryptaScreen
|
|
82
|
+
|
|
83
|
+
async with AsyncCryptaScreen(api_key="csk_...") as client:
|
|
84
|
+
result = await client.screening.screen_address(
|
|
85
|
+
{"address": "0x1111111111111111111111111111111111111111", "chain": "ethereum"}
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Requests may be plain dicts (camelCase wire names) or the typed models (`from cryptascreen.types import ScreenAddressRequest`).
|
|
90
|
+
Responses are pydantic models with snake_case attributes (`risk_level`, `evaluation_id`); unknown future fields are kept.
|
|
91
|
+
|
|
92
|
+
## Chain is required
|
|
93
|
+
|
|
94
|
+
`chain` is required on every screening call, single and bulk (`chains`, one per address). An address does not identify its
|
|
95
|
+
network, so there is no default. A missing or blank chain raises `ValidationError` with `validation_code == "CHAIN_REQUIRED"`.
|
|
96
|
+
|
|
97
|
+
## Data region
|
|
98
|
+
|
|
99
|
+
Every request goes to `https://api.cryptascreen.com`, which routes it to the data region of your API key
|
|
100
|
+
(`csk_us_...` keys to the US region, `csk_eu_...` keys to the EU region). There is no region option: use the key of the
|
|
101
|
+
region your account lives in.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
CryptaScreen(api_key="csk_eu_...") # served by the EU region
|
|
105
|
+
CryptaScreen(
|
|
106
|
+
api_key="csk_...", base_url="http://localhost:8081"
|
|
107
|
+
) # explicit URL (a local stack or a proxy)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## API Reference
|
|
111
|
+
|
|
112
|
+
### Screening
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
r = client.screening.screen_address({"address": addr, "chain": "ethereum"})
|
|
116
|
+
|
|
117
|
+
# Bulk, synchronous (max 1000) - `async` is forced to False
|
|
118
|
+
results = client.screening.screen_bulk(
|
|
119
|
+
{"addresses": [a1, a2], "chains": ["ethereum", "ethereum"]}
|
|
120
|
+
) # chains[i] belongs to addresses[i]: equal lengths
|
|
121
|
+
|
|
122
|
+
# Bulk, asynchronous (max 10000): job + poll (an Idempotency-Key is always sent)
|
|
123
|
+
job = client.screening.screen_bulk_async({"addresses": addrs, "chains": ["ethereum"] * len(addrs)})
|
|
124
|
+
job = client.screening.poll_job(job.job_id)
|
|
125
|
+
job = client.screening.screen_bulk_and_wait(
|
|
126
|
+
{"addresses": addrs, "chains": ["ethereum"] * len(addrs)}, poll_interval=2.0, timeout=300
|
|
127
|
+
)
|
|
128
|
+
page = client.screening.get_job_results(job.job_id, page=0, size=100)
|
|
129
|
+
client.screening.list_jobs()
|
|
130
|
+
client.screening.cancel_job(job.job_id)
|
|
131
|
+
|
|
132
|
+
# History and evaluations
|
|
133
|
+
client.screening.get_history("ethereum", addr)
|
|
134
|
+
client.screening.list_evaluations("ethereum", addr, page=0, size=20)
|
|
135
|
+
client.screening.get_evaluation(r.evaluation_id)
|
|
136
|
+
|
|
137
|
+
# Wallet sections and exposure (screened wallets only)
|
|
138
|
+
client.screening.get_counterparties("ethereum", addr, page=0, size=50, listed_only=True)
|
|
139
|
+
client.screening.get_transactions("ethereum", addr, direction="IN")
|
|
140
|
+
client.screening.get_exposure_paths("ethereum", addr, days=90)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Sanctions
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
client.sanctions.check("ethereum", addr) # exact match against the self-hosted sanctions lists
|
|
147
|
+
client.sanctions.get_status()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Name screening
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
hit = client.names.screen(
|
|
154
|
+
{"name": "Test Name", "type": "PERSON", "nationalities": ["LU"]}, idempotency_key="my-key"
|
|
155
|
+
)
|
|
156
|
+
from cryptascreen.helpers import is_name_clear
|
|
157
|
+
|
|
158
|
+
is_name_clear(hit) # True only for outcome CLEAR; anything else needs a person to look
|
|
159
|
+
client.names.get(hit.screening_id)
|
|
160
|
+
client.names.history(limit=50)
|
|
161
|
+
client.names.decide({"hitId": "...", "value": "FALSE_POSITIVE", "reason": "different person"})
|
|
162
|
+
client.names.decision_audit(format="json") # or "csv"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Graph analysis
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
g = client.graph.build_graph({"seedAddress": addr, "chain": "ethereum", "maxHops": 2})
|
|
169
|
+
client.graph.trace({"seedAddress": addr, "chain": "ethereum", "direction": "FORWARD"})
|
|
170
|
+
client.graph.export_graph({"seedAddress": addr, "chain": "ethereum"}, format="csv") # bytes
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Investigation cases, alerts
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
c = client.cases.create({"title": "Review", "addresses": []})
|
|
177
|
+
client.cases.list(status="OPEN", page=1)
|
|
178
|
+
client.cases.add_note(c.id, {"content": "looked at it"})
|
|
179
|
+
client.cases.set_assignee(c.id, 12) # None = unassign
|
|
180
|
+
client.cases.link_evaluation(c.id, evaluation_id)
|
|
181
|
+
client.alerts.get(7)
|
|
182
|
+
client.alerts.acknowledge(7, "reviewed")
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Compliance and intelligence
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
client.compliance.check_travel_rule({...})
|
|
189
|
+
client.compliance.identify_vasp("ethereum", addr)
|
|
190
|
+
client.intelligence.get_entity_labels("ethereum", addr) # [] = no label known, NOT a clean verdict
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Account, capabilities, settings, monitoring
|
|
194
|
+
|
|
195
|
+
These calls accept an API key (plans without a feature get 403 `feature_not_in_plan`).
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
client.auth.me() # the calling identity (auth_method "API_KEY")
|
|
199
|
+
client.capabilities.get() # chains the API accepts + live layer state
|
|
200
|
+
|
|
201
|
+
# Settings: read-only with an API key (changing them needs a signed-in tenant administrator, in the app)
|
|
202
|
+
client.settings.get_score_thresholds() # review / block thresholds (defaults 40 / 70)
|
|
203
|
+
client.settings.get_score_threshold_audit(limit=20)
|
|
204
|
+
client.settings.get_name_matching() # CONSERVATIVE | BALANCED | STRICT
|
|
205
|
+
client.settings.get_name_matching_audit()
|
|
206
|
+
client.settings.get_name_lists() # allow / block entries
|
|
207
|
+
client.settings.get_name_list_audit()
|
|
208
|
+
client.settings.list_vendor_keys() # configured state, last four characters, fingerprint; never a key
|
|
209
|
+
|
|
210
|
+
# Monitoring
|
|
211
|
+
client.monitoring.get_overview()
|
|
212
|
+
client.monitoring.add_wallet({"address": "0x...", "chain": "ethereum", "label": "treasury"})
|
|
213
|
+
client.monitoring.list_wallets()
|
|
214
|
+
client.monitoring.remove_wallet(1)
|
|
215
|
+
client.monitoring.add_name({"name": "Jane Doe"})
|
|
216
|
+
client.monitoring.list_names()
|
|
217
|
+
client.monitoring.remove_name(1)
|
|
218
|
+
client.monitoring.list_breaches()
|
|
219
|
+
client.monitoring.get_breach_summary()
|
|
220
|
+
client.monitoring.acknowledge_breach(1)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Webhooks
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
# registering, deleting and test-sending an endpoint is done by a signed-in user in the CryptaScreen app
|
|
227
|
+
hooks = client.webhooks.list()
|
|
228
|
+
client.webhooks.get_deliveries(hooks[0].id) # the last 50 deliveries, newest first
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Verify a delivery in your receiver (use the RAW body, not re-serialised JSON):
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
from cryptascreen import WebhookSignatureError, construct_webhook_event
|
|
235
|
+
|
|
236
|
+
try:
|
|
237
|
+
event = construct_webhook_event(
|
|
238
|
+
secret, raw_body, request_headers
|
|
239
|
+
) # raises WebhookSignatureError
|
|
240
|
+
except WebhookSignatureError as e:
|
|
241
|
+
... # e.code: WEBHOOK_SIGNATURE_MISSING | _MALFORMED | _MISMATCH | WEBHOOK_TIMESTAMP_OUT_OF_TOLERANCE
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Scheme: header `X-CryptaScreen-Signature-V2: t=<unix>,v1=<hex(HMAC-SHA256(secret, "<unix>." + body))>`, timestamp
|
|
245
|
+
tolerance 300 s (configurable, `tolerance=`), constant-time comparison. The legacy `X-CryptaScreen-Signature: sha256=<hex>` header has no
|
|
246
|
+
timestamp and is accepted only with `allow_legacy=True`.
|
|
247
|
+
|
|
248
|
+
## Error Handling
|
|
249
|
+
|
|
250
|
+
```python
|
|
251
|
+
from cryptascreen import (
|
|
252
|
+
AuthenticationError,
|
|
253
|
+
CryptaScreenError,
|
|
254
|
+
PlanLimitError,
|
|
255
|
+
QuotaExceededError,
|
|
256
|
+
RateLimitError,
|
|
257
|
+
ServicePausedError,
|
|
258
|
+
ValidationError,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
try:
|
|
262
|
+
client.screening.screen_address({"address": "0x123", "chain": "ethereum"})
|
|
263
|
+
except ValidationError as e:
|
|
264
|
+
print(e.validation_code, e.field_errors, e.items) # INVALID_ADDRESS_FORMAT ...
|
|
265
|
+
except QuotaExceededError as e:
|
|
266
|
+
print(e.resets_at, e.upgrade_url) # the monthly plan quota: not retried
|
|
267
|
+
except RateLimitError as e:
|
|
268
|
+
print(e.retry_after_ms)
|
|
269
|
+
except CryptaScreenError as e:
|
|
270
|
+
print(e.status, e.code, e.request_id)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
| Status | Class | `code` |
|
|
274
|
+
|---|---|---|
|
|
275
|
+
| 400 | `ValidationError` | `VALIDATION_ERROR` |
|
|
276
|
+
| 401 | `AuthenticationError` | `AUTHENTICATION_ERROR` |
|
|
277
|
+
| 402 | `ServicePausedError` (`SERVICE_PAUSED`) / `CryptaScreenError` | `SERVICE_PAUSED` / `PAYMENT_REQUIRED` |
|
|
278
|
+
| 403 | `PlanLimitError` (`SeatLimitReachedError`, `ApiKeyLimitReachedError`) / `CryptaScreenError` | the limit code / `FORBIDDEN` |
|
|
279
|
+
| 404 | `NotFoundError` | `NOT_FOUND` |
|
|
280
|
+
| 429 | `RateLimitError` / `QuotaExceededError` | `RATE_LIMIT_EXCEEDED` / `QUOTA_EXCEEDED` |
|
|
281
|
+
| other | `CryptaScreenError` | the body's `code` or `UNKNOWN_ERROR` |
|
|
282
|
+
|
|
283
|
+
## Retry Logic
|
|
284
|
+
|
|
285
|
+
The SDK retries 429 (except `quota_exceeded`) and every 5xx up to `max_retries` (default 3). The delay is the `Retry-After`
|
|
286
|
+
header (integer seconds) when present, otherwise exponential backoff 1 s, 2 s, 4 s ... capped at 30 s. 400, 401, 402, 403, 404 and
|
|
287
|
+
the monthly quota are never retried; network errors are not retried (`CryptaScreenError`, status 0, `UNKNOWN_ERROR`).
|
|
288
|
+
|
|
289
|
+
## Development
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
pip install -e ".[dev]"
|
|
293
|
+
ruff check src/ tests/
|
|
294
|
+
ruff format --check src/ tests/
|
|
295
|
+
mypy src/cryptascreen/ --ignore-missing-imports
|
|
296
|
+
pytest -v # unit + API parity (contract tests are skipped without a local stack)
|
|
297
|
+
python -m build # sdist + wheel
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Contract tests (`tests/contract/`) run against a LOCAL CryptaScreen stack only (`CS_CONTRACT_US`, `CS_CONTRACT_EU`, `CS_CONTRACT_KEY_US`,
|
|
301
|
+
`CS_CONTRACT_KEY_EU`, `CS_CONTRACT_KEY_RL`); never against production.
|
|
302
|
+
|
|
303
|
+
## License
|
|
304
|
+
|
|
305
|
+
MIT - see [LICENSE](LICENSE).
|