helius-python 0.0.1__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.
helius/models.py ADDED
@@ -0,0 +1,206 @@
1
+ from typing import Literal
2
+
3
+ from pydantic import AliasGenerator, BaseModel, ConfigDict
4
+ from pydantic.alias_generators import to_camel
5
+
6
+
7
+ class Account(BaseModel):
8
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
9
+
10
+ lamports: int
11
+ owner: str
12
+ data: list | dict | str
13
+ executable: bool
14
+ rent_epoch: int
15
+ space: int | None = None
16
+
17
+
18
+ class Rewards(BaseModel):
19
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
20
+
21
+ pubkey: str
22
+ lamports: int
23
+ post_balance: int
24
+ reward_type: str
25
+ commission: int
26
+
27
+
28
+ class Block(BaseModel):
29
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
30
+
31
+ blockhash: str
32
+ previous_blockhash: str
33
+ parent_slot: int
34
+ transactions: list[dict]
35
+ block_time: int | None
36
+ block_height: int | None
37
+ rewards: list[Rewards] | None = None
38
+
39
+
40
+ class BlockCommitment(BaseModel):
41
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
42
+
43
+ commitment: list[int] | None
44
+ total_stake: int
45
+
46
+
47
+ class ClusterNode(BaseModel):
48
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
49
+
50
+ pubkey: str
51
+ gossip: str | None
52
+ tpu: str | None
53
+ rpc: str | None
54
+ version: str | None
55
+ feature_set: int | None
56
+ shred_version: int | None
57
+
58
+
59
+ class EpochInfo(BaseModel):
60
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
61
+
62
+ absolute_slot: int
63
+ block_height: int
64
+ epoch: int
65
+ slot_index: int
66
+ slots_in_epoch: int
67
+ transaction_count: int
68
+
69
+
70
+ class EpochSchedule(BaseModel):
71
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
72
+
73
+ slots_per_epoch: int
74
+ leader_schedule_slot_offset: int
75
+ warmup: bool
76
+ first_normal_epoch: int
77
+ first_normal_slot: int
78
+
79
+
80
+ class InflationGovernor(BaseModel):
81
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
82
+
83
+ initial: float
84
+ terminal: float
85
+ taper: float
86
+ foundation: float
87
+ foundation_term: float
88
+
89
+
90
+ class InflationRate(BaseModel):
91
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
92
+
93
+ total: float
94
+ validator: float
95
+ foundation: float
96
+ epoch: int
97
+
98
+
99
+ class PerformanceSample(BaseModel):
100
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
101
+
102
+ slot: int
103
+ num_transactions: int
104
+ num_non_vote_transactions: int
105
+ sample_period_secs: int
106
+ num_slots: int
107
+
108
+
109
+ class LamportAccount(BaseModel):
110
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
111
+
112
+ address: str
113
+ lamports: int
114
+
115
+
116
+ class SignatureStatus(BaseModel):
117
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
118
+
119
+ slot: int
120
+ confirmations: int | None
121
+ err: dict | None
122
+ confirmation_status: str | None
123
+
124
+
125
+ class TransactionSignature(BaseModel):
126
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
127
+
128
+ signature: str
129
+ slot: int
130
+ err: dict | None
131
+ memo: str | None
132
+ block_time: int | None
133
+ confirmation_status: str | None
134
+
135
+
136
+ class Supply(BaseModel):
137
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
138
+
139
+ total: int
140
+ circulating: int
141
+ non_circulating: int
142
+ non_circulating_accounts: list[str] | None = None
143
+
144
+
145
+ class TokenAccountBalance(BaseModel):
146
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
147
+
148
+ amount: str
149
+ decimals: int
150
+ ui_amount: float | None
151
+ ui_amount_string: str
152
+
153
+
154
+ class TokenAccount(BaseModel):
155
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
156
+
157
+ address: str
158
+ amount: str
159
+ decimals: int
160
+ ui_amount: float | None
161
+ ui_amount_string: str
162
+
163
+
164
+ class TokenSupply(BaseModel):
165
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
166
+
167
+ amount: str
168
+ decimals: int
169
+ ui_amount: float | None
170
+ ui_amount_string: str
171
+
172
+
173
+ class VotingAccount(BaseModel):
174
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
175
+
176
+ vote_pubkey: str
177
+ node_pubkey: str
178
+ activated_stake: int
179
+ epoch_vote_account: bool
180
+ commission: int
181
+ last_vote: int
182
+ root_slot: int
183
+ epoch_credits: list[list[int]]
184
+
185
+
186
+ class TransactionMetadata(BaseModel):
187
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
188
+
189
+ err: dict | None
190
+ fee: int
191
+ pre_balances: list[int]
192
+ post_balances: list[int]
193
+ pre_token_balances: list[dict] | None
194
+ post_token_balances: list[dict] | None
195
+ inner_instructions: list[dict] | None
196
+ log_messages: list[str] | None
197
+
198
+
199
+ class Transaction(BaseModel):
200
+ model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=to_camel))
201
+
202
+ slot: int
203
+ block_time: int | None
204
+ meta: TransactionMetadata | None
205
+ transaction: dict | list
206
+ version: Literal["legacy"] | int | None = None
@@ -0,0 +1,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: helius-python
3
+ Version: 0.0.1
4
+ Summary: Typed Python client for the Helius API
5
+ Project-URL: Homepage, https://github.com/markosnarinian/helius-python
6
+ Project-URL: Issues, https://github.com/markosnarinian/helius-python/issues
7
+ Author-email: Markos Narinian <manarinian@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.9
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest; extra == 'dev'
15
+ Requires-Dist: respx; extra == 'dev'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # helius-python
19
+
20
+ A **complete, typed Python client for [Helius](https://helius.dev)** — the
21
+ Solana developer platform.
22
+
23
+ The goal of this library is simple: **support every function, method,
24
+ endpoint, and feature that Helius exposes.** If Helius ships it, this client
25
+ wraps it.
26
+
27
+ That includes:
28
+
29
+ - ✅ **The full Solana JSON-RPC surface** proxied by Helius — `getAccountInfo`,
30
+ `getBalance`, `getBlock`, `getTransaction`, `getProgramAccounts`,
31
+ `getTokenAccountsByOwner`, `getSignaturesForAddress`, and every other
32
+ standard RPC method. **(supported today)**
33
+ - 🚧 **All Helius-specific RPC extensions** — enhanced transactions, DAS
34
+ (Digital Asset Standard) methods, priority fee estimation, and the rest of
35
+ the Helius-only RPC namespace. **(in progress)**
36
+ - 🚧 **Every Helius REST endpoint** — Enhanced Transactions API, Webhooks API,
37
+ Mint API, token metadata, address lookups, and beyond. **(in progress)**
38
+ - 🚧 **Platform features** — streaming, websockets, and any new capability
39
+ Helius adds to its API. **(in progress)**
40
+
41
+ > **Current status:** only the standard Solana JSON-RPC surface is implemented
42
+ > today. Support for Helius RPC extensions, REST endpoints, and platform
43
+ > features is actively being worked on.
44
+
45
+ Every method has typed parameters, typed return values, and dedicated model
46
+ classes built on `pydantic`, so you get full editor autocomplete and static
47
+ type checking.
48
+
49
+ ## Goals
50
+
51
+ 1. **Completeness** — 1:1 coverage of the entire Helius API surface.
52
+ 2. **Type safety** — fully typed responses.
53
+ 3. **Pythonic ergonomics** — `get_account_info(...)` instead of
54
+ `getAccountInfo(...)`, context managers.
55
+ 4. **Zero magic** — thin, predictable wrappers that map directly to the
56
+ documented Helius API.
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install helius-python
62
+ ```
63
+
64
+ ## Authentication
65
+
66
+ Pass your Helius API key explicitly:
67
+
68
+ ```python
69
+ from helius import HeliusClient
70
+
71
+ client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
72
+ ```
73
+
74
+ or set it in a `.env` file at the project root and let the client pick it up
75
+ automatically:
76
+
77
+ ```env
78
+ HELIUS_API_KEY=your_helius_api_key
79
+ ```
80
+
81
+ ```python
82
+ from helius import HeliusClient
83
+
84
+ client = HeliusClient() # reads HELIUS_API_KEY from .env
85
+ ```
86
+
87
+ ## Usage
88
+
89
+ ### As a context manager (recommended)
90
+
91
+ ```python
92
+ from helius import HeliusClient
93
+
94
+ with HeliusClient(api_key="YOUR_HELIUS_API_KEY") as client:
95
+ balance = client.get_balance("So11111111111111111111111111111111111111112")
96
+ supply = client.get_supply()
97
+ nodes = client.get_cluster_nodes()
98
+ block = client.get_block(slot=250_000_000)
99
+ tx = client.get_transaction("5j7s...signature...")
100
+ ```
101
+
102
+ `HeliusClient` implements the context-manager protocol via `__enter__` /
103
+ `__exit__`, so the underlying `httpx.Client` is closed cleanly when the
104
+ `with` block exits.
105
+
106
+ ### With an explicit `close()` call
107
+
108
+ If a `with` block doesn't fit your code structure (e.g. the client lives on
109
+ a long-lived object), call `close()` yourself when you're done:
110
+
111
+ ```python
112
+ from helius import HeliusClient
113
+
114
+ client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
115
+ try:
116
+ balance = client.get_balance("So11111111111111111111111111111111111111112")
117
+ supply = client.get_supply()
118
+ finally:
119
+ client.close()
120
+ ```
121
+
122
+ Client classes also implement `__del__` as a safety net — if you forget to
123
+ `close()` or use `with`, the underlying HTTP client is still closed when the
124
+ instance is garbage-collected. Prefer `with` or `close()` regardless.
125
+
126
+ > 🚧 **Exception & error handling is a work in progress.** Today, transport
127
+ > errors surface as raw `httpx` exceptions and Helius/Solana RPC errors are
128
+ > not yet wrapped in typed exception classes. A consistent error hierarchy is
129
+ > being worked on.
130
+
131
+ ### Defaults
132
+
133
+ | Argument | Default | Notes |
134
+ | --------- | ------------------------------------ | --------------------------------------------------------------------------------------------- |
135
+ | `base_url`| `"https://mainnet.helius-rpc.com"` | Override to point at devnet, staging, or a custom Helius endpoint. |
136
+ | `api_key` | `None` → falls back to `HELIUS_API_KEY` in a `.env` file | If neither is provided, the constructor raises `ValueError`. |
137
+
138
+ Per-method RPC parameters (`commitment`, `encoding`, `min_context_slot`, etc.)
139
+ are left unset by default — the Helius/Solana server defaults apply unless you
140
+ pass them explicitly.
141
+
142
+ ### Supported methods
143
+
144
+ The method names map 1:1 to the Solana JSON-RPC spec, just converted to
145
+ `snake_case`. If you know the RPC method name, you know the Python function.
146
+
147
+ | Solana JSON-RPC method | Python method |
148
+ | --------------------------------- | ------------------------------------------ |
149
+ | `getAccountInfo` | `client.get_account_info(...)` |
150
+ | `getBalance` | `client.get_balance(...)` |
151
+ | `getBlock` | `client.get_block(...)` |
152
+ | `getBlockCommitment` | `client.get_block_commitment(...)` |
153
+ | `getBlockHeight` | `client.get_block_height(...)` |
154
+ | `getBlockProduction` | `client.get_block_production(...)` |
155
+ | `getBlocks` | `client.get_blocks(...)` |
156
+ | `getBlocksWithLimit` | `client.get_blocks_with_limit(...)` |
157
+ | `getBlockTime` | `client.get_block_time(...)` |
158
+ | `getClusterNodes` | `client.get_cluster_nodes()` |
159
+ | `getEpochInfo` | `client.get_epoch_info(...)` |
160
+ | `getEpochSchedule` | `client.get_epoch_schedule()` |
161
+ | `getFeeForMessage` | `client.get_fee_for_message(...)` |
162
+ | `getFirstAvailableBlock` | `client.get_first_available_block()` |
163
+ | `getGenesisHash` | `client.get_genesis_hash()` |
164
+ | `getHealth` | `client.get_health()` |
165
+ | `getHighestSnapshotSlot` | `client.get_highest_snapshot_slot()` |
166
+ | `getIdentity` | `client.get_identity()` |
167
+ | `getInflationGovernor` | `client.get_inflation_governor(...)` |
168
+ | `getInflationRate` | `client.get_inflation_rate()` |
169
+ | `getLargestAccounts` | `client.get_largest_accounts(...)` |
170
+ | `getLatestBlockhash` | `client.get_latest_blockhash(...)` |
171
+ | `getLeaderSchedule` | `client.get_leader_schedule(...)` |
172
+ | `getMaxRetransmitSlot` | `client.get_max_retransmit_slot()` |
173
+ | `getMaxShredInsertSlot` | `client.get_max_shred_insert_slot()` |
174
+ | `getMinimumBalanceForRentExemption` | `client.get_minimum_balance_for_rent_exemption(...)` |
175
+ | `getMultipleAccounts` | `client.get_multiple_accounts(...)` |
176
+ | `getProgramAccounts` | `client.get_program_accounts(...)` |
177
+ | `getRecentPerformanceSamples` | `client.get_recent_performance_samples(...)` |
178
+ | `getRecentPrioritizationFees` | `client.get_recent_prioritization_fees(...)` |
179
+ | `getSignaturesForAddress` | `client.get_signatures_for_address(...)` |
180
+ | `getSignatureStatuses` | `client.get_signature_statuses(...)` |
181
+ | `getSlot` | `client.get_slot(...)` |
182
+ | `getSlotLeader` | `client.get_slot_leader(...)` |
183
+ | `getSlotLeaders` | `client.get_slot_leaders(...)` |
184
+ | `getStakeMinimumDelegation` | `client.get_stake_minimum_delegation(...)` |
185
+ | `getSupply` | `client.get_supply(...)` |
186
+ | `getTokenAccountBalance` | `client.get_token_account_balance(...)` |
187
+ | `getTokenAccountsByDelegate` | `client.get_token_accounts_by_delegate(...)` |
188
+ | `getTokenAccountsByOwner` | `client.get_token_accounts_by_owner(...)` |
189
+ | `getTokenLargestAccounts` | `client.get_token_largest_accounts(...)` |
190
+ | `getTokenSupply` | `client.get_token_supply(...)` |
191
+ | `getTransaction` | `client.get_transaction(...)` |
192
+ | `getTransactionCount` | `client.get_transaction_count(...)` |
193
+ | `getVersion` | `client.get_version()` |
194
+ | `getVoteAccounts` | `client.get_vote_accounts(...)` |
195
+ | `isBlockhashValid` | `client.is_blockhash_valid(...)` |
196
+ | `minimumLedgerSlot` | `client.minimum_ledger_slot()` |
197
+ | `requestAirdrop` | `client.request_airdrop(...)` |
198
+
199
+ ### Reference
200
+
201
+ The table above is a quick index of what's implemented. For each method's
202
+ parameters, semantics, return shape, edge cases, and links to the underlying
203
+ Helius docs, see the **API reference** (🚧 hosted version coming soon).
204
+
205
+ In the meantime, every public method and model carries a Google-style
206
+ docstring that is the source of truth for that symbol. You can read it
207
+ straight from a REPL:
208
+
209
+ ```python
210
+ from helius import HeliusClient
211
+ help(HeliusClient.get_balance)
212
+ ```
213
+
214
+ or from your editor's inline help / hover. Each docstring links back to the
215
+ relevant [Helius RPC guide](https://www.helius.dev/docs/rpc) and
216
+ [Helius API reference](https://www.helius.dev/docs/api-reference) page so you
217
+ can always confirm behavior against upstream.
218
+
219
+ If you hit a bug, a missing parameter, or surprising behavior, please
220
+ [open an issue](https://github.com/markosnarinian/helius-python/issues).
221
+
222
+ ## Status
223
+
224
+ Actively expanding toward full coverage of the Helius API. See
225
+ [`src/helius/client.py`](src/helius/client.py) for the current list of
226
+ implemented methods; missing endpoints are tracked as issues and added
227
+ continuously.
228
+
229
+ ## License
230
+
231
+ [MIT](LICENSE)
@@ -0,0 +1,7 @@
1
+ helius/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ helius/client.py,sha256=SIczNqX2U_3ULM9-yO3ba3MOWMog4rtS6qkvXoDH_mQ,33229
3
+ helius/models.py,sha256=X6aLhpAIvVccgCIJE_h2TO0RRdBI26EmaGNylT11Y3A,5082
4
+ helius_python-0.0.1.dist-info/METADATA,sha256=knkLVOWYaVDKLPAeBdh5Pi0smm0Hn3viIwvhsNHHPmU,10671
5
+ helius_python-0.0.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
6
+ helius_python-0.0.1.dist-info/licenses/LICENSE,sha256=bZc2EDmq_GsWH77uK8LBn1kqqrOPcp2f9p-ys9bYa1E,1072
7
+ helius_python-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Markos Narinian
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.