Skip to main content

solana_kit_helius 0.8.1 copy "solana_kit_helius: ^0.8.1" to clipboard
solana_kit_helius: ^0.8.1 copied to clipboard

Helius client package for Solana Kit Dart.

solana_kit_helius #

pub package docs website CI coverage

A Dart client for the Helius API, covering the DAS API, parsed events, enhanced transactions, webhooks, smart transactions, ZK compression, staking, the wallet API, WebSocket subscriptions, parsed streams, preconfirmations, and auth.

What you get #

  • DAS API: query assets, proofs, and metadata
  • Parsed Events: decode signatures and address history, and scan history by program instruction or token mint
  • Parsed Streams: real-time decoded transactions with server-side filters and automatic reconnect/resubscribe
  • Enhanced transactions: parsed transaction history with human-readable types
  • Webhooks: create, manage, and delete webhook subscriptions
  • Transaction utilities: priority fee policies, signed transaction broadcasting with expiry tracking, MEV Protect, and confirmation polling
  • ZK compression: compressed account and token operations via Light Protocol
  • Staking: create stake, unstake, and withdraw transactions via Helius validators
  • Wallet API: identity resolution, balances, history, and transfers
  • WebSockets: real-time subscription support, including preconfirmation filters, slot events, and coverage
  • Auth: project and API key management
  • Priority fees: estimate priority fees for transactions
  • RPC V2: enhanced RPC methods with pagination and the full getTransactionsForAddress filter surface
  • kitRpc: a standard solana_kit_rpc client over the Helius transport

Upstream compatibility #

solana_kit_helius version helius-sdk Released
next release v3.4.0 unreleased
0.7.0 – 0.8.0 v3.2.0 2026-09-21 – 2026-10-12
0.6.0 – 0.6.3 ad8f796d81be 2026-08-30 – 2026-09-12
0.4.0 – 0.5.1 4c0c55b86eab 2026-06-01 – 2026-08-19

This package was audited against helius-labs/helius-sdk v3.0.0 at commit 4c0c55b86eab0e3abde7896c0aa23c4b6515e9b0 (chore(release): Update CHANGELOG (#330), 2026-05-30). Helius has not published a Git tag for that release, so this commit is the comparison baseline.

The package covers the broad v3 surface: DAS, priority fees, RPC v2 including getTransfersByAddress, enhanced transactions, webhook CRUD/toggle, ZK compression, staking, wallet operations, Sender, the v3 JWT-based signup/checkout/payment flow, Admin project usage, and WebSocket subscriptions. The mainnet REST default follows v3's https://api-mainnet.helius-rpc.com/v0 host, while devnet enhanced REST continues to use https://api-devnet.helius.xyz/v0.

The legacy smart-transaction facade does not yet implement the v3 transaction-building contract: createSmartTransaction only fetches a blockhash, sendSmartTransaction does not compile or sign instructions, and getComputeUnits does not serialize a transaction for simulation. These three helpers cannot complete their advertised transaction flows. Prefer Solana Kit's transaction-message, signer, and Sender APIs until that surface is replaced. Remaining v3 gaps also include smart-transaction tip helpers and enhanced WebSocket account/transaction subscriptions.

pollTransactionConfirmation, sendBundleWithSender, and broadcastTransaction check on-chain execution errors before accepting confirmation. A failed transaction throws its corresponding SolanaError, even when its signature is confirmed or finalized. A higher commitment satisfies a lower requested commitment; confirmation alone never establishes that the intended transfer executed successfully.

The JSON-RPC and REST transports sanitize connection exceptions so API keys and URL user credentials are omitted from their messages. WebSocket connection errors also omit URL user credentials.

Preconfirmation subscriptions accept server-side filters and optional slot (bank created/frozen) events, use one connection per subscription, and expose getPreConfCoverage over HTTPS. Connection failure or closure rejects pending requests and closes notification streams without exposing endpoint credentials. PreconfWsClient accepts channelFactory for custom connectors; close() is safe to repeat.

Parsed Streams subscriptions buffer notifications, fail loudly when a consumer falls more than 10,000 notifications behind, reconnect with exponential backoff, and resubscribe active filters. Delivery is at most once; use onReconnect and ParsedStreamsReconnectInfo.lastSlot to backfill the gap from RPC when it matters.

Installation #

Install the package directly:

dependencies:
  "solana_kit_helius": ^0.8.1

If your app uses several Solana Kit packages together, you can also depend on the umbrella package instead:

dart pub add solana_kit

Inside this monorepo, Dart workspace resolution uses the local package automatically.

Documentation #

For architecture notes, getting-started guides, and cross-package examples, start with the workspace docs site and then drill down into the package README and API reference.

Usage #

Create a client with your API key, then call the sub-clients:

import 'package:solana_kit_helius/solana_kit_helius.dart';

Future<void> main() async {
  final helius = createHelius(HeliusConfig(apiKey: 'your-api-key'));

  // DAS API
  final asset = await helius.das.getAsset(
    GetAssetRequest(id: 'asset-id'),
  );

  // Priority fees
  final fees = await helius.priorityFee.getPriorityFeeEstimate(
    GetPriorityFeeEstimateRequest(
      accountKeys: ['account-key'],
    ),
  );

  // Enhanced transactions
  final txns = await helius.enhanced.getTransactions(
    GetTransactionsRequest(transactions: ['tx-sig']),
  );

  print(asset);
  print(fees);
  print(txns);
}

Parsed events and streams #

import 'package:solana_kit_helius/solana_kit_helius.dart';

Future<void> main() async {
  final helius = createHelius(HeliusConfig(apiKey: 'your-api-key'));

  // Decode signatures, history, or scan history by program/mint.
  final parsed = await helius.parsedEvents.parseTransactions(
    const ParseTransactionsRequest(transactions: ['transaction-signature']),
  );

  final page = await helius.parsedEvents.getTransactionHistory(
    const GetParsedTransactionHistoryRequest(address: 'wallet-address'),
  );

  // Real-time decoded transactions with a server-side filter.
  final subscription = await helius.parsedStreams.parsedTransactionSubscribe(
    const ParsedTransactionFilter(
      programs: ['JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4'],
      instructionNames: ['route'],
    ),
  );
  await for (final notification in subscription.notifications) {
    print(notification.value);
  }

  print(parsed);
  print(page.paginationToken);
}

Standard RPC and MEV Protect #

helius.kitRpc is a standard solana_kit_rpc client, so it can be passed to kit helpers. Set mevProtect: true to route every transaction away from validators statistically linked to sandwich attacks.

import 'package:solana_kit_helius/solana_kit_helius.dart';
import 'package:solana_kit_rpc/solana_kit_rpc.dart';

Future<void> main() async {
  final helius = createHelius(
    HeliusConfig(apiKey: 'your-api-key', mevProtect: true),
  );

  final slot = await helius.kitRpc.getSlot().send();
  print(slot);
}

Authenticated signup #

signup uses the developer API's wallet-signup response as a bearer JWT, then uses that JWT for project and checkout calls. Project API keys are only returned after subscription provisioning and are never reused as bearer tokens.

import 'package:solana_kit_helius/solana_kit_helius.dart';

Future<void> main() async {
  final helius = createHelius(HeliusConfig(apiKey: 'your-api-key'));

  final base64EncodedSolanaCliKeypair = 'base64-encoded-keypair';
  final result = await helius.auth.signup(
    SignupRequest.secretKey(
      secretKey: base64EncodedSolanaCliKeypair,
      plan: 'developer',
      email: 'ada@example.com',
      firstName: 'Ada',
      lastName: 'Lovelace',
    ),
  );

  print(result);
}

Only pay PaymentLink values received from a trusted Helius developer API. The payment helper rejects non-positive amounts, mismatched memo/intent IDs, and non-payment link kinds before constructing a transfer.

Configuration #

import 'package:http/http.dart' as http;
import 'package:solana_kit_helius/solana_kit_helius.dart';

void main() {
  // Mainnet (default)
  final mainnet = createHelius(HeliusConfig(apiKey: 'your-api-key'));

  // Devnet
  final devnet = createHelius(
    HeliusConfig(
      apiKey: 'your-api-key',
      cluster: HeliusCluster.devnet,
    ),
  );

  // Custom HTTP client (useful for testing)
  final withClient = createHelius(
    HeliusConfig(apiKey: 'your-api-key'),
    client: http.Client(),
  );

  print(mainnet);
  print(devnet);
  print(withClient);
}

WebSocket security defaults #

HeliusWebSocket enforces wss:// URLs and rejects localhost plus non-public IP literals by default. Use allowInsecureWs: true and allowPrivateHosts: true only for local development and controlled tests. The private-host check does not resolve DNS names, so do not accept arbitrary WebSocket URLs from untrusted input.

Sender transport security #

sendViaSender, sendBundleWithSender, senderFastUrl, and senderPingUrl require HTTPS by default. Use SenderRegion.defaultRegion for Helius's global HTTPS endpoint, which automatically routes to the nearest location.

Helius's regional Sender hosts use plain HTTP. Selecting one throws ArgumentError before any request is sent. Only controlled tests in non-release builds can opt in with allowInsecureHttpForTesting: true (on SendBundleOptions for bundles). This exposes signed transactions to network observers; release builds reject regional HTTP even with the override enabled. The exported senderEndpoints map lists the provider's raw URLs and does not validate transport.

Testing strategy #

The Helius package keeps DTO smoke coverage, but long-term confidence should come from higher-level contracts:

  • shared REST and JSON-RPC client contract tests cover request shaping, headers, query merging, and error mapping
  • endpoint tests focus on user-facing request/response behavior
  • websocket session tests cover subscribe, notification routing, unsubscribe, and close boundaries across concurrent subscriptions

When adding a new Helius surface, prefer extending one of these boundaries before adding large amounts of DTO-only roundtrip coverage.

Example #

Use example/main.dart as a runnable starting point for solana_kit_helius.

  • Import path: package:solana_kit_helius/solana_kit_helius.dart
  • This section is centrally maintained with mdt to keep package guidance aligned.
  • After updating shared docs templates, run docs:update from the repo root.

Maintenance #

  • Validate docs in CI and locally with docs:check.
  • Keep examples focused on one workflow and reference package README sections for deeper API details.