Typed Python client for the Helius API
Project description
helius-python
A complete, typed Python client for Helius — the Solana developer platform.
TL;DR
pip install helius-python
# export HELIUS_API_KEY=your_key (or put it in .env)
from helius.client import HeliusClient
with HeliusClient() as helius:
_ctx, lamports = helius.get_balance("7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU")
print(f"{lamports / 1_000_000_000:.4f} SOL")
for sig in helius.get_signatures_for_address(
"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU", limit=5
):
print(sig.slot, "ERR" if sig.err else "OK ", sig.signature)
HELIUS_API_KEY is read from the environment (or .env), the
client is a context manager, and every return value is fully typed.
Why this over solana-py / solders?
solders is for building and signing transactions. solana-py is a generic Solana RPC client. Use them for that.
This library is for talking to Helius specifically — typed pydantic responses, snake_case, and (eventually) the Helius-only endpoints (DAS, Enhanced Transactions, Webhooks, priority fees) the others don't cover. Plays nicely alongside solders: sign with solders, read with helius-python.
Example: wallet tracker
See examples/wallet_tracker.py for a
runnable script that takes a wallet address and prints:
- SOL balance
- All non-empty SPL token accounts (mint, balance, account)
- The last N transactions (timestamp, slot, success/error, signature)
export HELIUS_API_KEY=your_helius_api_key
python examples/wallet_tracker.py 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU --limit 20
It uses get_balance, get_token_accounts_by_owner (with
encoding="jsonParsed"), and get_signatures_for_address — pure
stdlib plus this library, no solana-py or solders needed.
Coverage
The goal of this library is support every function, method, endpoint, and feature that Helius exposes. If Helius ships it, this client wraps it.
- ✅ The full Solana JSON-RPC surface proxied by Helius —
getAccountInfo,getBalance,getBlock,getTransaction,getProgramAccounts,getTokenAccountsByOwner,getSignaturesForAddress, and every other standard RPC method. (supported today) - 🚧 All Helius-specific RPC extensions — enhanced transactions, DAS (Digital Asset Standard) methods, priority fee estimation, and the rest of the Helius-only RPC namespace. (in progress)
- 🚧 Every Helius REST endpoint — Enhanced Transactions API, Webhooks API, Mint API, token metadata, address lookups, and beyond. (in progress)
- 🚧 Platform features — streaming, websockets, and any new capability Helius adds to its API. (in progress)
Current status: only the standard Solana JSON-RPC surface is implemented today. Support for Helius RPC extensions, REST endpoints, and platform features is actively being worked on.
Goals
- Completeness — 1:1 coverage of the entire Helius API surface.
- Type safety — fully typed responses.
- Pythonic ergonomics —
get_account_info(...)instead ofgetAccountInfo(...), context managers. - Zero magic — thin, predictable wrappers that map directly to the documented Helius API.
Authentication
Pass your Helius API key explicitly:
from helius.client import HeliusClient
client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
or set HELIUS_API_KEY as an environment variable:
export HELIUS_API_KEY=your_helius_api_key
You can also set it in a .env file at the project root and let the
client pick it up automatically:
HELIUS_API_KEY=your_helius_api_key
from helius.client import HeliusClient
client = HeliusClient() # reads HELIUS_API_KEY from the environment or .env
Usage
As a context manager (recommended)
from helius.client import HeliusClient
with HeliusClient(api_key="YOUR_HELIUS_API_KEY") as client:
_ctx, balance = client.get_balance("So11111111111111111111111111111111111111112")
_ctx, supply = client.get_supply()
nodes = client.get_cluster_nodes()
block = client.get_block(slot=250_000_000)
tx = client.get_transaction("5j7s...signature...")
HeliusClient implements the context-manager protocol via __enter__ /
__exit__, so the underlying httpx.Client is closed cleanly when the
with block exits.
With an explicit close() call
If a with block doesn't fit your code structure (e.g. the client lives
on a long-lived object), call close() yourself when you're done:
from helius.client import HeliusClient
client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
try:
_ctx, balance = client.get_balance("So11111111111111111111111111111111111111112")
_ctx, supply = client.get_supply()
finally:
client.close()
Client classes also implement __del__ as a safety net — if you forget
to close() or use with, the underlying HTTP client is still closed
when the instance is garbage-collected. Prefer with or close()
regardless.
🚧 Exception & error handling is a work in progress. Today, transport errors surface as raw
httpxexceptions and Helius/Solana RPC errors are not yet wrapped in typed exception classes. A consistent error hierarchy is being worked on.
Defaults
| Argument | Default | Notes |
|---|---|---|
base_url |
"https://mainnet.helius-rpc.com" |
Override to point at devnet, staging, or a custom Helius endpoint. |
api_key |
None → falls back to HELIUS_API_KEY from the environment, then .env |
If none is provided, the constructor raises ValueError. |
Per-method RPC parameters (commitment, encoding, min_context_slot,
etc.) are left unset by default — the Helius/Solana server defaults
apply unless you pass them explicitly.
Reference
For parameters, semantics, and return shapes, see the official Helius docs: RPC guide and API reference.
If you hit a bug, a missing parameter, or surprising behavior, please open an issue.
Supported methods
The method names map 1:1 to the Solana JSON-RPC spec, just converted to
snake_case. If you know the RPC method name, you know the Python function.
Status
Actively expanding toward full coverage of the Helius API. See
src/helius/client.py for the current list of
implemented methods; missing endpoints are tracked as issues and added
continuously.
| Solana JSON-RPC method | Python method | Helius docs |
|---|---|---|
getAccountInfo |
client.get_account_info(...) |
guide · ref |
getBalance |
client.get_balance(...) |
guide · ref |
getBlock |
client.get_block(...) |
guide · ref |
getBlockCommitment |
client.get_block_commitment(...) |
guide · ref |
getBlockHeight |
client.get_block_height(...) |
guide · ref |
getBlockProduction |
client.get_block_production(...) |
guide · ref |
getBlocks |
client.get_blocks(...) |
guide · ref |
getBlocksWithLimit |
client.get_blocks_with_limit(...) |
guide · ref |
getBlockTime |
client.get_block_time(...) |
guide · ref |
getClusterNodes |
client.get_cluster_nodes() |
guide · ref |
getEpochInfo |
client.get_epoch_info(...) |
guide · ref |
getEpochSchedule |
client.get_epoch_schedule() |
guide · ref |
getFeeForMessage |
client.get_fee_for_message(...) |
guide · ref |
getFirstAvailableBlock |
client.get_first_available_block() |
guide · ref |
getGenesisHash |
client.get_genesis_hash() |
guide · ref |
getHealth |
client.get_health() |
guide · ref |
getHighestSnapshotSlot |
client.get_highest_snapshot_slot() |
guide · ref |
getIdentity |
client.get_identity() |
guide · ref |
getInflationGovernor |
client.get_inflation_governor(...) |
guide · ref |
getInflationRate |
client.get_inflation_rate() |
guide · ref |
getLargestAccounts |
client.get_largest_accounts(...) |
guide · ref |
getLatestBlockhash |
client.get_latest_blockhash(...) |
guide · ref |
getLeaderSchedule |
client.get_leader_schedule(...) |
guide · ref |
getMaxRetransmitSlot |
client.get_max_retransmit_slot() |
guide · ref |
getMaxShredInsertSlot |
client.get_max_shred_insert_slot() |
guide · ref |
getMinimumBalanceForRentExemption |
client.get_minimum_balance_for_rent_exemption(...) |
guide · ref |
getMultipleAccounts |
client.get_multiple_accounts(...) |
guide · ref |
getProgramAccounts |
client.get_program_accounts(...) |
guide · ref |
getRecentPerformanceSamples |
client.get_recent_performance_samples(...) |
guide · ref |
getRecentPrioritizationFees |
client.get_recent_prioritization_fees(...) |
guide · ref |
getSignaturesForAddress |
client.get_signatures_for_address(...) |
guide · ref |
getSignatureStatuses |
client.get_signature_statuses(...) |
guide · ref |
getSlot |
client.get_slot(...) |
guide · ref |
getSlotLeader |
client.get_slot_leader(...) |
guide · ref |
getSlotLeaders |
client.get_slot_leaders(...) |
guide · ref |
getStakeMinimumDelegation |
client.get_stake_minimum_delegation(...) |
guide · ref |
getSupply |
client.get_supply(...) |
guide · ref |
getTokenAccountBalance |
client.get_token_account_balance(...) |
guide · ref |
getTokenAccountsByDelegate |
client.get_token_accounts_by_delegate(...) |
guide · ref |
getTokenAccountsByOwner |
client.get_token_accounts_by_owner(...) |
guide · ref |
getTokenLargestAccounts |
client.get_token_largest_accounts(...) |
guide · ref |
getTokenSupply |
client.get_token_supply(...) |
guide · ref |
getTransaction |
client.get_transaction(...) |
guide · ref |
getTransactionCount |
client.get_transaction_count(...) |
guide · ref |
getVersion |
client.get_version() |
guide · ref |
getVoteAccounts |
client.get_vote_accounts(...) |
guide · ref |
isBlockhashValid |
client.is_blockhash_valid(...) |
guide · ref |
minimumLedgerSlot |
client.minimum_ledger_slot() |
guide · ref |
requestAirdrop |
client.request_airdrop(...) |
guide · ref |
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file helius_python-0.0.4.tar.gz.
File metadata
- Download URL: helius_python-0.0.4.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81fb70ded998273f48e541dcd66e196470c3b01e0cbe57e0e0c13bcd70327d1b
|
|
| MD5 |
23b322459bea6c4f2f7a11a682443a0c
|
|
| BLAKE2b-256 |
7934f0d947478737cb177679e04999f576a2fcc99953d7c4d187567e1ec06bb2
|
Provenance
The following attestation bundles were made for helius_python-0.0.4.tar.gz:
Publisher:
python-publish.yml on markosnarinian/helius-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
helius_python-0.0.4.tar.gz -
Subject digest:
81fb70ded998273f48e541dcd66e196470c3b01e0cbe57e0e0c13bcd70327d1b - Sigstore transparency entry: 1653239699
- Sigstore integration time:
-
Permalink:
markosnarinian/helius-python@6de138f14bc68c5372bb1cfb38b848e7f6c91f87 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/markosnarinian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6de138f14bc68c5372bb1cfb38b848e7f6c91f87 -
Trigger Event:
release
-
Statement type:
File details
Details for the file helius_python-0.0.4-py3-none-any.whl.
File metadata
- Download URL: helius_python-0.0.4-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9cfaddde01b286e66a186b0d55ced2f864ea99c938b94e6303b98ca4a9fcb34
|
|
| MD5 |
cf40543e98acec3be57cd9201d06b689
|
|
| BLAKE2b-256 |
35a78a2f0c1636c9edef0956681a30388c421d839df505d2254eb65a9b9af4dc
|
Provenance
The following attestation bundles were made for helius_python-0.0.4-py3-none-any.whl:
Publisher:
python-publish.yml on markosnarinian/helius-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
helius_python-0.0.4-py3-none-any.whl -
Subject digest:
b9cfaddde01b286e66a186b0d55ced2f864ea99c938b94e6303b98ca4a9fcb34 - Sigstore transparency entry: 1653239822
- Sigstore integration time:
-
Permalink:
markosnarinian/helius-python@6de138f14bc68c5372bb1cfb38b848e7f6c91f87 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/markosnarinian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6de138f14bc68c5372bb1cfb38b848e7f6c91f87 -
Trigger Event:
release
-
Statement type: