### Example Usage Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetTransactionWithCompressionInfoRequest.html An example demonstrating how to create an instance of GetTransactionWithCompressionInfoRequest with a transaction signature. ```APIDOC ## Example ```rust use helius::types::GetTransactionWithCompressionInfoRequest; let request = GetTransactionWithCompressionInfoRequest { signature: "5J8H5sTvEhnGcB4R8K1n7mfoiWUD9RzPVGES7e3WxC7c".to_string(), }; ``` ``` -------------------------------- ### Example Usage Source: https://docs.rs/helius/latest/helius/types/options/struct.SearchAssetsOptions.html Demonstrates how to instantiate and configure SearchAssetsOptions. ```APIDOC ## Example ```rust use helius::types::SearchAssetsOptions; let options = SearchAssetsOptions { show_collection_metadata: true, show_grand_total: false, // Skip for faster response show_native_balance: true, ..Default::default() }; ``` ``` -------------------------------- ### Example Usage of GetCompressedTokenAccountsByOwnerRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressedTokenAccountsByOwnerRequest.html Demonstrates how to create a GetCompressedTokenAccountsByOwnerRequest. This example initializes the request with an owner address and uses default values for other optional fields. ```rust use helius::types::GetCompressedTokenAccountsByOwnerRequest; let request = GetCompressedTokenAccountsByOwnerRequest { owner: "11111116EPqoQskEM2Pddp8KTL9JdYEBZMGF3aq7V".to_string(), ..Default::default() }; ``` -------------------------------- ### Creating a GetTransactionWithCompressionInfoRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetTransactionWithCompressionInfoRequest.html Example of how to instantiate `GetTransactionWithCompressionInfoRequest` with a transaction signature. ```rust use helius::types::GetTransactionWithCompressionInfoRequest; let request = GetTransactionWithCompressionInfoRequest { signature: "5J8H5sTvEhnGcB4R8K1n7mfoiWUD9RzPVGES7e3WxC7c".to_string(), }; ``` -------------------------------- ### SignatureFilter Usage Examples Source: https://docs.rs/helius/latest/helius/types/inner/struct.SignatureFilter.html Examples demonstrating how to create and use SignatureFilter for different transaction retrieval scenarios. ```APIDOC ## SignatureFilter Filter transactions by signature range. Used with `getTransactionsForAddress` to retrieve transactions before or after a specific transaction signature. Signatures are compared lexicographically (alphabetically as base58 strings). Useful for implementing cursor-based pagination when combined with `paginationToken`, or for fetching transactions relative to a known transaction. ### Examples ```rust // Get transactions after a specific signature let filter = SignatureFilter { gt: Some("5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXF...".to_string()), ..Default::default() }; // Get transactions in a signature range let filter = SignatureFilter { gte: Some("3jweEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXF...".to_string()), lt: Some("6k7xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXF...".to_string()), ..Default::default() }; ``` ### Fields * `gte`: Greater than or equal to signature (inclusive, lexicographic order) * `gt`: Greater than signature (exclusive, lexicographic order) * `lte`: Less than or equal to signature (inclusive, lexicographic order) * `lt`: Less than signature (exclusive, lexicographic order) ### Note Signatures are base58-encoded strings and are compared lexicographically. This means “3…” comes before “5…” which comes before “6…”. ### Struct Definition ```rust pub struct SignatureFilter { pub gte: Option, pub gt: Option, pub lte: Option, pub lt: Option, } ``` ``` -------------------------------- ### Instantiate GetCompressedAccountProofRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressedAccountProofRequest.html Example of how to create an instance of GetCompressedAccountProofRequest with a specific account hash. ```rust use helius::types::GetCompressedAccountProofRequest; let request = GetCompressedAccountProofRequest { hash: "11111112cMQwSC9qirWGjZM6gLGwW69X22mqwLLGP".to_string(), }; ``` -------------------------------- ### Creating a GetCompressedBalanceByOwnerRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressedBalanceByOwnerRequest.html Example of how to instantiate `GetCompressedBalanceByOwnerRequest` with a specific owner's public key. ```rust use helius::types::GetCompressedBalanceByOwnerRequest; let request = GetCompressedBalanceByOwnerRequest { owner: "11111113R2cuenjG5nFubqX9Wzuukdin2YfGQVzu5".to_string(), }; ``` -------------------------------- ### Create GetCompressionSignaturesForAccountRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressionSignaturesForAccountRequest.html Example of how to instantiate the `GetCompressionSignaturesForAccountRequest` struct with a given account hash. ```rust use helius::types::GetCompressionSignaturesForAccountRequest; let request = GetCompressionSignaturesForAccountRequest { hash: "11111112cMQwSC9qirWGjZM6gLGwW69X22mqwLLGP".to_string(), }; ``` -------------------------------- ### Get Solana Version Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Returns the current Solana version running on the node. Includes an example of parsing and comparing the version. ```rust let expected_version = semver::Version::new(1, 7, 0); let version = rpc_client.get_version().await?; let version = semver::Version::parse(&version.solana_core)?; assert!(version >= expected_version); ``` -------------------------------- ### Page-based Pagination Example Source: https://docs.rs/helius/latest/helius/types/inner/struct.AssetList.html Demonstrates how to use page-based pagination with the GetAssetsByOwner query, specifying a page number and limit. ```rust let options = GetAssetsByOwner { page: 2, limit: Some(50), ..Default::default() }; ``` -------------------------------- ### Instantiate GetCompressionSignaturesForOwnerRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressionSignaturesForOwnerRequest.html Example of creating a `GetCompressionSignaturesForOwnerRequest` with a specific owner and default values for cursor and limit. ```rust use helius::types::GetCompressionSignaturesForOwnerRequest; let request = GetCompressionSignaturesForOwnerRequest { owner: "11111119T6fgHG3unjQB6vpWozhBdiXDbQovvFVeF".to_string(), ..Default::default() }; ``` -------------------------------- ### Cursor-based Pagination Example Source: https://docs.rs/helius/latest/helius/types/inner/struct.AssetList.html Illustrates cursor-based pagination for fetching subsequent pages of assets, using the cursor from a previous response. ```rust let options = GetAssetsByOwner { after: Some(previous_response.cursor.unwrap()), ..Default::default() }; ``` -------------------------------- ### Creating a GetCompressedMintTokenHoldersRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressedMintTokenHoldersRequest.html Example of how to instantiate GetCompressedMintTokenHoldersRequest with a mint address and default values for other fields. ```rust use helius::types::GetCompressedMintTokenHoldersRequest; let request = GetCompressedMintTokenHoldersRequest { mint: "111111152P2r5yt6odmBLPsFCLBrFisJ3aS7LqLAT".to_string(), ..Default::default() }; ``` -------------------------------- ### Example: Send and Confirm Transaction Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Demonstrates how to send a transaction and wait for its confirmation using the HeliusAsyncSolanaClient. ```rust let tx = system_transaction::transfer(&alice, &bob.pubkey(), lamports, latest_blockhash); let signature = rpc_client.send_and_confirm_transaction(&tx).await?; ``` -------------------------------- ### Creating a GetCompressedTokenAccountsByDelegateRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressedTokenAccountsByDelegateRequest.html Example of how to instantiate GetCompressedTokenAccountsByDelegateRequest with a delegate address. Uses `Default::default()` to initialize optional fields. ```rust use helius::types::GetCompressedTokenAccountsByDelegateRequest; let request = GetCompressedTokenAccountsByDelegateRequest { delegate: "11111116EPqoQskEM2Pddp8KTL9JdYEBZMGF3aq7V".to_string(), ..Default::default() }; ``` -------------------------------- ### Creating a GetCompressedAccountsByOwnerRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressedAccountsByOwnerRequest.html Example of how to instantiate GetCompressedAccountsByOwnerRequest with a specific owner and default values for other optional fields. ```rust use helius::types::GetCompressedAccountsByOwnerRequest; let request = GetCompressedAccountsByOwnerRequest { owner: "11111114d3RrygbPdAtMuFnDmzsN8T5fYKVQ7FVr7".to_string(), ..Default::default() }; ``` -------------------------------- ### GetValidityProofRequest Example Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetValidityProofRequest.html Instantiate `GetValidityProofRequest` with hashes for verification. Uses `Default::default()` to omit `new_addresses_with_trees`. ```rust use helius::types::GetValidityProofRequest; let request = GetValidityProofRequest { hashes: Some(vec!["11111112cMQwSC9qirWGjZM6gLGwW69X22mqwLLGP".to_string()]), ..Default::default() }; ``` -------------------------------- ### Creating a GetLatestCompressionSignaturesRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetLatestCompressionSignaturesRequest.html Example of how to instantiate GetLatestCompressionSignaturesRequest with a specified limit and default values for other fields. ```rust use helius::types::GetLatestCompressionSignaturesRequest; let request = GetLatestCompressionSignaturesRequest { limit: Some(10), ..Default::default() }; ``` -------------------------------- ### Example Usage of GetCompressionSignaturesForAddressRequest Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetCompressionSignaturesForAddressRequest.html Demonstrates how to create an instance of GetCompressionSignaturesForAddressRequest. The address is required, while cursor and limit can be omitted by using Default::default(). ```rust use helius::types::GetCompressionSignaturesForAddressRequest; let request = GetCompressionSignaturesForAddressRequest { address: "11111119T6fgHG3unjQB6vpWozhBdiXDbQovvFVeF".to_string(), ..Default::default() }; ``` -------------------------------- ### Subscribe to Transactions Source: https://docs.rs/helius/latest/helius/websocket/struct.EnhancedWebsocket.html Stream transactions with various configurations and filters. This example shows how to monitor transactions for a specific public key. ```rust use helius::Helius; use helius::error::Result; use helius::types::{Cluster, RpcTransactionsConfig, TransactionSubscribeFilter, TransactionSubscribeOptions}; use solana_sdk::pubkey; use tokio_stream::StreamExt; #[tokio::main] async fn main() -> Result<()> { let helius = Helius::new_async("your_api_key", Cluster::MainnetBeta).await.expect("Failed to create a Helius client"); // you may monitor transactions for any pubkey, this is just an example. let key = pubkey!("BtsmiEEvnSuUnKxqXj2PZRYpPJAc7C34mGz8gtJ1DAaH"); let config = RpcTransactionsConfig { filter: TransactionSubscribeFilter::standard(&key), options: TransactionSubscribeOptions::default(), }; if let Some(ws) = helius.ws() { let (mut stream, _unsub) = ws.transaction_subscribe(config).await?; while let Some(event) = stream.next().await { println!("{:#?}", event); } } Ok(()) } ``` -------------------------------- ### Get Finalized Blocks by Slot and Limit Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves a list of finalized blocks starting from a given slot, up to a specified limit. Errors if the limit exceeds 500,000 slots. ```rust // Get the first 10 blocks let start_slot = 0; let limit = 10; let blocks = rpc_client.get_blocks_with_limit(start_slot, limit).await?; ``` -------------------------------- ### Create SignatureFilter for transactions within a signature range Source: https://docs.rs/helius/latest/helius/types/inner/struct.SignatureFilter.html Use this to get transactions within a specific signature range (inclusive start, exclusive end). Signatures are compared lexicographically. ```rust let filter = SignatureFilter { gte: Some("3jweEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXF...".to_string()), lt: Some("6k7xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXF...".to_string()), ..Default::default() }; ``` -------------------------------- ### init Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Initializes the client with the given initializer. ```APIDOC ## init ### Description Initializes the client with the given initializer. ### Signature `unsafe fn init(init: ::Init) -> usize` ``` -------------------------------- ### Example Usage of SearchAssetsOptions Source: https://docs.rs/helius/latest/helius/types/options/struct.SearchAssetsOptions.html Demonstrates how to instantiate SearchAssetsOptions with specific fields enabled and others using default values. Note that setting show_grand_total to false can lead to faster responses. ```rust use helius::types::SearchAssetsOptions; let options = SearchAssetsOptions { show_collection_metadata: true, show_grand_total: false, // Skip for faster response show_native_balance: true, ..Default::default() }; ``` -------------------------------- ### Create BlockTimeFilter for Transactions within a Specific Time Range Source: https://docs.rs/helius/latest/helius/types/inner/struct.BlockTimeFilter.html Combine `gte` and `lt` fields to define an inclusive start and exclusive end for transaction retrieval. This example filters for January 2024. ```rust // Get transactions from a specific time range let filter = BlockTimeFilter { gte: Some(1704067200), // Jan 1, 2024 lt: Some(1706745600), // Feb 1, 2024 ..Default::default() }; ``` -------------------------------- ### Get Confirmed Blocks by Slot, Limit, and Commitment Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves a list of confirmed blocks starting from a given slot, up to a specified limit, with a custom commitment level. Errors if the limit exceeds 500,000 slots or if commitment is below 'Confirmed'. ```rust // Get the first 10 blocks let start_slot = 0; let limit = 10; let commitment_config = CommitmentConfig::confirmed(); let blocks = rpc_client.get_blocks_with_limit_and_commitment( start_slot, limit, commitment_config, ).await?; ``` -------------------------------- ### GetAssetOptions Initialization Source: https://docs.rs/helius/latest/helius/types/options/struct.GetAssetOptions.html Demonstrates how to initialize GetAssetOptions, enabling specific metadata fields while using default values for others. This is useful for customizing asset retrieval. ```rust use helius::types::GetAssetOptions; let options = GetAssetOptions { show_collection_metadata: true, show_inscription: true, ..Default::default() }; ``` -------------------------------- ### Subscribe to Account Updates Source: https://docs.rs/helius/latest/helius/websocket/struct.EnhancedWebsocket.html Stream account updates for a given public key. This example demonstrates how to set up a subscription and process incoming account data. ```rust use helius::Helius; use helius::error::Result; use helius::types::{Cluster, RpcTransactionsConfig, TransactionSubscribeFilter, TransactionSubscribeOptions}; use solana_sdk::pubkey; use tokio_stream::StreamExt; #[tokio::main] async fn main() -> Result<()> { let helius = Helius::new_async("your_api_key", Cluster::MainnetBeta).await.expect("Failed to create a Helius client"); // you may monitor updates for any account pubkey, this is just an example. let key = pubkey!("BtsmiEEvnSuUnKxqXj2PZRYpPJAc7C34mGz8gtJ1DAaH"); if let Some(ws) = helius.ws() { let (mut stream, _unsub) = ws.account_subscribe(&key, None).await?; while let Some(event) = stream.next().await { println!("{:#?}", event); } } Ok(()) } ``` -------------------------------- ### Instantiate AddressWithTree Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.AddressWithTree.html Example of creating an instance of the AddressWithTree struct with sample address and tree values. Ensure the provided strings are valid Solana public keys. ```rust use helius::types::AddressWithTree; let entry = AddressWithTree { address: "11111117qkFjr4u54stuNNUR8fRF8dNhaP35yvANs".to_string(), tree: "11111118F5rixNBnFLmioWZSYzjjFuAL5dyoDVzhD".to_string(), }; ``` -------------------------------- ### NativeBalance JSON Example Source: https://docs.rs/helius/latest/helius/types/inner/struct.NativeBalance.html An example of how the NativeBalance information is represented in JSON format. This structure is returned by Helius API endpoints when the `show_native_balance` option is enabled. ```json { "lamports": 5000000000, "price_per_sol": 100.50, "total_price": 502.50 } ``` -------------------------------- ### Get Recent Prioritization Fees Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves minimum prioritization fees from recent blocks. Provide addresses to get fees specific to transactions involving those accounts. ```rust let addresses = vec![alice.pubkey(), bob.pubkey()]; let prioritization_fees = rpc_client.get_recent_prioritization_fees( &addresses, ).await?; ``` -------------------------------- ### Init Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html The type for initializers. ```APIDOC ## Init ### Description The type for initializers. ### Associated Type `Init: T` ``` -------------------------------- ### Create and use ApiKey Source: https://docs.rs/helius/latest/helius/types/struct.ApiKey.html Demonstrates creating a new ApiKey and asserting its string representation. This is useful for initializing API clients with validated keys. ```rust use helius::types::ApiKey; let key = ApiKey::new("your-api-key").unwrap(); assert_eq!(key.as_str(), "your-api-key"); ``` -------------------------------- ### Get Compression Signatures for Address Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html Retrieves transaction signatures for a specific compressed address. Use this to get a paginated list of signatures affecting a single compressed account. ```rust use helius::Helius; use helius::types::{Cluster, GetCompressionSignaturesForAddressRequest}; #[tokio::main] async fn main() { let helius = Helius::new("your_api_key", Cluster::MainnetBeta).unwrap(); let request = GetCompressionSignaturesForAddressRequest { address: "11111119T6fgHG3unjQB6vpWozhBdiXDbQovvFVeF".to_string(), ..Default::default() }; let response = helius.get_compression_signatures_for_address(request).await.unwrap(); for sig in &response.value.items { println!( "Signature: {} — Slot: {} — Time: {}", sig.signature, sig.slot, sig.block_time ); } if let Some(cursor) = &response.value.cursor { println!("Next page cursor: {}", cursor); } } ``` -------------------------------- ### type_id Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html Gets the `TypeId` of `self`. ```APIDOC ## type_id ### Description Gets the `TypeId` of `self`. ### Method `type_id(&self) -> TypeId` ``` -------------------------------- ### Pointable::init Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Initializes a with the given initializer. ```APIDOC ## unsafe fn init(init: ::Init) -> usize Initializes a with the given initializer. Read more ``` -------------------------------- ### Get All Webhooks Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html Retrieves all Helius webhooks programmatically. ```APIDOC ## get_all_webhooks ### Description Retrieves all Helius webhooks programmatically. Due to response size limitations, we will truncate addresses returned to 100 per config. ### Method GET ### Endpoint /v1/webhooks ### Response #### Success Response (200) - **webhooks** (array) - A list of Webhook objects - **webhook_id** (string) - The ID of the webhook - **url** (string) - The URL of the webhook - **type** (string) - The type of the webhook - **addresses** (array) - A list of addresses associated with the webhook - **active** (boolean) - Indicates if the webhook is active #### Response Example { "webhooks": [ { "webhook_id": "wh_12345", "url": "https://example.com/webhook1", "type": "ACCOUNT_UPDATED", "addresses": ["address1", "address2"], "active": true }, { "webhook_id": "wh_67890", "url": "https://example.com/webhook2", "type": "TRANSACTION_CONFIRMED", "addresses": ["address3", "address4"], "active": false } ] } ``` -------------------------------- ### commitment Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Get the configured default commitment level. ```APIDOC ## commitment ### Description Get the configured default commitment level. The commitment config may be specified during construction, and determines how thoroughly committed a transaction must be when waiting for its confirmation or otherwise checking for confirmation. If not specified, the default commitment level is `Finalized`. The default commitment level is overridden when calling methods that explicitly provide a `CommitmentConfig`, like `RpcClient::confirm_transaction_with_commitment`. ### Returns CommitmentConfig - The default commitment configuration. ``` -------------------------------- ### RpcClient::new Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Initializes a new RpcClient instance with an embedded Solana client. ```APIDOC ## RpcClient::new ### Description Initializes a new RpcClient instance with an embedded Solana client. ### Arguments - `client` (Arc) - Shared HTTP client for making requests - `config` (Arc) - Configuration holding a given API key and endpoint URLs ### Returns Result - A result that, if successful, contains the initialized RpcClient. ### Errors Returns `HeliusError` if the URL isn’t formatted correctly or the `RequestHandler` fails to initialize. ``` -------------------------------- ### Initialization Source: https://docs.rs/helius/latest/helius/types/inner/struct.EditionsList.html Provides methods for initializing and managing objects via pointers. ```APIDOC ## type Init The type for initializers. ## unsafe fn init(init: ::Init) -> usize Initializes a with the given initializer. ## unsafe fn deref<'a, T>(ptr: usize) -> &'a T Dereferences the given pointer. ## unsafe fn deref_mut<'a, T>(ptr: usize) -> &'a mut T Mutably dereferences the given pointer. ## unsafe fn drop(ptr: usize) Drops the object pointed to by the given pointer. ``` -------------------------------- ### url Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Get the configured url of the client’s sender. ```APIDOC ## url ### Description Get the configured url of the client’s sender. ### Returns String - The configured URL. ``` -------------------------------- ### init Source: https://docs.rs/helius/latest/helius/types/inner/struct.CreateSmartTransactionSeedConfig.html Initializes the CreateSmartTransactionSeedConfig with the given initializer. ```APIDOC #### unsafe fn init(init: ::Init) -> usize Initializes a with the given initializer. Read more ``` -------------------------------- ### BalancesResponse Struct Source: https://docs.rs/helius/latest/helius/types/inner/struct.BalancesResponse.html Represents the response from a get balances endpoint. ```APIDOC ## Struct BalancesResponse ### Description Response from get balances endpoint. ### Fields - `balances` (Vec) - Array of token balances for the current page. - `nfts` (Option>) - Array of NFT holdings (only if `show_nfts` is `true`). - `total_usd_value` (f64) - Total USD value of balances on this page. - `pagination` (BalancesPagination) - Pagination metadata. ``` -------------------------------- ### get_all_token_accounts_by_owner Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Get all token accounts by owner by auto-paginating through results. ```APIDOC ## get_all_token_accounts_by_owner ### Description Retrieves all token accounts owned by a specific wallet by automatically paginating through the results. ### Method Signature `pub async fn get_all_token_accounts_by_owner(&self, owner: String, filter: TokenAccountsOwnerFilter, config: GetTokenAccountsByOwnerV2Config) -> Result>` ### Arguments * `owner` - The Base58 wallet address whose token accounts you want to fetch. * `filter` - Filter by mint or programId. * `config` - A config struct that controls the encoding, pagination, and `changed_since_slot` defined by the type `GetTokenAccountsByOwnerV2Config`. Note `limit` defaults to `10000`, if not provided, and the `pagination_key` is ignored since the method auto-paginates. ### Returns A vector of all token account records (`Vec`). ``` -------------------------------- ### new Source: https://docs.rs/helius/latest/helius/websocket/struct.EnhancedWebsocket.html Creates a new EnhancedWebsocket client. ```APIDOC ## new ### Description Creates a new EnhancedWebsocket client, expecting an enhanced websocket endpoint. ### Method `pub async fn new(url: &str, ping_interval_secs: Option, pong_timeout_secs: Option) -> Result` ### Parameters #### Path Parameters - **url** (*&str*) - Required - The enhanced websocket endpoint URL (e.g., `wss://atlas-mainnet.helius-rpc.com?api-key=`) - **ping_interval_secs** (*Option*) - Optional - The interval in seconds for sending ping frames. - **pong_timeout_secs** (*Option*) - Optional - The timeout in seconds for receiving a pong frame after sending a ping. ### Returns Returns a `Result` containing the new `EnhancedWebsocket` client or an error if connection fails. ``` -------------------------------- ### RpcClient::get_asset Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Gets an asset by its ID from the Helius API. ```APIDOC ## RpcClient::get_asset ### Description Gets an asset by its ID. ### Arguments - `request` (GetAsset) - A struct containing the ID of the asset to fetch, along with other optional sorting and display options. ### Returns Result> - A `Result` with an optional `Asset` object if found. It can also return `None` if no asset matches the ID provided. ``` -------------------------------- ### Get Multiple Accounts with Configuration Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Fetches account information for a list of provided public keys with custom configurations for encoding and commitment. ```rust let pubkeys = vec![alice.pubkey(), bob.pubkey()]; let commitment_config = CommitmentConfig::processed(); let config = RpcAccountInfoConfig { encoding: Some(UiAccountEncoding::Base64), commitment: Some(commitment_config), .. RpcAccountInfoConfig::default() }; let accounts = rpc_client.get_multiple_accounts_with_config( &pubkeys, config, ).await?; ``` -------------------------------- ### Get Mint API Authority Source: https://docs.rs/helius/latest/helius/config/struct.Config.html Retrieves the MintApiAuthority from the configuration. ```rust pub fn mint_api_authority(&self) -> MintApiAuthority ``` -------------------------------- ### ProjectUsage Initialization and Management Source: https://docs.rs/helius/latest/helius/types/inner/struct.ProjectUsage.html Provides methods for initializing, dereferencing, and dropping objects within the ProjectUsage context. ```APIDOC ## unsafe fn init ### Description Initializes a with the given initializer. ### Signature `unsafe fn init(init: ::Init) -> usize` ``` ```APIDOC ## unsafe fn deref ### Description Dereferences the given pointer. ### Signature `unsafe fn deref<'a>(ptr: usize) -> &'a T` ``` ```APIDOC ## unsafe fn deref_mut ### Description Mutably dereferences the given pointer. ### Signature `unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T` ``` ```APIDOC ## unsafe fn drop ### Description Drops the object pointed to by the given pointer. ### Signature `unsafe fn drop(ptr: usize)` ``` -------------------------------- ### Get Webhook by ID Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html Retrieves a webhook configuration given its ID. ```APIDOC ## get_webhook_by_id ### Description Gets a webhook config given a webhook ID. ### Method GET ### Endpoint /v1/webhooks/{webhook_id} ### Parameters #### Path Parameters - **webhook_id** (string) - Required - The ID of the webhook to be updated ### Response #### Success Response (200) - **webhook_id** (string) - The ID of the webhook - **url** (string) - The URL of the webhook - **type** (string) - The type of the webhook - **addresses** (array) - A list of addresses associated with the webhook - **active** (boolean) - Indicates if the webhook is active #### Response Example { "webhook_id": "wh_12345", "url": "https://example.com/webhook", "type": "ACCOUNT_UPDATED", "addresses": ["address1", "address2"], "active": true } ``` -------------------------------- ### Initialize RpcClient Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Creates a new RpcClient instance with an embedded Solana client. Requires a shared HTTP client and configuration. Errors can occur if the URL is malformed or the RequestHandler fails. ```rust pub fn new(client: Arc, config: Arc) -> Result ``` -------------------------------- ### Get Transport Stats Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves statistics about the RPC transport layer. ```APIDOC ## GET /get_transport_stats ### Description Retrieves statistics about the RPC transport layer. ### Method GET ### Endpoint /get_transport_stats ### Parameters #### Path Parameters - None #### Query Parameters - None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **stats** (RpcTransportStats) - An object containing transport statistics. #### Response Example ```json { "stats": { "requests_sent": 100, "responses_received": 100, "errors": 0 } } ``` ``` -------------------------------- ### Get Latest Blockhash Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves the latest blockhash from the Solana network. ```APIDOC ## GET /get_latest_blockhash ### Description Retrieves the latest blockhash from the Solana network. ### Method GET ### Endpoint /get_latest_blockhash ### Parameters #### Path Parameters - None #### Query Parameters - None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **blockhash** (Hash) - The latest blockhash. #### Response Example ```json { "blockhash": "" } ``` ``` -------------------------------- ### Create ApiKey with validation Source: https://docs.rs/helius/latest/helius/types/struct.ApiKey.html Shows how to create an ApiKey, validating that it is not empty or whitespace-only. It also demonstrates how empty keys result in an error. ```rust use helius::types::ApiKey; let key = ApiKey::new("my-api-key").unwrap(); assert_eq!(key.as_str(), "my-api-key"); // Empty keys are rejected assert!(ApiKey::new("").is_err()); assert!(ApiKey::new(" ").is_err()); ``` -------------------------------- ### get_transactions_for_address Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Gets transactions for a specific address with advanced filtering and sorting. ```APIDOC ## get_transactions_for_address ### Description Fetches transactions associated with a given account address, offering advanced options for filtering, sorting, and pagination. ### Method Signature `pub async fn get_transactions_for_address(&self, address: String, options: GetTransactionsForAddressOptions) -> Result` ### Arguments * `address` - The base58 encoded public key of the account. * `options` - Options for filtering, sorting, and pagination. ### Returns A `Result` containing the transaction data and an optional pagination token. ``` -------------------------------- ### from Source: https://docs.rs/helius/latest/helius/types/inner/struct.GetTransactionsForAddressOptions.html Creates a new instance from the given value. ```APIDOC ## fn from(t: T) -> T ### Description Returns the argument unchanged. ### Parameters * `t` (T) - The value to create from. ``` -------------------------------- ### Dereference Pointer Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.MerkleProofWithContext.html Dereferences a raw pointer to get an immutable reference to the object. ```APIDOC ## unsafe fn deref<'a>(ptr: usize) -> &'a T Dereferences the given pointer. ``` -------------------------------- ### Helius::get_compute_units Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html Simulates a transaction to get the total compute units consumed. ```APIDOC ## Helius::get_compute_units ### Description Simulates a transaction to get the total compute units consumed. ### Arguments * `instructions` - The transaction instructions. * `payer` - The public key of the payer. * `lookup_tables` - The address lookup tables. * `signers` - The signers for the transaction. ### Returns The compute units consumed, or None if unsuccessful. ``` -------------------------------- ### Config::create_client Source: https://docs.rs/helius/latest/helius/config/struct.Config.html Creates a basic Helius client from this configuration. ```APIDOC ## pub fn create_client(self) -> Result Creates a basic Helius client from this configuration ### Returns A `Result` containing a Helius client with basic RPC capabilities ``` -------------------------------- ### Get Inflation Rate Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Fetches the specific inflation values for the current epoch. ```rust let inflation_rate = rpc_client.get_inflation_rate().await?; ``` -------------------------------- ### Get Block Production Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves block production information for the current epoch. ```rust let production = rpc_client.get_block_production().await?; ``` -------------------------------- ### Get Account with Configuration Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Fetches detailed information for a specific account, including encoding and commitment level. Returns Ok(None) if the account does not exist. ```rust let alice_pubkey = Pubkey::from_str("BgvYtJEfmZYdVKiptmMjxGzv8iQoo4MWjsP3QsTkhhxa").unwrap(); let commitment_config = CommitmentConfig::processed(); let config = RpcAccountInfoConfig { encoding: Some(UiAccountEncoding::Base64), commitment: Some(commitment_config), .. RpcAccountInfoConfig::default() }; let account = rpc_client.get_account_with_config( &alice_pubkey, config, ).await?; assert!(account.value.is_some()); ``` -------------------------------- ### Get Slot with Commitment Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves the slot that has reached a specified commitment level. ```rust let commitment_config = CommitmentConfig::processed(); let slot = rpc_client.get_slot_with_commitment(commitment_config).await?; ``` -------------------------------- ### Get Client URL Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves the configured URL of the client's sender. ```rust pub fn url(&self) -> String ``` -------------------------------- ### Policy Implementation Source: https://docs.rs/helius/latest/helius/types/enums/enum.Encoding.html Provides a method to create a new Policy that returns Action::Follow if either self or other returns Action::Follow. ```APIDOC ## fn or(self, other: P) -> Or ### Description Create a new `Policy` that returns `Action::Follow` if either `self` or `other` returns `Action::Follow`. ### Parameters - **other** (P) - Description of the other policy. ### Returns - **Or** - A new Policy that combines the logic of self and other. ``` -------------------------------- ### GetAssetOptions Source: https://docs.rs/helius/latest/helius/types/options/struct.GetAssetOptions.html Struct to configure options for retrieving asset data. ```APIDOC ## Struct GetAssetOptions ### Description Display options for the `getAsset` and `getAssetBatch` methods. These flags control which additional data is included when retrieving individual assets. Each option adds extra data and may increase response time. ### Fields - **`show_collection_metadata`** (bool) - Show metadata for the collection. - **`show_unverified_collections`** (bool) - Show grouping information for unverified collections instead of skipping them. - **`show_raw_data`** (bool) - Show raw on-chain data for the asset. (Note: Helius-specific) - **`show_fungible`** (bool) - Show fungible tokens held by the owner. - **`require_full_index`** (bool) - Require the asset to be fully indexed before returning. (Note: Helius-specific) - **`show_system_metadata`** (bool) - Show system-level metadata for the asset. (Note: Helius-specific) - **`show_native_balance`** (bool) - Show the native (SOL) balance of the owner. - **`show_inscription`** (bool) - Display inscription details of assets inscribed on-chain. ### Example ```rust use helius::types::GetAssetOptions; let options = GetAssetOptions { show_collection_metadata: true, show_inscription: true, ..Default::default() }; ``` ``` -------------------------------- ### RpcClient::get_asset_batch Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Gets multiple assets by their IDs in a batch from the Helius API. ```APIDOC ## RpcClient::get_asset_batch ### Description Gets multiple assets by their ID. ### Arguments - `request` (GetAssetBatch) - A struct containing the IDs of the assets to fetch in a batch. ### Returns Result>> - A `Result` containing a vector of optional `Asset` objects, each corresponding to the IDs provided. It can also return `None` if no assets match the IDs provided. ``` -------------------------------- ### Init Type Source: https://docs.rs/helius/latest/helius/types/inner/struct.GetAssetsByGroup.html The type for initializers. ```APIDOC ## type Init The type for initializers. ``` -------------------------------- ### Initialize RpcClient with Commitment Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Initializes a new RpcClient with a specific Solana commitment configuration. This is useful for controlling the consistency and latency of Solana RPC calls. Errors can occur if the URL is malformed or the RequestHandler fails. ```rust pub fn new_with_commitment( client: Arc, config: Arc, commitment: CommitmentConfig, ) -> Result ``` -------------------------------- ### Mutably Dereference Pointer Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.MerkleProofWithContext.html Dereferences a raw pointer to get a mutable reference to the object. ```APIDOC ## unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T Mutably dereferences the given pointer. ``` -------------------------------- ### Get Fee for Message Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Calculates the estimated transaction fee for a given serializable message. ```APIDOC ## POST /get_fee_for_message ### Description Calculates the estimated transaction fee for a given serializable message. ### Method POST ### Endpoint /get_fee_for_message ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **message** (impl SerializableMessage) - Required - The message for which to calculate the fee. ### Request Example ```json { "message": { "recentBlockhash": "", "instructions": [ { "programId": "", "accounts": [""], "data": "" } ] } } ``` ### Response #### Success Response (200) - **fee** (u64) - The estimated transaction fee in lamports. #### Response Example ```json { "fee": 5000 } ``` ``` -------------------------------- ### Helius Client Creation with Builder (Deprecated) Source: https://docs.rs/helius/latest/helius/config/struct.Config.html Demonstrates how to create a Helius client using HeliusBuilder. This method is preferred over the deprecated `Config::new` for more flexible configuration. ```rust use helius::HeliusBuilder; use helius::types::Cluster; let helius = HeliusBuilder::new() .with_api_key("key")? .with_cluster(Cluster::MainnetBeta) .build() .await?; ``` -------------------------------- ### Combine Policies with AND Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.MerkleProofWithContext.html Creates a new policy that requires both `self` and `other` policies to return `Action::Follow`. ```APIDOC ## fn and(self, other: P) -> And where T: Policy, P: Policy, Create a new `Policy` that returns `Action::Follow` only if `self` and `other` return `Action::Follow`. ``` -------------------------------- ### Get Node Identity Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Fetches the public key (identity) of the current Solana node. ```rust let identity = rpc_client.get_identity().await?; ``` -------------------------------- ### Initialize Helius Client and Get Compressed Account Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html Initializes the Helius client with an API key and cluster, then retrieves a compressed account using its data hash. Requires a valid API key and a 'hash' for the account. ```rust use helius::Helius; use helius::types::{Cluster, GetCompressedAccountRequest}; #[tokio::main] async fn main() { let helius = Helius::new("your_api_key", Cluster::MainnetBeta).unwrap(); let request = GetCompressedAccountRequest { hash: Some("11111111111111111111111111111111".to_string()), ..Default::default() }; let response = helius.get_compressed_account(request).await.unwrap(); if let Some(account) = response.value { println!("Owner: {}", account.owner); println!("Lamports: {}", account.lamports); println!("Tree: {}", account.tree); } } ``` -------------------------------- ### Get Epoch Information with Commitment Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves epoch information with a specified commitment level. ```rust let commitment_config = CommitmentConfig::confirmed(); let epoch_info = rpc_client.get_epoch_info_with_commitment( commitment_config, ).await?; ``` -------------------------------- ### Get Slot Leaders Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Fetches a list of slot leaders for a specified range of slots. ```rust let start_slot = 1; let limit = 3; let leaders = rpc_client.get_slot_leaders(start_slot, limit).await?; ``` -------------------------------- ### Get Current Slot Source: https://docs.rs/helius/latest/helius/client/struct.HeliusAsyncSolanaClient.html Retrieves the current slot that has reached the configured commitment level. ```rust let slot = rpc_client.get_slot().await?; ``` -------------------------------- ### New Smart Transaction Config Source: https://docs.rs/helius/latest/helius/types/inner/struct.CreateSmartTransactionConfig.html Creates a new smart transaction configuration with the essential fields: instructions and signers. This is the basic setup for initiating a smart transaction. ```rust pub fn new( instructions: Vec, signers: Vec>, ) -> Self ``` -------------------------------- ### Pointable Trait Implementation (deref_mut) Source: https://docs.rs/helius/latest/helius/types/enhanced_transaction_types/struct.ParseTransactionsRequest.html Dereferences the given pointer to get a mutable reference. ```rust unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T ``` -------------------------------- ### VZip Implementation Source: https://docs.rs/helius/latest/helius/types/inner/struct.TransfersResponse.html Implementation for VZip. ```APIDOC ### impl VZip for T #### fn vzip(self) -> V ``` -------------------------------- ### Pointable Trait Implementation (deref) Source: https://docs.rs/helius/latest/helius/types/enhanced_transaction_types/struct.ParseTransactionsRequest.html Dereferences the given pointer to get an immutable reference. ```rust unsafe fn deref<'a>(ptr: usize) -> &'a T ``` -------------------------------- ### get_stake_instructions Source: https://docs.rs/helius/latest/helius/client/struct.Helius.html Generates the instructions to create and delegate a new stake account with Helius. This method returns the `Vec` and the newly generated `Keypair` for the stake account. ```APIDOC ## get_stake_instructions ### Description Generate the instructions to create and delegate a new stake account with Helius. This method only returns the `Vec` and the newly generated `Keypair` for the stake account. Note that **you** are responsible for building, signing, and sending the transaction. We recommend using this method with our smart transactions. ### Method `pub async fn get_stake_instructions(&self, owner: Pubkey, amount_sol: f64) -> Result<(Vec, Keypair)>` ### Parameters #### Arguments * `owner` (Pubkey) - The public key of the wallet funding and authorizing the stake. * `amount_sol` (f64) - The amount of SOL to stake, **excluding** the rent-exempt minimum. ### Returns * `Vec` - Instructions to create and delegate the stake account. * `Keypair` - The newly generated stake account keypair. ### Errors Returns an error if fetching the rent-exempt minimum balance fails. ``` -------------------------------- ### RpcClient::get_assets_by_authority Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Gets a list of assets owned by a specific authority from the Helius API. ```APIDOC ## RpcClient::get_assets_by_authority ### Description Gets a list of assets of a given authority. ### Arguments - `request` (GetAssetsByAuthority) - A struct containing the authority’s address, along with other optional sorting and display options. ### Returns Result - A `Result` containing an `AssetList` detailing the assets managed by the specified authority. It can also return `None` if no assets are managed by the given authority. ``` -------------------------------- ### RpcClient::get_asset_proof_batch Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Gets multiple asset proofs by their IDs in a batch from the Helius API. ```APIDOC ## RpcClient::get_asset_proof_batch ### Description Gets multiple asset proofs by their IDs. ### Arguments - `request` (GetAssetProofBatch) - A struct containing the IDs of the assets for which proofs are requested. ### Returns Result>> - A `Result` with a hashmap where each key is an asset ID and each value is an optional `AssetProof`. It can also return `None` if no proofs correspond to the IDs provided. ``` -------------------------------- ### CloneToUninit Implementation (Nightly) Source: https://docs.rs/helius/latest/helius/types/inner/struct.TokenBalance.html Nightly-only experimental API for performing copy-assignment to uninitialized memory. ```rust impl CloneToUninit for T where T: Clone, Source§ #### unsafe fn clone_to_uninit(&self, dest: *mut u8) 🔬This is a nightly-only experimental API. (`clone_to_uninit`) Performs copy-assignment from `self` to `dest`. Read more Source ``` -------------------------------- ### RpcClient::get_asset_proof Source: https://docs.rs/helius/latest/helius/rpc_client/struct.RpcClient.html Gets a merkle proof for a compressed asset by its ID from the Helius API. ```APIDOC ## RpcClient::get_asset_proof ### Description Gets a merkle proof for a compressed asset by its ID. ### Arguments - `request` (GetAssetProof) - A struct containing the ID of the asset for which the proof is requested. ### Returns Result> - A `Result` with an optional `AssetProof` object if the asset exists and the proof is retrievable. It can also return `None` if the proof doesn’t exist or isn’t retrievable. ``` -------------------------------- ### unsafe fn init Source: https://docs.rs/helius/latest/helius/types/inner/struct.GetAssetsByGroup.html Initializes with the given initializer. ```APIDOC ## unsafe fn init(init: ::Init) -> usize Initializes with the given initializer. Read more ``` -------------------------------- ### and Source: https://docs.rs/helius/latest/helius/types/inner/struct.Ownership.html Creates a new Policy that returns Action::Follow only if both self and other policies return Action::Follow. ```APIDOC ## fn and(self, other: P) -> And ### Description Create a new `Policy` that returns `Action::Follow` only if `self` and `other` return `Action::Follow`. ### Parameters * `other`: P - The other policy to combine with. ### Returns And - A new policy representing the logical AND of self and other. ``` -------------------------------- ### TryInto Implementation Source: https://docs.rs/helius/latest/helius/types/zk_compression_types/struct.GetTransactionWithCompressionInfoRequest.html Provides methods for attempting conversions into other types. ```APIDOC ## try_into(self) -> Result>::Error> ### Description Performs the conversion from type `T` to type `U`. ### Method `try_into` ### Returns - Result>::Error> - A `Result` containing the converted value or an error. ``` -------------------------------- ### Config::create_client_with_async Source: https://docs.rs/helius/latest/helius/config/struct.Config.html Creates a Helius client with async Solana capabilities. ```APIDOC ## pub fn create_client_with_async(self) -> Result Creates a Helius client with async Solana capabilities ### Returns A `Result` containing a Helius client with both RPC and async Solana capabilities ```