Skip to content

Commit

Permalink
Update Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIchigo committed May 4, 2024
1 parent 4106e3d commit f6285bb
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 29 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,32 @@ If you encounter any of these errors, refer to the Helius documentation for furt
## Using the Helius SDK
Our SDK is designed to provide a seamless developer experience when building on Solana. We've separated the core functionality into various segments:

DAS API
- [get_asset](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset)
- [get_asset_batch](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset/get-asset-batch)
- [get_asset_proof](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset-proof)
- [get_asset_proof_batch](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset-proof/get-asset-proof-batch)
- [get_assets_by_owner](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-owner)
- [get_assets_by_authority](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-authority)
- [get_assets_by_creator](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-creator)
- [get_assets_by_group](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-group)
- [search_assets](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/search-assets)
- [get_signatures_for_asset](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-signatures-for-asset)
- [get_token_accounts](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-token-accounts)
- [get_nft_edition](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-nft-editions)
- [get_rwa_asset](https://github.com/helius-labs/helius-sdk/pull/71)

Mint API
- [mint_compressed_nft](https://docs.helius.dev/compression-and-das-api/mint-api/mint-compressed-nft)
### DAS API
- [`get_asset`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset) - Gets an asset by its ID
- [`get_asset_batch`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset/get-asset-batch) - Gets multiple assets by their ID
- [`get_asset_proof`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset-proof) - Gets a merkle proof for a compressed asset by its ID
- [`get_asset_proof_batch`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset-proof/get-asset-proof-batch) - Gets multiple asset proofs by their IDs
- [`get_assets_by_owner`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-owner) - Gets a list of assets owned by a given address
- [`get_assets_by_authority`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-authority) - Gets a list of assets of a given authority
- [`get_assets_by_creator`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-creator) - Gets a list of assets of a given creator
- [`get_assets_by_group`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-assets-by-group) - Gets a list of assets by a group key and value
- [`search_assets`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/search-assets) - Gets assets based on the custom search criteria passed in
- [`get_signatures_for_asset`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-signatures-for-asset) - Gets transaction signatures for a given asset
- [`get_token_accounts`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-token-accounts) - Gets information about all token accounts for a specific mint or owner
- [`get_nft_edition`](https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-nft-editions) - Gets all the NFT editions associated with a specific master NFT
- [`get_rwa_asset`](https://github.com/helius-labs/helius-sdk/pull/71) - Gets a Real-World Asset (RWA) based on its mint address

### Mint API
- [`mint_compressed_nft`](https://docs.helius.dev/compression-and-das-api/mint-api/mint-compressed-nft) - The easiest way to mint a compressed NFT (cNFT)

Enhanced Transactions API
- [parse_transactions](https://docs.helius.dev/solana-apis/enhanced-transactions-api/parse-transaction-s)
- [parsed_transaction_history](https://docs.helius.dev/solana-apis/enhanced-transactions-api/parsed-transaction-history)
- [`parse_transactions`](https://docs.helius.dev/solana-apis/enhanced-transactions-api/parse-transaction-s) - Parses transactions given an array of transaction IDs
- [`parsed_transaction_history`](https://docs.helius.dev/solana-apis/enhanced-transactions-api/parsed-transaction-history) - Retrieves a parsed transaction history for a specific address

Webhooks
### Webhooks

Helper Methods
- [get_priority_fee_estimate](https://docs.helius.dev/solana-rpc-nodes/alpha-priority-fee-api)
- [deserialize_str_to_number](https://github.com/helius-labs/helius-rust-sdk/blob/dev/src/utils/deserialize_str_to_number.rs)
- [is_valid_solana_address](https://github.com/helius-labs/helius-rust-sdk/blob/dev/src/utils/is_valid_solana_address.rs)
- [make_keypairs](https://github.com/helius-labs/helius-rust-sdk/blob/dev/src/utils/make_keypairs.rs)
### Helper Methods
- [`get_priority_fee_estimate`](https://docs.helius.dev/solana-rpc-nodes/alpha-priority-fee-api) - Gets an estimate of the priority fees required for a transaction to be processed more quickly
- [`deserialize_str_to_number`](https://github.com/helius-labs/helius-rust-sdk/blob/dev/src/utils/deserialize_str_to_number.rs) - Deserializes a `String` to a `Number`
- [`is_valid_solana_address`](https://github.com/helius-labs/helius-rust-sdk/blob/dev/src/utils/is_valid_solana_address.rs) - Returns whether a given string slice is a valid Solana address
- [`make_keypairs`](https://github.com/helius-labs/helius-rust-sdk/blob/dev/src/utils/make_keypairs.rs) - Generates a specified number of keypairs
8 changes: 7 additions & 1 deletion src/enhanced_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ impl Helius {
.await
}

/// Retrieves parsed transaction history for a specific address
/// Retrieves a parsed transaction history for a specific address
///
/// # Arguments
/// * `address` - An address for which a given parsed transaction history will be retrieved
///
/// # Returns
/// A `Result` wrapping a vector of `EnhancedTransaction`s
pub async fn parsed_transaction_history(&self, address: &str) -> Result<Vec<EnhancedTransaction>> {
let url: String = format!(
"{}v0/addresses/{}/transactions?api-key={}",
Expand Down
4 changes: 2 additions & 2 deletions src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl RpcClient {
self.post_rpc_request("getSignaturesForAsset", request).await
}

/// Gets transaction signatures for a given asset
/// Gets information about all token accounts for a specific mint or owner
///
/// # Arguments
/// * `request` - A struct that includes the owner or mint address, along with optional sorting, pagination, and display options
Expand All @@ -230,7 +230,7 @@ impl RpcClient {
self.post_rpc_request("getNftEditions", request).await
}

/// Gets an estimate of the priority fees required for a transaction to be processed more quicklGetPriorityFeeEstimateRequest
/// Gets an estimate of the priority fees required for a transaction to be processed more quickly
///
/// This method calculates varying levels of transaction fees that can influence the priority of a transaction, based on current network conditions
///
Expand Down
8 changes: 8 additions & 0 deletions src/utils/deserialize_str_to_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ use serde::{Deserialize, Deserializer};
use serde_json::{Number, Value};

/// Deserializes a `String` to a `Number`
///
/// # Arguments
/// * `deserializer` - The deserializer instance from which to read the JSON value
///
/// # Returns a `Result` that is:
/// - `Ok(Number)` when the input is either a valid `Number` string or a JSON `Number`
/// - `Err(D::Error)` when there's an error from the deserializer if the input is neither a stringified number nor a direct `Number`,
/// or if the `String` cannot be parsed into a `Number`
pub fn deserialize_str_to_number<'de, D>(deserializer: D) -> Result<Number, D::Error>
where
D: Deserializer<'de>,
Expand Down
10 changes: 9 additions & 1 deletion src/utils/is_valid_solana_address.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
use solana_sdk::pubkey::Pubkey;
use std::str::FromStr;

/// Returns whether a given string slice is a valid Solana address
/// Checks whether a given string slice is a valid Solana address
///
/// # Arguments
/// * `address` - A string slice representing an address to validate
///
/// # Returns
/// `true` if the input is a valid Solana address based on the following criteria:
/// - Have a length between 32 and 44 characters, inclusive
/// - Be parsable as a Solana 'Pubkey` without any errors
pub fn is_valid_solana_address(address: &str) -> bool {
address.len() >= 32 && address.len() <= 44 && Pubkey::from_str(address).is_ok()
}

0 comments on commit f6285bb

Please sign in to comment.