11---
22url: https://github.com/helius-labs/helius-rust-sdk
3- last_updated: 2026-02-19
3+ last_updated: 2026-03-11
44---
55
66# Helius Rust SDK
@@ -31,6 +31,9 @@ Use the Helius Rust SDK when you need to:
3131- Send transactions with ultra-low latency via Helius Sender
3232- Set up webhooks for on-chain events (sales, transfers, swaps)
3333- Stream real-time blockchain data via Enhanced WebSockets
34+ - Look up wallet identity, balances, transfers, and funding sources
35+ - Work with ZK compressed accounts and tokens
36+ - Stake SOL, unstake, and withdraw via the Helius validator
3437- Make RPC calls on Solana's most performant infrastructure
3538- Build high-performance Rust backends for Solana applications
3639
@@ -39,7 +42,7 @@ Use the Helius Rust SDK when you need to:
3942Add to your `Cargo.toml`:
4043```toml
4144[dependencies]
42- helius = "0.5 "
45+ helius = "1.0 "
4346tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
4447```
4548
@@ -67,34 +70,99 @@ async fn main() -> Result<()> {
6770
6871## Examples Directory
6972
70- The `examples/` directory contains working code samples for SDK features :
73+ The `examples/` directory contains working code samples organized by feature :
7174
7275```
7376examples/
74- ├── get_asset_batch.rs # DAS API: batch asset fetching
75- ├── get_asset_proof_batch.rs # DAS API: Merkle proofs for cNFTs
76- ├── get_transactions_for_address.rs # RPC: transaction history
77- ├── get_transactions_for_address_with_filters.rs # RPC: filtered tx history
78- ├── get_priority_fee_estimate.rs # RPC: priority fee estimation
79- ├── get_program_accounts_v2.rs # RPC V2: paginated program accounts
80- ├── get_token_accounts_by_owner_v2.rs # RPC V2: paginated token accounts
81- ├── get_all_program_accounts.rs # Auto-paginating program accounts
82- ├── get_all_token_accounts_by_owner.rs # Auto-paginating token accounts
83- ├── send_smart_transaction_with_seeds.rs # Helius Sender: thread-safe transactions
84- ├── create_webhook.rs # Webhook creation
85- ├── edit_webhook.rs # Webhook modification
86- ├── delete_webhook.rs # Webhook deletion
87- ├── get_all_webhooks.rs # List webhooks
88- ├── enhanced_websocket_transactions.rs # WebSocket: transaction streaming
89- ├── enhanced_websocket_accounts.rs # WebSocket: account streaming
90- ├── get_parse_transactions.rs # Enhanced: parse transactions
91- └── get_parsed_transaction_history.rs # Enhanced: parsed tx history
77+ ├── das/ # DAS API (Digital Asset Standard)
78+ │ ├── get_asset_batch.rs # Batch asset fetching
79+ │ ├── get_asset_proof_batch.rs # Merkle proofs for cNFTs
80+ │ ├── get_all_program_accounts.rs # Auto-paginating program accounts
81+ │ └── get_all_token_accounts_by_owner.rs # Auto-paginating token accounts
82+ ├── enhanced/ # Enhanced transaction parsing
83+ │ ├── get_parse_transactions.rs # Parse transactions by signature
84+ │ ├── get_parsed_transaction_history.rs # Parsed tx history for address
85+ │ ├── get_transactions_for_address.rs # Transaction history
86+ │ └── get_transactions_for_address_with_filters.rs # Filtered tx history
87+ ├── helius/ # Helius-specific RPC methods
88+ │ ├── async_config_based_creation.rs # HeliusBuilder usage
89+ │ ├── get_priority_fee_estimate.rs # Priority fee estimation
90+ │ ├── get_program_accounts_v2.rs # RPC V2: paginated program accounts
91+ │ └── get_token_accounts_by_owner_v2.rs # RPC V2: paginated token accounts
92+ ├── solana/ # Standard Solana RPC
93+ │ ├── get_latest_blockhash.rs # Sync blockhash fetch
94+ │ └── get_latest_blockhash_async.rs # Async blockhash fetch
95+ ├── transactions/ # Smart transactions & Helius Sender
96+ │ └── send_smart_transaction_with_seeds.rs # Thread-safe transaction sending
97+ ├── wallet/ # Wallet API
98+ │ ├── get_wallet_identity.rs # Wallet identity lookup
99+ │ ├── get_batch_wallet_identity.rs # Batch identity lookup
100+ │ ├── get_wallet_balances.rs # Token & NFT balances
101+ │ ├── get_wallet_history.rs # Transaction history with deltas
102+ │ ├── get_wallet_transfers.rs # Token transfer activity
103+ │ └── get_wallet_funding_source.rs # Original funding source
104+ ├── webhooks/ # Webhook CRUD
105+ │ ├── create_webhook.rs # Create webhook
106+ │ ├── edit_webhook.rs # Modify webhook
107+ │ ├── delete_webhook.rs # Delete webhook
108+ │ ├── get_all_webhooks.rs # List webhooks
109+ │ ├── get_webhook_by_id.rs # Get webhook by ID
110+ │ ├── append_address_to_webhook.rs # Add address to webhook
111+ │ └── remove_address_from_webhook.rs # Remove address from webhook
112+ ├── websockets/ # Enhanced WebSocket streaming
113+ │ ├── enhanced_websocket_transactions.rs # Transaction streaming
114+ │ └── enhanced_websocket_accounts.rs # Account streaming
115+ └── zk_compression/ # ZK Compression
116+ ├── get_compressed_account.rs # Fetch compressed account
117+ ├── get_compressed_token_balances.rs # Compressed token balances
118+ └── get_validity_proof.rs # Validity proof for transactions
92119```
93120
94121Run examples: `cargo run --example get_asset_batch`
95122
96123Browse examples: https://github.com/helius-labs/helius-rust-sdk/tree/dev/examples
97124
125+ ## Client Construction
126+
127+ ### Basic Constructors
128+
129+ ```rust
130+ // Sync client (no WebSocket, no async Solana)
131+ let helius = Helius::new("api-key", Cluster::MainnetBeta)?;
132+
133+ // Async client with WebSocket + async Solana + confirmed commitment
134+ let helius = Helius::new_async("api-key", Cluster::MainnetBeta).await?;
135+
136+ // Custom RPC URL, no API key required
137+ let helius = Helius::new_with_url("http://localhost:8899")?;
138+ ```
139+
140+ ### HeliusBuilder
141+
142+ Fine-grained control over client configuration:
143+
144+ ```rust
145+ use helius::HeliusBuilder;
146+ use helius::types::Cluster;
147+ use solana_commitment_config::CommitmentConfig;
148+
149+ let helius = HeliusBuilder::new()
150+ .with_api_key("your-key")?
151+ .with_cluster(Cluster::MainnetBeta)
152+ .with_async_solana()
153+ .with_commitment(CommitmentConfig::confirmed())
154+ .with_websocket(Some(5), Some(15)) // custom ping/pong timeouts
155+ .build()
156+ .await?;
157+
158+ // Custom RPC endpoint
159+ let helius = HeliusBuilder::new()
160+ .with_custom_url("https://my-rpc-provider.com/")?
161+ .with_api_key("optional-key")?
162+ .build()
163+ .await?;
164+ ```
165+
98166## Core Capabilities
99167
100168### DAS API (Digital Asset Standard)
@@ -347,7 +415,7 @@ Stream real-time blockchain data via Helius Enhanced WebSockets.
347415
348416```rust
349417// Create client with WebSocket support
350- let helius = Helius::new_with_ws ("api_key", Cluster::MainnetBeta).await?;
418+ let helius = Helius::new_async ("api_key", Cluster::MainnetBeta).await?;
351419
352420// Subscribe to transactions
353421let ws = helius.ws()?;
@@ -375,11 +443,115 @@ let balance = helius.connection().get_balance(&pubkey)?;
375443let blockhash = helius.connection().get_latest_blockhash()?;
376444let slot = helius.connection().get_slot()?;
377445
378- // Asynchronous client (use new_with_async_solana )
379- let helius = Helius::new_with_async_solana ("api_key", Cluster::MainnetBeta)?;
446+ // Asynchronous client (use HeliusBuilder or new_async )
447+ let helius = Helius::new_async ("api_key", Cluster::MainnetBeta).await ?;
380448let balance = helius.async_connection()?.get_balance(&pubkey).await?;
381449```
382450
451+ ### Wallet API
452+
453+ Look up wallet identity, balances, transfer activity, and funding sources.
454+
455+ ```rust
456+ // Get wallet identity (exchanges, protocols, etc.)
457+ let identity = helius.get_wallet_identity("wallet_address").await?;
458+ println!("{}: {}", identity.name, identity.category);
459+
460+ // Batch identity lookup (up to 100 addresses)
461+ let identities = helius.get_batch_wallet_identity(&addresses).await?;
462+
463+ // Get token & NFT balances sorted by USD value
464+ let balances = helius.get_wallet_balances(
465+ "wallet_address",
466+ Some(1), // page
467+ Some(100), // limit
468+ Some(false), // show_zero_balance
469+ Some(true), // show_native (SOL)
470+ Some(true), // show_nfts
471+ ).await?;
472+ println!("Portfolio: ${}", balances.total_usd_value);
473+
474+ // Transaction history with balance changes
475+ let history = helius.get_wallet_history(
476+ "wallet_address",
477+ Some(50), // limit
478+ None, // before (pagination cursor)
479+ None, // after
480+ Some("SWAP".to_string()), // transaction_type filter
481+ Some("balanceChanged".to_string()),// token_accounts filter
482+ ).await?;
483+
484+ // Token transfer activity
485+ let transfers = helius.get_wallet_transfers("wallet_address", Some(50), None).await?;
486+
487+ // Original funding source analysis
488+ let funding = helius.get_wallet_funding_source("wallet_address").await?;
489+ println!("Funded by: {} with {} SOL", funding.funder, funding.amount);
490+ ```
491+
492+ ### ZK Compression
493+
494+ Work with ZK compressed accounts and tokens for up to 1000x cost savings on-chain storage.
495+
496+ ```rust
497+ use helius::types::{GetCompressedAccountRequest, GetCompressedTokenBalancesByOwnerRequest};
498+
499+ // Get a compressed account by hash
500+ let account = helius.get_compressed_account(GetCompressedAccountRequest {
501+ hash: Some("account_hash".to_string()),
502+ ..Default::default()
503+ }).await?;
504+
505+ // Get compressed token balances for a wallet
506+ let balances = helius.get_compressed_token_balances_by_owner(
507+ GetCompressedTokenBalancesByOwnerRequest {
508+ owner: "wallet_address".to_string(),
509+ ..Default::default()
510+ },
511+ ).await?;
512+
513+ // Get a validity proof for building transactions
514+ let proof = helius.get_validity_proof(GetValidityProofRequest {
515+ hashes: Some(vec!["hash1".to_string()]),
516+ ..Default::default()
517+ }).await?;
518+
519+ // Get compressed token accounts by owner or delegate
520+ let token_accounts = helius.get_compressed_token_accounts_by_owner(request).await?;
521+ let delegated = helius.get_compressed_token_accounts_by_delegate(request).await?;
522+
523+ // Get Merkle proof for a compressed account
524+ let proof = helius.get_compressed_account_proof(request).await?;
525+
526+ // Check indexer health
527+ let healthy = helius.get_indexer_health().await?;
528+ ```
529+
530+ ### Staking
531+
532+ Create, delegate, unstake, and withdraw stake accounts via the Helius validator.
533+
534+ ```rust
535+ use solana_sdk::pubkey::Pubkey;
536+
537+ // Create and delegate a stake account (returns unsigned tx + stake account pubkey)
538+ let (unsigned_tx, stake_pubkey) = helius.create_stake_transaction(owner_pubkey, 1.0).await?;
539+
540+ // Deactivate a stake account (returns unsigned tx; ~2 epoch cooldown)
541+ let unsigned_tx = helius.create_unstake_transaction(owner_pubkey, stake_pubkey).await?;
542+
543+ // Withdraw from a fully cooled-down stake account (returns unsigned tx)
544+ let unsigned_tx = helius.create_withdraw_stake_transaction(
545+ owner_pubkey,
546+ stake_pubkey,
547+ destination_pubkey,
548+ lamports,
549+ ).await?;
550+
551+ // Get all stake accounts for a wallet
552+ let stake_accounts = helius.get_stake_accounts(owner_pubkey).await?;
553+ ```
554+
383555## Key Types
384556
385557```rust
@@ -479,11 +651,11 @@ tokio::spawn(async move {
479651```toml
480652# Default: native TLS (OpenSSL)
481653[dependencies]
482- helius = "0.5 "
654+ helius = "1.0 "
483655
484656# Alternative: rustls (pure Rust, no OpenSSL dependency)
485657[dependencies]
486- helius = { version = "0.5 ", default-features = false, features = ["rustls"] }
658+ helius = { version = "1.0 ", default-features = false, features = ["rustls"] }
487659```
488660
489661## Plans and Rate Limits
0 commit comments