
Product
Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.
@chainstream-io/sdk
Advanced tools
Official TypeScript/JavaScript client library for ChainStream API.
npm install @chainstream-io/sdk
# or
pnpm add @chainstream-io/sdk
# or
yarn add @chainstream-io/sdk
import { ChainStreamClient } from '@chainstream-io/sdk';
// Create client
const client = new ChainStreamClient('your-access-token', {
autoConnectWebSocket: false
});
// Subscribe to token stats via WebSocket
const unsubscribe = client.stream.subscribeTokenStats({
chain: 'solana',
tokenAddress: 'So11111111111111111111111111111111111111112',
callback: (data) => {
console.log('Token stats:', data);
}
});
// Unsubscribe when done
unsubscribe.unsubscribe();
Ranking token metric list streams are deprecated and no longer published by the server. For ranking or new-pool cards, collect the token addresses first, then subscribe to per-token metric streams in one batch:
const unsubs = client.stream.batchSubscribe(() =>
tokenAddresses.flatMap(tokenAddress => [
client.stream.subscribeTokenStats({ chain: 'sol', tokenAddress, callback: onStats }),
client.stream.subscribeTokenHolders({ chain: 'sol', tokenAddress, callback: onHolders }),
client.stream.subscribeTokenSupply({ chain: 'sol', tokenAddress, callback: onSupply }),
client.stream.subscribeTokenLiquidity({ chain: 'sol', tokenAddress, callback: onGeneralStat }),
]),
);
For new-pool experiences, subscribe with subscribeNewPool({ chain: 'sol' }), read the token address from the pool event, batch subscribe the token metrics above, and use subscribeDexPoolBalance for pool liquidity updates.
Prediction PNL realtime uses compact wire fields, but the SDK callback maps them back to the same summary, dailyPnls, and changedTokens field names returned by GET /v1/prediction/wallets/{wallet}/pnl.
const wallet = '0x674f8fc1ee68c44e988e25316984cd7ea354ca64';
const tag = 'worldcup_2026';
const initial = await client.prediction.getPredictionWalletPnl(wallet, {
tag,
limit: 50,
sort_by: 'totalPnl',
order: 'desc',
});
renderPredictionPnl(initial.summary, initial.tokens);
const unsubscribeTag = client.stream.subscribePredictionWalletPnl({
wallet,
tag,
callback: event => {
renderPredictionPnlSummary(event.summary);
mergeChangedTokens(event.changedTokens);
},
});
const unsubscribeToken = client.stream.subscribePredictionWalletPnl({
wallet,
tokenId: '115556263888245616435851357148058235707004733438163639091106356867234218207169',
callback: event => {
mergeChangedTokens(event.changedTokens);
},
});
Wallet-global prediction PNL channels are available through subscribePredictionWalletPnl({ wallet }), but the backend keeps them disabled by default to avoid unnecessary global aggregation and push load.
For detailed documentation, visit https://docs.chainstream.io
# Install dependencies
pnpm install
# Build
pnpm build
# Run tests
pnpm test
# Generate OpenAPI client
pnpm orval
# Lint
pnpm lint
# Format
pnpm format
MIT
FAQs
API and Stream client for ChainStream
The npm package @chainstream-io/sdk receives a total of 584 weekly downloads. As such, @chainstream-io/sdk popularity was classified as not popular.
We found that @chainstream-io/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.