> ## Documentation Index
> Fetch the complete documentation index at: https://www.helius.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Helius Solana TypeScript SDK

> Official Helius TypeScript SDK for Solana development. Install helius-sdk, run your first query, and handle errors with comprehensive API, enhanced transaction, and DAS support.

The Helius TypeScript SDK ([`helius-sdk`](https://github.com/helius-labs/helius-sdk)) makes developing on Solana easier in TypeScript — in Node.js, the browser, or any other runtime. This page covers installing and using the SDK, handling common errors, and where to find the latest documentation.

Note the SDK has been rewritten as of version 2.0.0. This was done to use `@solana/kit` and remove the dependency on `@solana/web3.js` versions higher than 1.73.2. For those migrating to the latest version, please refer to our [migration guide](https://github.com/helius-labs/helius-sdk/blob/main/MIGRATION.md).

<CardGroup cols={1}>
  <Card title="GitHub Repository" icon="js" href="https://github.com/helius-labs/helius-sdk">
    Official Helius TypeScript SDK for Solana development
  </Card>
</CardGroup>

## Installation

The Helius TypeScript SDK can be installed with any of the following package managers:

<Tabs>
  <Tab title="npm">
    ```bash theme={"system"}
    npm install helius-sdk
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={"system"}
    pnpm install helius-sdk
    ```
  </Tab>

  <Tab title="Yarn">
    ```bash theme={"system"}
    yarn add helius-sdk
    ```
  </Tab>
</Tabs>

## Quick Start

Below is a straightforward example of how to use the TypeScript SDK to fetch a list of assets owned by a given address:

```typescript theme={"system"}
import { createHelius } from "helius-sdk";

(async () => {
  const apiKey = ""; // From Helius dashboard
  const helius = createHelius({ apiKey });

  try {
    const assets = await helius.getAssetsByOwner({
      ownerAddress: "owner_address_goes_here",
      page: 1,
      limit: 50,
      sortBy: { sortBy: "created", sortDirection: "asc" },
    });

    console.log("Fetched assets:", assets);
  } catch (error) {
    console.error("Error:", error);
  }
})();
```

## Documentation

The [examples directory](https://github.com/helius-labs/helius-sdk/tree/main/examples) is filled with in-depth code examples covering each method and basic usage, organized by namespace. For API reference documentation, refer to our [documentation](/docs/api-reference) and the [official Solana documentation](https://solana.com/docs/rpc) for general Solana JSON RPC API help. For general help with Kit, please refer to [Kit's documentation](https://www.solanakit.com/).

## Error Handling

An error message will be thrown when the API returns a non-success (i.e., 4xx or 5xx status code).

For example, below is a 401 thrown for an incorrect getAsset call:

```typescript theme={"system"}
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32001,
    "message": "Authentication failed. Missing or invalid API key."
  },
  "id": "1"
}
```

### 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:

<AccordionGroup>
  <Accordion title="400: Bad Request">
    This occurs when a request has invalid parameters.
  </Accordion>

  <Accordion title="401: Unauthorized">
    This occurs when an invalid API key is provided or access is restricted due to RPC rules.
  </Accordion>

  <Accordion title="429: Too Many Requests">
    This indicates that the user has exceeded the request limit in a given timeframe or is out of credits.
  </Accordion>

  <Accordion title="5XX: Internal Server Error">
    This is a generic error message for server-side issues. Please contact Helius support for assistance.
  </Accordion>
</AccordionGroup>

If you encounter any of these errors:

<Steps>
  <Step title="Check error documentation">
    Refer to [Kit's errors](https://www.solanakit.com/docs/concepts/errors) for a list of the errors you may encounter
  </Step>

  <Step title="Review the documentation">
    Refer to the [Helius documentation](/docs/) for further guidance
  </Step>

  <Step title="Contact support">
    Reach out to the Helius support team for more detailed assistance
  </Step>
</Steps>

## Contributing

We welcome all contributions to our SDKs! Read the [contributions guide](https://github.com/helius-labs/helius-sdk/blob/main/CONTRIBUTING.md) before opening up a pull request.
