Skip to main content

A lightweight Helius RPC client in python for Solana that offers a variety of features including enhanced transaction history, token metadata, and more.

Project description

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 None instead 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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

helius_api-1.0.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

helius_api-1.0.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file helius_api-1.0.0.tar.gz.

File metadata

  • Download URL: helius_api-1.0.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for helius_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 55bb0889b587a28294d2379803d57ab34581a3b622054600bc51655984a8c727
MD5 250473e6ada8f53d6301ef9daf2ef42d
BLAKE2b-256 3b654c5ffcabf430729bc25e1712e317a3b66173330e463d0fbdc1134d6b0fd6

See more details on using hashes here.

File details

Details for the file helius_api-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: helius_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for helius_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e393d74e7c74481d710097ecba41ad18b2caa059d1ca375e1607a2fbb07d109c
MD5 7f11335efafcda8e32dd6d93ed574c0f
BLAKE2b-256 fa07d1f8092a7528363b3306c206d2a3a3de378612a579b8c2a72cf54e4b211b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page