Skip to main content
PolyNode provides official SDKs for TypeScript and Rust. Both wrap the full REST API and WebSocket streaming interface with typed responses, auto-reconnection, and zlib compression support.

TypeScript / Node.js

npm install polynode-sdkZero runtime dependencies. ESM + CJS. Node 18+.

Rust

polynode = "0.3"Async with tokio. Typed events via serde.

Features

Local Cache

SQLite-backed local storage. Backfill wallet history in seconds, query trades and positions instantly with zero API calls.

Short-Form Markets

Auto-rotating streams for 5m, 15m, and 1h crypto prediction markets. Includes price-to-beat, odds, and liquidity.

WebSocket Streaming

Builder-pattern subscriptions with 9 presets, 12 filter dimensions, and transparent compression.

Orderbook

Real-time orderbook data with local state management, filtered views, and 108k+ markets.

REST API

Typed methods for all 25 REST endpoints. Markets, pricing, settlements, wallets, enriched data.

RPC Proxy

JSON-RPC through PolyNode’s optimized Polygon endpoint with validator-targeted TX submission.

What the SDKs Cover

FeatureTypeScriptRust
Local cache (SQLite)YesYes
REST API (25 endpoints)YesYes
WebSocket streamingYesYes
Short-form markets (auto-rotation)YesYes
All 10 event typesTyped interfacesTyped structs + enum
Subscription filtersBuilder patternBuilder pattern
Orderbook streamingYesYes
Local orderbook stateLocalOrderbookLocalOrderbook
OrderbookEngine (views)YesYes
Zlib compressionTransparentTransparent
Auto-reconnectExponential backoffExponential backoff
Enriched data (leaderboard, trending, profiles)YesYes
RPC proxyYesYes

Quick Comparison

import { PolyNodeWS } from 'polynode-sdk';

const ws = new PolyNodeWS('pn_live_...', 'wss://ws.polynode.dev/ws');

// Short-form: auto-rotating 15m crypto markets
const stream = ws.shortForm('15m', { coins: ['btc', 'eth'] });
stream.on('rotation', (r) => {
  for (const m of r.markets) {
    console.log(`${m.coin}: beat $${m.priceToBeat} | ${(m.upOdds * 100).toFixed(0)}% up`);
  }
});
stream.on('settlement', (e) => console.log(e.outcome, e.taker_size));

// Manual subscription
const sub = await ws.subscribe('settlements')
  .minSize(1000)
  .send();
sub.on('settlement', (e) => console.log(e.taker_side, e.taker_size));

Don’t Need an SDK?

The PolyNode API uses standard HTTP and WebSocket protocols. You can use any HTTP client or WebSocket library directly. See the Quickstart for raw examples in cURL, Python, and JavaScript.