@lightconexyz/lightcone-sdk
v0.2.0
Published
TypeScript SDK for the Lightcone Protocol
Maintainers
Readme
Lightcone TypeScript SDK v2
TypeScript SDK v2 for the Lightcone protocol, rebuilt to mirror the Rust v2 layered architecture.
Installation
npm install @lightconexyz/lightcone-sdkArchitecture
The SDK is organized in 5 layers:
shared,domain,program,error,networkauth,privyhttpwsclient(LightconeClient)
Quick Start
import { LightconeClient, Resolution } from "@lightconexyz/lightcone-sdk";
const client = LightconeClient.builder()
.baseUrl("https://tapi.lightcone.xyz")
.wsUrl("wss://tws.lightcone.xyz/ws")
.build();
const markets = await client.markets().get(undefined, 20);
const orderbook = await client.orderbooks().get("orderbook_id", 20);
const trades = await client.trades().get("orderbook_id", 50);
const candles = await client.priceHistory().get("orderbook_id", Resolution.Minute1);Main Entry Points
LightconeClient+LightconeClientBuilderclient.markets(),client.orderbooks(),client.orders(),client.positions()client.trades(),client.priceHistory(),client.admin(),client.auth(),client.privy(),client.referrals()client.ws()for WebSocket streaming with typed subscribe/unsubscribe payloads
Program Module
program/ remains the on-chain toolkit (PDAs, instructions, account deserialization, order utilities), with v2 envelope builders now exposed:
LimitOrderEnvelopeTriggerOrderEnvelope
Notes
- Browser cookie-based auth is supported via
credentials: "include". - Native/Node auth token injection uses
Cookie: auth_token=...internally. - Orderbook decimals are memoized in the high-level client cache.
License
MIT
