helius-py
A lightweight Helius RPC client in Python for Solana. It offers a clean, typed wrapper around the Helius JSON-RPC HTTP methods, grouped into intuitive modules for accounts, blocks, epochs, slots, tokens, transactions, inflation/rewards, and system information.
Features
- Simple, ergonomic client built on top of the Helius RPC API
- Logically grouped modules accessible as properties on the client
- Typed models (via Pydantic) for structured responses
- Graceful error handling — RPC and network errors return
Noneinstead of raising - Covers a broad surface of Solana RPC methods:
- Accounts — account info, balances, program accounts, rent exemption, largest accounts
- Block — blocks, block height/time, production, commitment, latest blockhash
- Epoch — epoch info, schedule, leader schedule
- Slot — current slot, slot leaders, snapshot info
- Token — token balances, accounts by owner/delegate, supply, largest accounts
- Transactions — transaction history, signatures, statuses, send/simulate, airdrops
- Inflation & Rewards — inflation governor, rate, and reward details
- System Info — health, version, identity, cluster nodes, prioritization fees, supply
Requirements
- Python >= 3.12
- A Helius API key (get one here)
Installation
Install using pip:
pip install helius-api
Requirements: Python 3.7+
Quick Start
from helius import Helius
# Initialize the client with your Helius API key
client = Helius(apiKey="YOUR_API_KEY")
# Get the SOL balance (in lamports) for an account
balance = client.accounts.getBalance("So11111111111111111111111111111111111111112")
print(balance)
# Get account info
info = client.accounts.getInfo("So11111111111111111111111111111111111111112")
print(info)
# Check cluster health
print(client.systemInfo.getHealth())
# Get the supply of a token mint
supply = client.token.getTokenSupply("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
print(supply)
Configuration
The Helius client accepts the following constructor arguments:
| Argument | Type | Default | Description |
|---|---|---|---|
apiKey |
str |
required | Your Helius API key |
jsonrpc |
str | None |
"2.0" |
JSON-RPC version |
id |
int | None |
1 |
JSON-RPC request ID |
url |
str | None |
https://mainnet.helius-rpc.com |
Base RPC URL |
Modules
The client exposes the following modules as properties:
| Property | Description |
|---|---|
client.accounts |
Account info, balances, program accounts, rent exemption |
client.block |
Blocks, heights, production, commitment, blockhashes |
client.epoch |
Epoch info, schedules, leader schedules |
client.slot |
Current slots, leaders, snapshot info |
client.token |
Token balances, accounts by owner/delegate, supply |
client.transactions |
Transaction history, signatures, statuses, send/simulate, airdrops |
client.inflationRewards |
Inflation governor, rate, and reward details |
client.systemInfo |
Health, version, identity, cluster nodes, prioritization fees |
Error Handling
Methods return None when a request fails — either due to a network error or an
RPC-level error. Error details are printed to the console, so always check for
None before using a result:
result = client.accounts.getBalance("invalid-key")
if result is None:
print("Request failed")
Running Tests
python -m pytest tests/ -v
License
Released under the MIT License.
Metadata
Release files for helius-api 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| helius_api-1.0.0.tar.gz | 21.6 kB | Without provenance | Details for helius_api-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| helius_api-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for helius_api-1.0.0-py3-none-any.whl |
Total release size: 42.5 kB
Release files / helius_api-1.0.0.tar.gz
| Download URL | helius_api-1.0.0.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55bb0889b587a28294d2379803d57ab34581a3b622054600bc51655984a8c727
|
|
BLAKE2b-256 checksum How to use checksums |
3b654c5ffcabf430729bc25e1712e317a3b66173330e463d0fbdc1134d6b0fd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / helius_api-1.0.0-py3-none-any.whl
| Download URL | helius_api-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e393d74e7c74481d710097ecba41ad18b2caa059d1ca375e1607a2fbb07d109c
|
|
BLAKE2b-256 checksum How to use checksums |
fa07d1f8092a7528363b3306c206d2a3a3de378612a579b8c2a72cf54e4b211b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for helius-api 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.