### Helius SDK Quick Start Example Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md A comprehensive example demonstrating how to initialize the Helius client and perform common operations like fetching NFTs, transaction history, and sending smart transactions. ```rust use helius::Helius; use helius::types::Cluster; #[tokio::main] async fn main() -> helius::error::Result<()> { let helius = Helius::new("your-api-key", Cluster::MainnetBeta)?; // Get all NFTs owned by a wallet let assets = helius.rpc().get_assets_by_owner(GetAssetsByOwner { owner_address: "wallet_address".to_string(), page: 1, limit: Some(50), ..Default::default() }).await?; // Get transaction history with token account activity let txs = helius.rpc().get_transactions_for_address( "wallet_address".to_string(), GetTransactionsForAddressOptions { limit: Some(100), transaction_details: Some(TransactionDetails::Full), filters: Some(GetTransactionsFilters { token_accounts: Some(TokenAccountsFilter::BalanceChanged), ..Default::default() }), ..Default::default() }, ).await?; // Send a transaction via Helius Sender (ultra-low latency) let sig = helius.send_smart_transaction_with_sender( SmartTransactionConfig { create_config: CreateSmartTransactionConfig { instructions: vec![transfer_instruction], signers: vec![wallet_signer], ..Default::default() }, ..Default::default() }, SenderSendOptions { region: "US_EAST".to_string(), // Default, US_SLC, US_EAST, EU_WEST, EU_CENTRAL, EU_NORTH, AP_SINGAPORE, AP_TOKYO ..Default::default() }, ).await?; Ok(()) } ``` -------------------------------- ### Rust Integration Test Setup with Mockito Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/CLAUDE.md Example of setting up an integration test using `tokio::test` and `mockito` for mocking HTTP requests to the Helius API. ```rust #[tokio::test] async fn test_get_asset_success() { let mut server = Server::new_with_opts_async(...).await; // Setup mock, create client, assert results } ``` -------------------------------- ### Helius Sender API Examples Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Examples for sending smart transactions and managing tips using the Helius Sender. These methods facilitate building and sending transactions, including those with tips, and calculating tip amounts. ```rust helius.send_smart_transaction_with_sender(config, sender_opts) // Build + send via Sender helius.create_smart_transaction_with_tip_for_sender(config, tip) // Build with tip helius.send_and_confirm_via_sender(tx, last_block, sender_opts) // Send pre-built tx via Sender helius.determine_tip_lamports(swqos_only) // Calculate tip amount helius.fetch_tip_floor_75th() // Get Jito tip floor helius.warm_sender_connection(region) // Warm connection via /ping ``` -------------------------------- ### Recommended Environment Variables (.env file) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/configuration.md Example of environment variables to add to a .env file for Helius SDK configuration. ```bash HELIUS_API_KEY=your_api_key_here HELIUS_CLUSTER=mainnet # or devnet, staked-mainnet HELIUS_RPC_URL=https://your-custom-rpc.com # optional ``` -------------------------------- ### Get Wallet Funding Source Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Analyze the original funding source for a wallet, identifying the funder and the amount of SOL used. ```rust let funding = helius.get_wallet_funding_source("wallet_address").await?; println!("Funded by: {} with {} SOL", funding.funder, funding.amount); ``` -------------------------------- ### Get All Webhooks Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/webhooks.md Retrieves a list of all webhooks configured for the account. ```APIDOC ## get_all_webhooks() ### Description Retrieves all webhooks configured for the account. ### Method Signature `pub async fn get_all_webhooks(&self) -> Result>` ### Parameters This method does not take any parameters. ### Returns - `Result>` - Vector of all webhook objects. ### Note Response is truncated to 100 addresses per webhook configuration due to response size limitations. ### Errors - `Unauthorized` - API key is missing - Network errors from API request ### Example ```rust use helius::Helius; use helius::types::Cluster; #[tokio::main] async fn main() -> helius::error::Result<()> { let helius = Helius::new("your_api_key", Cluster::MainnetBeta)?; let webhooks = helius.get_all_webhooks().await?; println!("Total webhooks: {}", webhooks.len()); for webhook in webhooks { println!( "Webhook {} -> {} ({} addresses)", webhook.webhook_id, webhook.webhook_url, webhook.account_addresses.len() ); } Ok(()) } ``` ``` -------------------------------- ### Client Construction Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Examples of how to construct Helius clients, including basic synchronous and asynchronous clients, as well as a builder for fine-grained configuration. ```APIDOC ## Client Construction ### Basic Constructors ```rust // Sync client (no WebSocket, no async Solana) let helius = Helius::new("api-key", Cluster::MainnetBeta)?; // Async client with WebSocket + async Solana + confirmed commitment let helius = Helius::new_async("api-key", Cluster::MainnetBeta).await?; // Custom RPC URL, no API key required let helius = Helius::new_with_url("http://localhost:8899")?; ``` ### HeliusBuilder Fine-grained control over client configuration: ```rust use helius::HeliusBuilder; use helius::types::Cluster; use solana_commitment_config::CommitmentConfig; let helius = HeliusBuilder::new() .with_api_key("your-key")? .with_cluster(Cluster::MainnetBeta) .with_async_solana() .with_commitment(CommitmentConfig::confirmed()) .with_websocket(Some(5), Some(15)) // custom ping/pong timeouts .build() .await?; // Custom RPC endpoint let helius = HeliusBuilder::new() .with_custom_url("https://my-rpc-provider.com/")? .with_api_key("optional-key")? .build() .await?; ``` ``` -------------------------------- ### HeliusBuilder::new() Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/builder.md Creates a new HeliusBuilder instance with default settings. This is the starting point for configuring a Helius client. ```APIDOC ## HeliusBuilder::new() ### Description Creates a new builder with default settings. ### Returns `HeliusBuilder` — A new builder instance ready for configuration. ### Example ```rust use helius::HeliusBuilder; let builder = HeliusBuilder::new(); ``` ``` -------------------------------- ### Get All Webhooks in Rust Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/webhooks.md Fetches all webhook configurations for the authenticated account. Note that the response is limited to 100 addresses per webhook. ```rust use helius::Helius; use helius::types::Cluster; #[tokio::main] async fn main() -> helius::error::Result<()> { let helius = Helius::new("your_api_key", Cluster::MainnetBeta)?; let webhooks = helius.get_all_webhooks().await?; println!("Total webhooks: {}", webhooks.len()); for webhook in webhooks { println!( "Webhook {} -> {} ({} addresses)", webhook.webhook_id, webhook.webhook_url, webhook.account_addresses.len() ); } Ok(()) } ``` -------------------------------- ### Create New HeliusBuilder Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/builder.md Initializes a new HeliusBuilder with default settings. Use this as the starting point for configuring your Helius client. ```rust use helius::HeliusBuilder; let builder = HeliusBuilder::new(); ``` -------------------------------- ### ZK Compression - Get Compressed Account Proof Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Generate a Merkle proof for a ZK compressed account, used for on-chain verification. ```APIDOC ## Get Compressed Account Proof ### Description Generate a Merkle proof for a ZK compressed account. ### Method `helius.get_compressed_account_proof(request).await` ### Parameters - `request`: `GetCompressedAccountProofRequest` - Request object specifying the account hash for which to generate the proof. ``` -------------------------------- ### ZK Compression - Get Validity Proof Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Obtain a validity proof for ZK compressed accounts, essential for building transactions involving these accounts. ```APIDOC ## Get Validity Proof ### Description Generate a validity proof for ZK compressed accounts, used in transaction construction. ### Method `helius.get_validity_proof(GetValidityProofRequest { hashes: Some(vec!["hash1".to_string()]), ..Default::default() }).await` ### Parameters - `request`: `GetValidityProofRequest` - Request object containing the hashes of the accounts for which to generate proofs. ``` -------------------------------- ### Asynchronous Solana RPC Usage Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/client.md Demonstrates asynchronous calls to get the latest blockhash and account balance using the Helius async client. ```rust let async_client = helius.async_connection()?; let blockhash = async_client.get_latest_blockhash().await?; let balance = async_client.get_balance(&pubkey).await?; ``` -------------------------------- ### Get Merkle Proof for Compressed Account Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Generate a Merkle proof for a ZK compressed account, necessary for on-chain verification. Requires a request object. ```rust use helius::types::{GetCompressedAccountRequest, GetCompressedTokenBalancesByOwnerRequest}; let proof = helius.get_compressed_account_proof(request).await?; ``` -------------------------------- ### Get Client Configuration Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/client.md Access the client configuration, which includes API key, cluster, and endpoint settings. Returns a cloned reference-counted configuration object. ```rust let config = helius.config(); println!("Cluster: {:?}", config.cluster); ``` -------------------------------- ### Initialize Tokio Async Runtime Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/README.md Shows the required `#[tokio::main]` macro to initialize the Tokio async runtime for the SDK. ```rust #[tokio::main] async fn main() { // Tokio runtime initialized } ``` -------------------------------- ### Get Transactions for Address Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/rpc-client.md Retrieves transaction history for a specific wallet address with advanced filtering and sorting options. Use this to get a comprehensive list of all transactions associated with an address. ```rust use helius::types::GetTransactionsForAddressOptions; let options = GetTransactionsForAddressOptions { before: None, until: None, limit: Some(10), commitment: None, search_direction: None, include_token_transfers: Some(true), show_zero_lamport_changes: None, }; let response = helius.rpc().get_transactions_for_address( "wallet_address".to_string(), options, ).await?; ``` -------------------------------- ### Get Balance using Embedded Solana Client (Sync) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Retrieve the balance of a Solana account using the synchronous embedded Solana client. Requires a public key. ```rust let balance = helius.connection().get_balance(&pubkey)?; ``` -------------------------------- ### Basic Helius SDK Usage in Rust Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Demonstrates basic usage of the Helius Rust SDK, including initializing the client and fetching an NFT asset by its mint address. Requires an API key and specifies the cluster. ```rust use helius::error::Result; use helius::types::{Cluster, GetAsset}; use helius::Helius; #[tokio::main] async fn main() -> Result<()> { let helius = Helius::new("your-api-key", Cluster::MainnetBeta)?; // Get an NFT by its mint address let request = GetAsset { id: "F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk".to_string(), display_options: None, }; let asset = helius.rpc().get_asset(request).await?; println!("Asset: {:?}", asset); Ok(()) } ``` -------------------------------- ### get_compute_units Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Simulates a transaction to get the total compute units consumed. ```APIDOC ## get_compute_units ### Description Simulates a transaction to get the total compute units consumed. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response (Not specified in source) ``` -------------------------------- ### Initialize Full-Featured Async Helius Client Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Recommended for production, this constructor establishes a WebSocket connection for async Solana RPC and Enhanced WebSocket streaming. It requires `.await` due to the connection setup. ```rust let helius = Helius::new_async("your-api-key", Cluster::MainnetBeta).await?; ``` -------------------------------- ### RPC V2 Methods Quick Reference Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Reference for various RPC V2 methods. Note that some methods have auto-paginating variants. ```rust helius.rpc().get_transactions_for_address(address, options) // Transaction history (pagination_token) ``` ```rust helius.rpc().get_program_accounts_v2(program_id, config) // Program accounts (pagination_key) ``` ```rust helius.rpc().get_all_program_accounts(program_id, config) // Auto-paginating variant ``` ```rust helius.rpc().get_token_accounts_by_owner_v2(owner, filter, config) // Token accounts v2 (pagination_key) ``` ```rust helius.rpc().get_all_token_accounts_by_owner(owner, filter, config) // Auto-paginating variant ``` ```rust helius.rpc().get_priority_fee_estimate(request) // Fee estimates ``` -------------------------------- ### Get Stake Accounts Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Retrieves all stake accounts associated with a given wallet address. ```APIDOC ## get_stake_accounts ### Description Fetches all stake accounts belonging to a specific wallet. ### Method Signature `helius.get_stake_accounts(owner_pubkey: Pubkey) -> Result>` ### Parameters - **owner_pubkey** (Pubkey) - The public key of the wallet to query for stake accounts. ### Returns - `Result>` - A vector containing details of all found stake accounts. ``` -------------------------------- ### Paginate Program Accounts (RPC V2) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Shows how to retrieve all accounts for a program using `get_program_accounts_v2` with cursor-based pagination. Uses `pagination_key` to fetch accounts in chunks. ```rust let mut pagination_key: Option = None; loop { let result = helius.rpc().get_program_accounts_v2( program_id.to_string(), GetProgramAccountsV2Config { limit: Some(1000), pagination_key: pagination_key.clone(), ..Default::default() }, ).await?; // process result.accounts pagination_key = result.pagination_key; if pagination_key.is_none() { break; } } ``` -------------------------------- ### Get Webhook by ID Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/webhooks.md Retrieves the configuration of a specific webhook using its unique identifier. ```APIDOC ## get_webhook_by_id() ### Description Retrieves the configuration of a webhook by its ID. ### Method Signature `pub async fn get_webhook_by_id(&self, webhook_id: &str) -> Result` ### Parameters #### Path Parameters - **webhook_id** (`&str`) - Required - ID of the webhook to retrieve ### Returns - `Result` - The webhook object. ### Errors - `Unauthorized` - API key is missing - `NotFound` - Webhook with ID not found - Network errors from API request ### Example ```rust use helius::Helius; use helius::types::Cluster; #[tokio::main] async fn main() -> helius::error::Result<()> { let helius = Helius::new("your_api_key", Cluster::MainnetBeta)?; let webhook = helius.get_webhook_by_id("webhook-id").await?; println!("Webhook URL: {}", webhook.webhook_url); println!("Addresses: {:?}", webhook.account_addresses); Ok(()) } ``` ``` -------------------------------- ### ZK Compression - Get Indexer Health Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Check the health status of the Helius indexer service. ```APIDOC ## Get Indexer Health ### Description Check the operational status of the Helius indexer. ### Method `helius.get_indexer_health().await` ``` -------------------------------- ### Wallet API Examples Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Functions for retrieving wallet identity, balances, transaction history, and transfer history. Supports batch requests for wallet identity and filtering for token balances and transaction history. ```rust helius.get_wallet_identity(wallet) // Identity info helius.get_batch_wallet_identity(&addresses) // Batch identity (max 100) helius.get_wallet_balances(wallet, page, limit, zero_bal, native, nfts) // Token balances helius.get_wallet_history(wallet, limit, before, after, tx_type, token_accts) // Transaction history helius.get_wallet_transfers(wallet, limit, cursor) // Transfer history helius.get_wallet_funding_source(wallet) // Funding source ``` -------------------------------- ### Get Stake Accounts Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Use this snippet to retrieve all stake accounts associated with a given wallet address. ```rust // Get all stake accounts for a wallet let stake_accounts = helius.get_stake_accounts(owner_pubkey).await?; ``` -------------------------------- ### Helius SDK Full-Featured Client Configuration Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/README.md Demonstrates building a comprehensive Helius client with API key, cluster selection, asynchronous Solana connection, and WebSocket support. ```rust let helius = HeliusBuilder::new() .with_api_key("key")? .with_cluster(Cluster::MainnetBeta) .with_async_solana() .with_websocket(None, None) .build() .await?; let async_client = helius.async_connection()?; let ws = helius.ws().expect("WebSocket available"); ``` -------------------------------- ### ZK Compression - Get Compressed Account Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Retrieve details of a ZK compressed account using its hash. ```APIDOC ## Get Compressed Account ### Description Fetch a ZK compressed account by its hash. ### Method `helius.get_compressed_account(GetCompressedAccountRequest { hash: Some("account_hash".to_string()), ..Default::default() }).await` ### Parameters - `request`: `GetCompressedAccountRequest` - Request object containing the account hash. ``` -------------------------------- ### Config::create_client() Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/configuration.md Creates a basic Helius client with synchronous RPC capabilities. ```APIDOC ## Config::create_client() ### Description Creates a basic Helius client from configuration, offering synchronous RPC access. ### Method ```rust pub fn create_client(self) -> Result ``` ### Returns `Result` — Basic Helius client with RPC capabilities. ### Features - Synchronous RPC access - No async client - No WebSocket ### Example ```rust use helius::config::Config; use helius::types::Cluster; let config = Config::new("your_api_key", Cluster::MainnetBeta)?; let helius = config.create_client()?; ``` ``` -------------------------------- ### get_asset_batch Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Gets multiple assets by their IDs. This method is efficient for retrieving details of several assets simultaneously. ```APIDOC ## get_asset_batch ### Description Gets multiple assets by their ID. ### Method POST ### Endpoint /v1/get_asset_batch ### Parameters #### Request Body - **ids** (array[string]) - Required - An array of unique asset identifiers. ### Response #### Success Response (200) - **assets** (array[object]) - An array containing the details of the requested assets. ``` -------------------------------- ### Create Basic Helius Client (Sync) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/client.md Use `Helius::new()` to create a synchronous client for standard RPC operations. Requires an API key and a Solana cluster. ```rust use helius::Helius; use helius::types::Cluster; let helius = Helius::new("your_api_key", Cluster::MainnetBeta)?; ``` -------------------------------- ### Fetch All Program Accounts (Auto-Paginating) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Utilizes the `get_all_program_accounts` convenience method for automatically handling pagination when fetching all accounts for a program. ```rust let all_accounts = helius.rpc().get_all_program_accounts( program_id.to_string(), GetProgramAccountsV2Config::default(), ).await?; ``` -------------------------------- ### get_signatures_for_asset Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/rpc-client.md Gets transaction signatures for a given asset. This is useful for tracking the transaction history of a specific asset. ```APIDOC ## get_signatures_for_asset() ### Description Gets transaction signatures for a given asset. ### Method `pub async fn get_signatures_for_asset(&self, request: GetAssetSignatures) -> Result` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **request** (`GetAssetSignatures`) - Required - Request with asset ID and optional pagination ### Request Example ```rust use helius::types::GetAssetSignatures; let request = GetAssetSignatures { id: "F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk".to_string(), page: Some(1), limit: Some(100), }; let signatures = helius.rpc().get_signatures_for_asset(request).await?; ``` ### Response #### Success Response (200) - `Result` — List of transaction signatures for the asset. #### Response Example (Response structure depends on `TransactionSignatureList` definition) ``` -------------------------------- ### Default TLS Configuration Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Use this configuration for the default native TLS (OpenSSL) setup with the Helius SDK. ```toml # Default: native TLS (OpenSSL) [dependencies] helius = "1.1" ``` -------------------------------- ### Fetch All Program Accounts (RPC V2) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Use the auto-paginating methods provided by the SDK to fetch all program accounts, simplifying cursor-based pagination for RPC V2. ```rust // Cursor-based (RPC V2) - use auto-paginating methods let all_accounts = helius.rpc().get_all_program_accounts(program_id, config).await?; ``` -------------------------------- ### Get Compressed Account by Hash Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Retrieve a ZK compressed account using its hash. Requires the `GetCompressedAccountRequest` struct. ```rust use helius::types::{GetCompressedAccountRequest, GetCompressedTokenBalancesByOwnerRequest}; let account = helius.get_compressed_account(GetCompressedAccountRequest { hash: Some("account_hash".to_string()), ..Default::default() }).await?; ``` -------------------------------- ### Paginate Transaction History Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Demonstrates how to paginate through transaction history using a pagination token. Fetch the first page, then use its token to request the subsequent page. ```rust // Pagination let page1 = helius.rpc().get_transactions_for_address(address.clone(), options).await?; if let Some(token) = page1.pagination_token { let page2_options = GetTransactionsForAddressOptions { pagination_token: Some(token), ..Default::default() }; let page2 = helius.rpc().get_transactions_for_address(address, page2_options).await?; } ``` -------------------------------- ### get_nft_edition Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Gets all the NFT editions associated with a specific master NFT. Useful for exploring variations of a generative NFT. ```APIDOC ## get_nft_edition ### Description Gets all the NFT editions associated with a specific master NFT. ### Method GET ### Endpoint /v1/get_nft_edition ### Parameters #### Query Parameters - **masterEditionMintAddress** (string) - Required - The mint address of the master NFT. ### Response #### Success Response (200) - **editions** (array[object]) - An array of NFT edition objects associated with the master NFT. ``` -------------------------------- ### Smart Transactions API Quick Reference Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Methods for sending and managing smart transactions. Be aware that ComputeBudget instructions are added automatically and sender tips are mandatory. ```rust helius.send_smart_transaction(config) // Auto-optimized send ``` ```rust helius.create_smart_transaction(config) // Build without sending ``` ```rust helius.create_smart_transaction_with_seeds(config) // Thread-safe (seed-based) ``` ```rust helius.send_smart_transaction_with_seeds(config, send_opts, timeout) // Thread-safe send ``` ```rust helius.create_smart_transaction_without_signers(config) // Unsigned transaction ``` ```rust helius.get_compute_units(instructions, payer, lookup_tables, signers) // Simulate CU usage ``` ```rust helius.poll_transaction_confirmation(signature) // Poll confirmation status ``` ```rust helius.send_and_confirm_transaction(tx, config, last_block, timeout) // Send + confirm loop ``` -------------------------------- ### get_assets_by_creator Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Gets a list of assets of a given creator. This method helps in discovering all NFTs minted by a particular creator. ```APIDOC ## get_assets_by_creator ### Description Gets a list of assets of a given creator. ### Method GET ### Endpoint /v1/get_assets_by_creator ### Parameters #### Query Parameters - **creatorAddress** (string) - Required - The Solana address of the creator. - **limit** (integer) - Optional - The maximum number of assets to return. - **before** (string) - Optional - The ID of the asset to paginate before. - **after** (string) - Optional - The ID of the asset to paginate after. ### Response #### Success Response (200) - **result** (array[object]) - An array of asset objects created by the specified creator. ``` -------------------------------- ### Config::create_full_client() Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/configuration.md Creates a fully-featured Helius client with both async and WebSocket support. ```APIDOC ## Config::create_full_client() ### Description Creates a fully-featured Helius client with async and WebSocket support. ### Method ```rust pub async fn create_full_client( self, ping_interval_secs: Option, pong_timeout_secs: Option, ) -> Result ``` ### Parameters #### Path Parameters (No path parameters) #### Query Parameters (No query parameters) #### Request Body (No request body) #### Optional Parameters - **ping_interval_secs** (`Option`) - Optional - Seconds between ping messages. Defaults to 10. - **pong_timeout_secs** (`Option`) - Optional - Seconds to wait for pong before disconnect. Defaults to 30. ### Returns `Result` — Fully-featured Helius client. ### Features - Synchronous RPC access - Async Solana RPC client - Enhanced WebSocket for streaming ### Requires API key (for WebSocket connection) ### Example ```rust let config = Config::new("your_api_key", Cluster::MainnetBeta)?; let helius = config.create_full_client(None, None).await?; let async_client = helius.async_connection()?; let ws = helius.ws().expect("WebSocket available"); ``` ``` -------------------------------- ### get_assets_by_authority Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Gets a list of assets of a given authority. Useful for finding all assets associated with a specific creator or minter. ```APIDOC ## get_assets_by_authority ### Description Gets a list of assets of a given authority. ### Method GET ### Endpoint /v1/get_assets_by_authority ### Parameters #### Query Parameters - **authorityAddress** (string) - Required - The Solana address of the authority. - **limit** (integer) - Optional - The maximum number of assets to return. - **before** (string) - Optional - The ID of the asset to paginate before. - **after** (string) - Optional - The ID of the asset to paginate after. ### Response #### Success Response (200) - **result** (array[object]) - An array of asset objects associated with the specified authority. ``` -------------------------------- ### Paginate Transactions for Address (RPC V2) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Demonstrates how to fetch all transactions for a given address using `get_transactions_for_address` with cursor-based pagination. Handles `pagination_token` to retrieve results in batches. ```rust let mut pagination_token: Option = None; let mut all_txs = Vec::new(); loop { let result = helius.rpc().get_transactions_for_address( "address".to_string(), GetTransactionsForAddressOptions { limit: Some(100), pagination_token: pagination_token.clone(), ..Default::default() }, ).await?; all_txs.extend(result.data); pagination_token = result.pagination_token; if pagination_token.is_none() { break; } } ``` -------------------------------- ### ZK Compression - Get Compressed Token Accounts by Delegate Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Retrieve compressed token accounts delegated to a specific address. ```APIDOC ## Get Compressed Token Accounts by Delegate ### Description List compressed token accounts delegated to a specific address. ### Method `helius.get_compressed_token_accounts_by_delegate(request).await` ### Parameters - `request`: `GetCompressedTokenAccountsByDelegateRequest` - Request object specifying the delegate's address. ``` -------------------------------- ### Initialize RpcClient Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/rpc-client.md Use this method to create a new RpcClient instance with a shared HTTP client and configuration. Typically constructed internally by Helius or HeliusBuilder. ```rust use helius::rpc_client::RpcClient; use std::sync::Arc; let rpc = RpcClient::new(Arc::new(http_client), Arc::new(config))?; ``` -------------------------------- ### ZK Compression - Get Compressed Token Balances by Owner Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Retrieve compressed token balances for a given wallet address. ```APIDOC ## Get Compressed Token Balances by Owner ### Description Get a list of compressed token balances owned by a specific wallet address. ### Method `helius.get_compressed_token_balances_by_owner(GetCompressedTokenBalancesByOwnerRequest { owner: "wallet_address".to_string(), ..Default::default() }).await` ### Parameters - `request`: `GetCompressedTokenBalancesByOwnerRequest` - Request object specifying the owner's wallet address. ``` -------------------------------- ### Get All Program Accounts (Rust) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/rpc-client.md Fetches all program accounts by auto-paginating through results. The method ignores `pagination_key` and defaults `limit` to 10000 if not specified. Use with caution for programs with many accounts as it fetches all accounts. ```rust pub async fn get_all_program_accounts( &self, program_id: String, mut config: GetProgramAccountsV2Config, ) -> Result> ``` ```rust use helius::types::GetProgramAccountsV2Config; let config = GetProgramAccountsV2Config { encoding: Some(Encoding::Base64), // ... other config limit: None, // Defaults to 10000 pagination_key: None, // Ignored ..Default::default() }; let all_accounts = helius.rpc().get_all_program_accounts( "TokenkegQfeZyiNwAJsyFbPVwwQQfKTVqPiPpMqLbQ".to_string(), config, ).await?; ``` -------------------------------- ### get_assets_by_owner Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Gets a list of assets owned by a given address. This method is useful for displaying a user's NFT collection. ```APIDOC ## get_assets_by_owner ### Description Gets a list of assets owned by a given address. ### Method GET ### Endpoint /v1/get_assets_by_owner ### Parameters #### Query Parameters - **ownerAddress** (string) - Required - The Solana address of the owner. - **limit** (integer) - Optional - The maximum number of assets to return. - **before** (string) - Optional - The ID of the asset to paginate before. - **after** (string) - Optional - The ID of the asset to paginate after. ### Response #### Success Response (200) - **result** (array[object]) - An array of asset objects owned by the specified address. ``` -------------------------------- ### get_asset Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Gets an asset by its ID. This method allows retrieval of a single asset's details using its unique identifier. ```APIDOC ## get_asset ### Description Gets an asset by its ID. ### Method GET ### Endpoint /v1/get_asset ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier of the asset. ### Response #### Success Response (200) - **asset** (object) - Contains the details of the requested asset. ``` -------------------------------- ### Config::create_client_with_async() Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/configuration.md Creates a Helius client with asynchronous Solana RPC capabilities. ```APIDOC ## Config::create_client_with_async() ### Description Creates a Helius client with asynchronous Solana RPC capabilities. ### Method ```rust pub fn create_client_with_async(self) -> Result ``` ### Returns `Result` — Helius client with async RPC support. ### Features - Synchronous RPC access - Async Solana RPC client - No WebSocket ### Example ```rust let config = Config::new("your_api_key", Cluster::MainnetBeta)?; let helius = config.create_client_with_async()?; let async_client = helius.async_connection()?; ``` ``` -------------------------------- ### Query Program Accounts with Pagination (Rust) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Use `get_program_accounts_v2` for efficient querying of program accounts with cursor-based pagination. Supports filters and incremental updates via `changed_since_slot`. Optimal limits are 1,000-5,000 accounts per request. ```rust use helius::types::{GetProgramAccountsV2Config, Encoding, GpaFilter}; // Basic pagination let response = helius.rpc().get_program_accounts_v2( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA".to_string(), GetProgramAccountsV2Config { encoding: Some(Encoding::Base64), limit: Some(5000), filters: Some(vec![GpaFilter::DataSize { data_size: 165 }]), ..Default::default() }, ).await?; ``` ```rust // Continue pagination with cursor let next_page = helius.rpc().get_program_accounts_v2( program_id.clone(), GetProgramAccountsV2Config { pagination_key: response.pagination_key, // Use cursor from previous response limit: Some(5000), ..Default::default() }, ).await?; ``` ```rust // Incremental updates: Get only accounts modified since a specific slot let updates = helius.rpc().get_program_accounts_v2( program_id, GetProgramAccountsV2Config { changed_since_slot: Some(150000000), // Only accounts modified at/after this slot limit: Some(1000), ..Default::default() }, ).await?; ``` ```rust // Auto-paginate through ALL accounts (handles pagination automatically) let all_accounts = helius.rpc().get_all_program_accounts( program_id, GetProgramAccountsV2Config { limit: Some(5000), // Defaults to 10,000 if not specified ..Default::default() }, ).await?; ``` -------------------------------- ### Get NFT Editions Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/rpc-client.md Fetches all NFT editions for a given master NFT address. Supports pagination with limit and cursor. ```rust use helius::types::GetNftEditions; let request = GetNftEditions { master_edition_address: "F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk".to_string(), page: 1, limit: Some(100), cursor: None, }; let editions = helius.rpc().get_nft_editions(request).await?; ``` -------------------------------- ### Initialize Basic Helius Client (Synchronous) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/README.md Use this constructor for basic synchronous RPC operations. Requires an API key and a Solana cluster. ```rust use helius::Helius; use helius::error::Result; use helius::types::{Cluster, GetAssetRequest, GetAssetResponseForAsset}; #[tokio::main] async fn main() -> Result<()> { let helius = Helius::new("YOUR_API_KEY", Cluster::MainnetBeta)?; let request = GetAssetRequest { id: "F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk".to_string(), display_options: None, }; let response: Result> = helius.rpc().get_asset(request).await; match response { Ok(Some(asset)) => println!("Asset: {:?}", asset), Ok(None) => println!("No asset found."), Err(e) => println!("Error retrieving asset: {:?}", e), } Ok(()) } ``` -------------------------------- ### get_assets_by_creator Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/rpc-client.md Gets a list of assets created by a given address. This function allows you to retrieve all assets originating from a specific creator. ```APIDOC ## get_assets_by_creator() ### Description Gets a list of assets created by a given address. ### Method `pub async fn get_assets_by_creator(&self, request: GetAssetsByCreator) -> Result` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **request** (`GetAssetsByCreator`) - Required - Request with creator address, verification flag, and pagination ### Request Example ```rust use helius::types::GetAssetsByCreator; let request = GetAssetsByCreator { creator_address: "8fqKZ2CzTMCvSWWRYG6w2mZYzS62D2eXpxpv8BwKPwrV".to_string(), only_verified: Some(true), page: 1, limit: Some(100), cursor: None, display_options: None, sort_by: None, before: None, after: None, }; let assets = helius.rpc().get_assets_by_creator(request).await?; ``` ### Response #### Success Response (200) - `Result` — Paginated list of assets created by the address. #### Response Example (Response structure depends on `AssetList` definition) ``` -------------------------------- ### Get Synchronous Solana Connection Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/client.md Access the synchronous embedded Solana RPC client. Returns a cloned reference-counted client. ```rust let client = helius.connection(); let balance = client.get_balance(&pubkey?); ``` -------------------------------- ### Initialize RpcClient with Commitment Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/rpc-client.md Initializes a new RpcClient instance with a specific commitment level for the embedded Solana client. This allows for fine-grained control over transaction confirmation guarantees. ```rust use helius::rpc_client::RpcClient; use solana_commitment_config::CommitmentConfig; use std::sync::Arc; let rpc = RpcClient::new_with_commitment( Arc::new(http_client), Arc::new(config), CommitmentConfig::confirmed(), ?; ``` -------------------------------- ### Get Thread-Safe RPC Client Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/client.md Access the embedded `RpcClient` for thread-safe RPC operations. This returns a cloned reference-counted client. ```rust let rpc = helius.rpc(); let asset = rpc.get_asset(request).await?; ``` -------------------------------- ### Handle ClientNotInitialized Error Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/errors.md Use this to manage cases where a required client (async or WebSocket) was not initialized before use. Ensure clients are created with `new_async()` or `with_async_solana()` and `with_websocket()`. ```rust match helius.async_connection() { Ok(async_client) => { /* use client */ } Err(HeliusError::ClientNotInitialized { text }) => { eprintln!("Client not available: {}", text); // Create client with HeliusBuilder::with_async_solana() } _ => {} } ``` -------------------------------- ### Create Webhook Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/_autodocs/api-reference/webhooks.md Use this function to create a new webhook. Specify the URL, account addresses to monitor, and the type of webhook. Optional parameters allow filtering by transaction types, setting an authorization header, filtering by transaction status, and specifying encoding. ```rust use helius::Helius; use helius::types::{Cluster, CreateWebhookRequest}; #[tokio::main] async fn main() -> helius::error::Result<()> { let helius = Helius::new("your_api_key", Cluster::MainnetBeta)?; let request = CreateWebhookRequest { webhook_url: "https://example.com/webhook".to_string(), account_addresses: vec![ "GQUtvPx89ZNCwmvQqFmH59bJcU8fW8siETpaxod7Aydz".to_string(), ], webhook_type: "enhancedWebhook".to_string(), transaction_types: Some(vec!["SWAP".to_string()]), auth_header: None, txn_status: Some("all".to_string()), encoding: Some("base64".to_string()), }; let webhook = helius.create_webhook(request).await?; println!("Created webhook: {}", webhook.webhook_id); Ok(()) } ``` -------------------------------- ### Cursor-Based Pagination (RPC V2 Methods) Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Demonstrates how to fetch transactions for an address or program accounts using cursor-based pagination. This pattern involves repeatedly calling an RPC method, using the `pagination_token` or `pagination_key` from the previous response in the next request, until no token is returned. ```APIDOC ## get_transactions_for_address with pagination_token ### Description Fetches transactions for a given address, supporting pagination to retrieve results in batches. ### Method `helius.rpc().get_transactions_for_address` ### Parameters #### Path Parameters None #### Query Parameters - **address** (string) - Required - The address to fetch transactions for. - **options** (GetTransactionsForAddressOptions) - Optional - Configuration for the query, including `limit` and `pagination_token`. - **limit** (Option) - Optional - The maximum number of transactions to return per page. - **pagination_token** (Option) - Optional - The token for the next page of results. ### Request Example ```rust let mut pagination_token: Option = None; let mut all_txs = Vec::new(); loop { let result = helius.rpc().get_transactions_for_address( "address".to_string(), GetTransactionsForAddressOptions { limit: Some(100), pagination_token: pagination_token.clone(), ..Default::default() }, ).await?; all_txs.extend(result.data); pagination_token = result.pagination_token; if pagination_token.is_none() { break; } } ``` ### Response #### Success Response (200) - **data** (Vec) - A list of transactions. - **pagination_token** (Option) - Token for the next page of results, or None if this is the last page. ## get_program_accounts_v2 with pagination_key ### Description Fetches accounts for a given program, supporting pagination using a `pagination_key`. ### Method `helius.rpc().get_program_accounts_v2` ### Parameters #### Path Parameters None #### Query Parameters - **program_id** (string) - Required - The program ID to fetch accounts for. - **config** (GetProgramAccountsV2Config) - Optional - Configuration for the query, including `limit` and `pagination_key`. - **limit** (Option) - Optional - The maximum number of accounts to return per page. - **pagination_key** (Option) - Optional - The key for the next page of results. ### Request Example ```rust let mut pagination_key: Option = None; loop { let result = helius.rpc().get_program_accounts_v2( program_id.to_string(), GetProgramAccountsV2Config { limit: Some(1000), pagination_key: pagination_key.clone(), ..Default::default() }, ).await?; // process result.accounts pagination_key = result.pagination_key; if pagination_key.is_none() { break; } } ``` ### Response #### Success Response (200) - **accounts** (Vec) - A list of accounts. - **pagination_key** (Option) - Key for the next page of results, or None if this is the last page. ## get_all_program_accounts (Auto-Paginating) ### Description Fetches all accounts for a given program using an auto-paginating variant, simplifying the process by handling pagination internally. ### Method `helius.rpc().get_all_program_accounts` ### Parameters #### Path Parameters None #### Query Parameters - **program_id** (string) - Required - The program ID to fetch accounts for. - **config** (GetProgramAccountsV2Config) - Optional - Configuration for the query, such as `limit`. ### Request Example ```rust let all_accounts = helius.rpc().get_all_program_accounts( program_id.to_string(), GetProgramAccountsV2Config::default(), ).await?; ``` ### Response #### Success Response (200) - **accounts** (Vec) - A list of all accounts for the program. ``` -------------------------------- ### Create and Delegate Stake Account Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Use this snippet to create a new stake account and delegate it to a validator. It returns an unsigned transaction and the public key of the newly created stake account. ```rust use solana_sdk::pubkey::Pubkey; // Create and delegate a stake account (returns unsigned tx + stake account pubkey) let (unsigned_tx, stake_pubkey) = helius.create_stake_transaction(owner_pubkey, 1.0).await?; ``` -------------------------------- ### Initialize Basic Sync Helius Client Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Use the simplest constructor for a synchronous Helius client. This client provides RPC, webhooks, Enhanced Transactions, smart transactions, and Wallet API access without async Solana client or WebSocket support. ```rust let helius = Helius::new("your-api-key", Cluster::MainnetBeta)?; ``` -------------------------------- ### Get Compressed Token Balances by Owner Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Fetch compressed token balances for a given wallet address. Uses the `GetCompressedTokenBalancesByOwnerRequest` struct. ```rust use helius::types::{GetCompressedAccountRequest, GetCompressedTokenBalancesByOwnerRequest}; let balances = helius.get_compressed_token_balances_by_owner( GetCompressedTokenBalancesByOwnerRequest { owner: "wallet_address".to_string(), ..Default::default() }, ).await?; ``` -------------------------------- ### Helius::new Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/AGENTS.md Simplest constructor. Synchronous — no `.await` needed. Provides RPC methods, webhooks, Enhanced Transactions, smart transactions, and Wallet API. No async Solana client or WebSocket support. ```APIDOC ## Helius::new ### Description Simplest constructor. Synchronous — no `.await` needed. Provides RPC methods, webhooks, Enhanced Transactions, smart transactions, and Wallet API. No async Solana client or WebSocket support. ### Method ```rust let helius = Helius::new("your-api-key", Cluster::MainnetBeta)?; ``` ``` -------------------------------- ### Get Wallet Token Transfer Activity Source: https://github.com/helius-labs/helius-rust-sdk/blob/dev/llms.txt Fetch a wallet's token transfer activity, with support for limiting the number of results. ```rust let transfers = helius.get_wallet_transfers("wallet_address", Some(50), None).await?; ```