At Helius, we’ve developed a Node.js and a Rust SDK to make developing on Solana easier. The following page includes information on installing and using these SDKs. It also covers common error handling, where to find the latest documentation, and how to contribute to these SDKs.

We also outline a list of unofficial community SDKs made by our wonderful community. Note that those SDKs are not officially maintained by our team — only the Node.js and Rust SDKs are.

Node.js SDK

Installation

The Helius Node.js SDK can be installed with any of the following package managers:

npm install helius-sdk

Quick Start

Here’s a straightforward example of how to use the Node.js SDK to fetch a list of assets owned by a given address:

import { Helius } from "helius-sdk";

const helius = new Helius("YOUR_API_KEY");
const response = await helius.rpc.getAssetsByOwner({
  ownerAddress: "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY",
  page: 1,
});

console.log(response.items);

Documentation

The README file is filled with in-depth code examples covering each method and basic usage. For API reference documentation, refer to our documentation and the official Solana documentation for general Solana JSON RPC API help.

Rust SDK

Installation

1

Add dependency to Cargo.toml

To start using the Helius Rust SDK in your project, add it as a dependency via cargo. Open your project’s Cargo.toml and add the following line under [dependencies]:

helius = "x.y.z"

where x.y.z is your desired version.

2

Alternative: Use cargo add command

Alternatively, use cargo add helius to add the dependency directly via the command line. This will automatically find the latest version compatible with your project and add it to your Cargo.toml.

3

Keep your SDK updated

Remember to run cargo update regularly to fetch the latest version of the SDK.

Quick Start

Here is a straightforward example of using the Enhanced Transactions API to parse a given transaction:

use helius::error::Result;
use helius::types::*;
use helius::Helius;

#[tokio::main]
async fn main() -> Result<()> {
    let api_key: &str = "your_api_key";
    let cluster: Cluster = Cluster::MainnetBeta;

    let helius: Helius = Helius::new(api_key, cluster).unwrap();

    let request: ParseTransactionsRequest = ParseTransactionsRequest {
        transactions: vec![
            "2sShYqqcWAcJiGc3oK74iFsYKgLCNiY2DsivMbaJGQT8pRzR8z5iBcdmTMXRobH8cZNZgeV9Ur9VjvLsykfFE2Li".to_string(),
        ],
    };

    let response: Result<Vec<EnhancedTransaction>, HeliusError> = helius.parse_transactions(request).await;
    println!("Assets: {:?}", response);

    Ok(())
}

Documentation

Error Handling

For example:

// From our Node.js SDK
try {
  const response = await helius.rpc.getAssetsByOwner({
    ownerAddress: "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY",
    page: 1,
  });
  console.log(response.items);
} catch (error) {
  console.log(error);
}

Common Error Codes

When working with the Helius SDK, you may encounter several error codes. Below is a table detailing some of the common error codes along with additional information to help you troubleshoot:

If you encounter any of these errors:

1

Check error documentation

Refer to errors.rs for a list of all possible errors returned by the Helius client, if using the Rust SDK

2

Review the documentation

Refer to the Helius documentation for further guidance

3

Contact support

Reach out to the Helius support team for more detailed assistance

Contribution to Our SDKs

We welcome all contributions to our SDKs! If you’re interested, here are our GitHub Repositories:

Unofficial Community SDKs