Registry / blockchain / helius-laserstream

helius-laserstream

JSON →
library0.3.2jsnpmunverified

A high-performance TypeScript client for streaming real-time Solana data via Laserstream (gRPC-based Yellowstone fork). Version 0.3.2 supports automatic reconnection, slot tracking, account/transaction/block/slot subscriptions, and configurable replay. N-API Rust bindings provide low latency. Differentiates from WebSocket-based clients by offering gRPC streaming with higher throughput and advanced control over keepalive, flow control, and compression.

npm install helius-laserstream
INSTALL
IMPORT
SIG · HELIUS-LASERSTREAM
H
helius-laserstream
blockchainjavascriptv0.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

subscribe
import { subscribe } from 'helius-laserstream'
const { subscribe } = require('helius-laserstream')
ESM-only; CommonJS require will fail unless using Node.js ESM-compatible import.
CommitmentLevel
import { CommitmentLevel } from 'helius-laserstream'
Enum with values like CONFIRMED, FINALIZED, PROCESSED.
LaserstreamConfig
import { LaserstreamConfig } from 'helius-laserstream'
import LaserstreamConfig from 'helius-laserstream'
Named export, not default. TypeScript type.
ChannelOptions
import { ChannelOptions } from 'helius-laserstream'
Optional config for gRPC channel options.
CompressionAlgorithms
import { CompressionAlgorithms } from 'helius-laserstream'
Used with ChannelOptions for gRPC compression.

Sets up a basic slot subscription using Laserstream gRPC client with auto-reconnection.

import { subscribe, CommitmentLevel, LaserstreamConfig } from 'helius-laserstream'; async function main() { const config: LaserstreamConfig = { apiKey: process.env.HELIUS_API_KEY ?? '', endpoint: 'https://laserstream-mainnet-tyo.helius-rpc.com', }; const request = { slots: { client: {} }, commitment: CommitmentLevel.CONFIRMED, }; const stream = await subscribe( config, request, async (update) => { console.log('Received:', update); }, async (error) => { console.error('Error:', error); } ); // Optional: await stream.done(); } main().catch(console.error);
Debug
Known issues
gotchaThe subscribe function returns a stream object that must be awaited before the connection is established. Do not call .catch() on the returned promise before awaiting.
fix
Use await subscribe(...) and handle errors via the error callback or .catch() on the promise.
affects: >=0.1.0
deprecatedThe LaserstreamConfig parameter 'replay' default behavior may change in future versions. Use explicit replay: true/false.
fix
Set config.replay = true (enabled) or false (disabled) explicitly.
affects: >=0.2.0
gotchaChannelOptions fields like connectTimeoutSecs and keepAliveTimeoutSecs are in seconds, not milliseconds. Common mistake to pass milliseconds.
fix
Use seconds (e.g., 20 for 20 seconds, not 20000).
affects: >=0.3.0
gotchaThe gRPC client uses N-API and may fail to load in environments without native addon support (e.g., some serverless runtimes).
fix
Ensure runtime supports native Node.js addons (e.g., AWS Lambda with N-API enabled).
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'helius-laserstream'
Package not installed or incorrect import path.
fix
Run 'npm install helius-laserstream' and use correct import.
TypeError: subscribe is not a function
Default import instead of named import.
fix
Use 'import { subscribe } from 'helius-laserstream'' instead of 'import subscribe from ...'.
Error: connect ECONNREFUSED
Invalid endpoint or network issue.
fix
Verify the Laserstream endpoint URL and ensure you have network access.
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
42 hits · last 30 days
node
36
OpenAI (training)
1
Resources
helius-laserstream — npm install helius-laserstream · libregistry