helius-python 0.5.1__tar.gz → 0.5.2__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.
- {helius_python-0.5.1 → helius_python-0.5.2}/PKG-INFO +1 -1
- {helius_python-0.5.1 → helius_python-0.5.2}/pyproject.toml +1 -1
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/laserstream/websockets.py +12 -1
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/unit/lasterstream/test_websockets.py +70 -5
- {helius_python-0.5.1 → helius_python-0.5.2}/.editorconfig +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/.github/workflows/python-package.yml +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/.github/workflows/python-publish.yml +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/.gitignore +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/AGENTS.md +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/CLAUDE.md +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/CONTRIBUTING.md +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/LICENSE +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/README.md +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/TODO.md +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/laserstream/websocket_logs.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/address_transactions.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/address_transfers.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/block_explorer.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/devnet_airdrop.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/network_status.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/priority_fees.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/stake_overview.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/token_inspector.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/transaction_inspector.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/rpc/wallet_tracker.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/webhooks/webhook_crud.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/examples/webhooks/webhook_receiver.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/requirements.txt +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/__init__.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/admin/__init__.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/admin/admin.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/rpc/__init__.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/rpc/client.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/rpc/models.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/utils/__init__.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/utils/json_rpc_request.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/webhooks/__init__.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/src/helius/webhooks/webhooks.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/test_examples.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/fixtures/account.json +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/fixtures/supply.json +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/unit/admin/test_admin.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/unit/solana_rpc/test_client.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/unit/solana_rpc/test_models.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/unit/utils/test_json_rpc_request.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/unit/webhooks/test_webhook.py +0 -0
- {helius_python-0.5.1 → helius_python-0.5.2}/tests/unit/webhooks/test_webhooks_api_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: helius-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Typed Python client for the Helius API
|
|
5
5
|
Project-URL: Homepage, https://github.com/markosnarinian/helius-python
|
|
6
6
|
Project-URL: Issues, https://github.com/markosnarinian/helius-python/issues
|
|
@@ -132,6 +132,10 @@ class WebSocketClient:
|
|
|
132
132
|
base_url="wss://mainnet.helius-rpc.com",
|
|
133
133
|
api_key: str | None = None,
|
|
134
134
|
proxy: str | None = None,
|
|
135
|
+
open_timeout: float | None = 10,
|
|
136
|
+
ping_interval: float | None = 20,
|
|
137
|
+
ping_timeout: float | None = 20,
|
|
138
|
+
close_timeout: float | None = 10,
|
|
135
139
|
):
|
|
136
140
|
|
|
137
141
|
base_url = base_url
|
|
@@ -144,7 +148,14 @@ class WebSocketClient:
|
|
|
144
148
|
if not api_key:
|
|
145
149
|
raise ValueError("No API key provided.")
|
|
146
150
|
uri = httpx.URL(base_url).copy_with(path="/", params={"api-key": api_key})
|
|
147
|
-
self._websocket = connect(
|
|
151
|
+
self._websocket = connect(
|
|
152
|
+
str(uri),
|
|
153
|
+
proxy=proxy,
|
|
154
|
+
open_timeout=open_timeout,
|
|
155
|
+
ping_interval=ping_interval,
|
|
156
|
+
ping_timeout=ping_timeout,
|
|
157
|
+
close_timeout=close_timeout,
|
|
158
|
+
)
|
|
148
159
|
|
|
149
160
|
def close(self):
|
|
150
161
|
self._websocket.close()
|
|
@@ -64,9 +64,20 @@ def fake_ws(monkeypatch):
|
|
|
64
64
|
"""Patch `connect` so `WebSocketClient.__init__` returns a FakeWebSocket."""
|
|
65
65
|
fake = FakeWebSocket()
|
|
66
66
|
|
|
67
|
-
def fake_connect(
|
|
67
|
+
def fake_connect(
|
|
68
|
+
uri,
|
|
69
|
+
proxy=None,
|
|
70
|
+
open_timeout=None,
|
|
71
|
+
ping_interval=None,
|
|
72
|
+
ping_timeout=None,
|
|
73
|
+
close_timeout=None,
|
|
74
|
+
):
|
|
68
75
|
fake.uri = uri
|
|
69
76
|
fake.proxy = proxy
|
|
77
|
+
fake.open_timeout = open_timeout
|
|
78
|
+
fake.ping_interval = ping_interval
|
|
79
|
+
fake.ping_timeout = ping_timeout
|
|
80
|
+
fake.close_timeout = close_timeout
|
|
70
81
|
return fake
|
|
71
82
|
|
|
72
83
|
monkeypatch.setattr(ws_module, "connect", fake_connect)
|
|
@@ -283,13 +294,29 @@ def test_init_picks_up_api_key_from_env(monkeypatch):
|
|
|
283
294
|
monkeypatch.setenv("HELIUS_API_KEY", "from-env")
|
|
284
295
|
monkeypatch.setattr(ws_module, "dotenv_values", lambda: {})
|
|
285
296
|
|
|
286
|
-
def fake_connect(
|
|
297
|
+
def fake_connect(
|
|
298
|
+
uri,
|
|
299
|
+
proxy=None,
|
|
300
|
+
open_timeout=None,
|
|
301
|
+
ping_interval=None,
|
|
302
|
+
ping_timeout=None,
|
|
303
|
+
close_timeout=None,
|
|
304
|
+
):
|
|
287
305
|
fake.uri = uri
|
|
306
|
+
fake.proxy = proxy
|
|
307
|
+
fake.open_timeout = open_timeout
|
|
308
|
+
fake.ping_interval = ping_interval
|
|
309
|
+
fake.ping_timeout = ping_timeout
|
|
310
|
+
fake.close_timeout = close_timeout
|
|
288
311
|
return fake
|
|
289
312
|
|
|
290
313
|
monkeypatch.setattr(ws_module, "connect", fake_connect)
|
|
291
314
|
client = WebSocketClient()
|
|
292
315
|
assert "api-key=from-env" in fake.uri
|
|
316
|
+
assert fake.open_timeout == 10
|
|
317
|
+
assert fake.ping_interval == 20
|
|
318
|
+
assert fake.ping_timeout == 20
|
|
319
|
+
assert fake.close_timeout == 10
|
|
293
320
|
assert client._websocket is fake
|
|
294
321
|
|
|
295
322
|
|
|
@@ -297,29 +324,67 @@ def test_init_builds_uri_with_api_key_and_passes_proxy(monkeypatch):
|
|
|
297
324
|
fake = FakeWebSocket()
|
|
298
325
|
captured = {}
|
|
299
326
|
|
|
300
|
-
def fake_connect(
|
|
327
|
+
def fake_connect(
|
|
328
|
+
uri,
|
|
329
|
+
proxy=None,
|
|
330
|
+
open_timeout=None,
|
|
331
|
+
ping_interval=None,
|
|
332
|
+
ping_timeout=None,
|
|
333
|
+
close_timeout=None,
|
|
334
|
+
):
|
|
301
335
|
captured["uri"] = uri
|
|
302
336
|
captured["proxy"] = proxy
|
|
337
|
+
captured["open_timeout"] = open_timeout
|
|
338
|
+
captured["ping_interval"] = ping_interval
|
|
339
|
+
captured["ping_timeout"] = ping_timeout
|
|
340
|
+
captured["close_timeout"] = close_timeout
|
|
303
341
|
return fake
|
|
304
342
|
|
|
305
343
|
monkeypatch.setattr(ws_module, "connect", fake_connect)
|
|
306
|
-
WebSocketClient(
|
|
344
|
+
WebSocketClient(
|
|
345
|
+
api_key="test",
|
|
346
|
+
proxy="http://proxy:8080",
|
|
347
|
+
open_timeout=1,
|
|
348
|
+
ping_interval=2,
|
|
349
|
+
ping_timeout=3,
|
|
350
|
+
close_timeout=4,
|
|
351
|
+
)
|
|
307
352
|
assert "api-key=test" in captured["uri"]
|
|
308
353
|
assert captured["uri"].startswith("wss://mainnet.helius-rpc.com")
|
|
309
354
|
assert captured["proxy"] == "http://proxy:8080"
|
|
355
|
+
assert captured["open_timeout"] == 1
|
|
356
|
+
assert captured["ping_interval"] == 2
|
|
357
|
+
assert captured["ping_timeout"] == 3
|
|
358
|
+
assert captured["close_timeout"] == 4
|
|
310
359
|
|
|
311
360
|
|
|
312
361
|
def test_init_uses_custom_base_url(monkeypatch):
|
|
313
362
|
fake = FakeWebSocket()
|
|
314
363
|
captured = {}
|
|
315
364
|
|
|
316
|
-
def fake_connect(
|
|
365
|
+
def fake_connect(
|
|
366
|
+
uri,
|
|
367
|
+
proxy=None,
|
|
368
|
+
open_timeout=None,
|
|
369
|
+
ping_interval=None,
|
|
370
|
+
ping_timeout=None,
|
|
371
|
+
close_timeout=None,
|
|
372
|
+
):
|
|
317
373
|
captured["uri"] = uri
|
|
374
|
+
captured["proxy"] = proxy
|
|
375
|
+
captured["open_timeout"] = open_timeout
|
|
376
|
+
captured["ping_interval"] = ping_interval
|
|
377
|
+
captured["ping_timeout"] = ping_timeout
|
|
378
|
+
captured["close_timeout"] = close_timeout
|
|
318
379
|
return fake
|
|
319
380
|
|
|
320
381
|
monkeypatch.setattr(ws_module, "connect", fake_connect)
|
|
321
382
|
WebSocketClient(api_key="test", base_url="wss://devnet.helius-rpc.com")
|
|
322
383
|
assert captured["uri"].startswith("wss://devnet.helius-rpc.com")
|
|
384
|
+
assert captured["open_timeout"] == 10
|
|
385
|
+
assert captured["ping_interval"] == 20
|
|
386
|
+
assert captured["ping_timeout"] == 20
|
|
387
|
+
assert captured["close_timeout"] == 10
|
|
323
388
|
|
|
324
389
|
|
|
325
390
|
def test_close_delegates_to_websocket(client, fake_ws):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|