> ## 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 TypeScript SDK for Agents

> Complete guide to the Helius TypeScript SDK for AI agents. Type-safe methods for DAS API, transactions, Helius Sender, webhooks, WebSockets, staking, ZK compression, and programmatic signup.

The [Helius TypeScript SDK](https://github.com/helius-labs/helius-sdk) provides type-safe methods for all Helius APIs, making it the fastest way for agents to interact with Solana.

* **Package**: `helius-sdk` (npm / pnpm / yarn)
* **Version**: 2.x (uses `@solana/kit`, not `@solana/web3.js`)
* **Runtime**: Any JavaScript runtime — browsers, Deno, Bun, edge runtimes (Cloudflare Workers, Vercel Edge), Node.js 20+
* **TypeScript**: 5.8+ (full type definitions included)
* **License**: ISC

## Installation

```bash theme={"system"}
npm install helius-sdk
```

## Quick Start

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

const helius = createHelius({
  apiKey: "YOUR_API_KEY",
  network: "mainnet", // or "devnet"
});

// Get all NFTs and tokens owned by a wallet
const assets = await helius.getAssetsByOwner({
  ownerAddress: "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY",
  page: 1,
  limit: 50,
});

// Get transaction history (with token account activity)
const txs = await helius.getTransactionsForAddress([
  "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY",
  { limit: 100, transactionDetails: "full", filters: { tokenAccounts: "balanceChanged" } },
]);

// Send a transaction via Helius Sender (ultra-low latency)
const sig = await helius.tx.sendTransactionWithSender({
  instructions: [transferInstruction],
  signers: [walletSigner],
  region: "US_EAST",
});
```

## Client Options

```typescript theme={"system"}
const helius = createHelius({
  apiKey: "YOUR_API_KEY",       // Required for webhooks, enhanced txs, wallet API
  network: "mainnet",           // "mainnet" (default) or "devnet"
  baseUrl: "https://custom..",  // Override RPC URL (optional)
  rebateAddress: "wallet",      // Wallet for RPC rebates (optional)
  userAgent: "my-agent/1.0",   // Sent as X-Helius-Client header (optional)
});
```

## Namespaces

All methods are accessed through the `helius` client. DAS API methods and standard Solana RPC methods are available directly on `helius.*`. Other functionality is organized into namespaces:

| Namespace      | Access                                                                | Purpose                                                  |
| -------------- | --------------------------------------------------------------------- | -------------------------------------------------------- |
| DAS API        | `helius.getAsset()`, `helius.getAssetsByOwner()`, etc.                | Query NFTs, tokens, compressed assets                    |
| RPC V2         | `helius.getTransactionsForAddress()`, `helius.getProgramAccountsV2()` | Enhanced RPC with pagination and filters                 |
| Transactions   | `helius.tx.*`                                                         | Smart transactions and Helius Sender                     |
| Enhanced       | `helius.enhanced.*`                                                   | Parse transactions into human-readable format            |
| Webhooks       | `helius.webhooks.*`                                                   | Create and manage webhook subscriptions                  |
| WebSockets     | `helius.ws.*`                                                         | Real-time blockchain data streams                        |
| Staking        | `helius.stake.*`                                                      | Stake SOL to Helius validator                            |
| ZK Compression | `helius.zk.*`                                                         | Compressed accounts and proofs                           |
| Wallet API     | `helius.wallet.*`                                                     | Balances, history, identity lookups                      |
| Standard RPC   | `helius.getBalance()`, `helius.getSlot()`, etc.                       | All standard Solana RPC methods via proxy                |
| Raw RPC        | `helius.raw`                                                          | Direct access to the underlying `@solana/kit` Rpc client |
| Auth           | `import { makeAuthClient } from "helius-sdk/auth/client"`             | Agent signup and API key management (standalone import)  |

## Programmatic Signup (Auth Module)

The auth module is a standalone import — it is not on the main `HeliusClient`. Use it for programmatic agent signup flows.

```typescript theme={"system"}
import { makeAuthClient } from "helius-sdk/auth/client";

const auth = makeAuthClient();

// All-in-one shortcut:
const result = await auth.agenticSignup({ secretKey: keypair.secretKey });
// result: { jwt, walletAddress, projectId, apiKey, endpoints, credits }

// Or step-by-step:
const keypair = await auth.generateKeypair();
const address = await auth.getAddress(keypair);
const { message, signature } = await auth.signAuthMessage(keypair.secretKey);
const { token } = await auth.walletSignup(message, signature, address);
const project = await auth.createProject(token);
const apiKey = await auth.createApiKey(token, project.id, address);
```

## Deep Dives

<CardGroup cols={2}>
  <Card title="Best Practices" icon="lightbulb" href="/agents/typescript-sdk/best-practices">
    Recommended patterns, pagination, common mistakes, and error handling
  </Card>

  <Card title="API Reference" icon="book" href="/agents/typescript-sdk/api-reference">
    Full method list for every namespace
  </Card>
</CardGroup>

## Resources

<CardGroup cols={2}>
  <Card title="GitHub Repository" icon="github" href="https://github.com/helius-labs/helius-sdk">
    Source code, examples, and issue tracking
  </Card>

  <Card title="Code Examples" icon="code" href="https://github.com/helius-labs/helius-sdk/tree/main/examples">
    Working examples for every method organized by namespace
  </Card>

  <Card title="SDK API Docs (TypeDoc)" icon="book" href="https://helius-labs.github.io/helius-sdk/">
    Full API documentation generated from source
  </Card>

  <Card title="Migration Guide (1.x to 2.x)" icon="arrow-right" href="https://github.com/helius-labs/helius-sdk/blob/main/MIGRATION.md">
    Upgrade from @solana/web3.js to @solana/kit
  </Card>
</CardGroup>
