rise/ts- TypeScript SDK with HTTP route clients, a unified Phoenix client, exchange metadata caching, instruction builders, order-packet helpers, WebSocket adapters, trader-state stores, and margin helpers.rise/rust- Rust workspace centered on thephoenix-risecrate, with typed HTTP and WebSocket clients,PhoenixMetadata,PhoenixTxBuilder, trader-state containers, margin math, and low-level instruction builders.
Install
TypeScript
Rust
Create A Client
Which Client To Use
Prefer the exchange cache for market parameters. In TypeScript, wait for
client.exchange.ready() and read markets with client.exchange.market(symbol) or client.exchange.marketMetadata(symbol). In Rust, build PhoenixMetadata from http.get_exchange() and update it with live market stats through metadata.apply_market_stats(&stats).
Prefer trader-state primitives for snapshots and deltas. In TypeScript, createTraderStateStore(client) maintains local trader resources and exposes marginInputs(). In Rust, Trader::apply_update(&msg) applies traderState snapshots and deltas to the local container.
First Reads
- TypeScript HTTP client example
- TypeScript unified client example
- Rust HTTP client example
- Rust Phoenix client example
Reading Order
- Auth - optional for most public reads, required for referral onboarding and notifications.
- Trader Onboarding - create or activate a trader account.
- Accounts - understand authority, position authority, cross accounts, isolated accounts, and trader-state streams.
- Collateral - move USDC into and out of Phoenix trader accounts.
- Exchange Data - exchange cache, market metadata, L2 orderbooks, market stats, and market calendars.
- WS/API Best Practices - when to stream, when to poll, and how to avoid rate-limit and drift issues.
- Orders - build order instructions and manage stop losses and conditionals.
- Margin - join market prices, compute account health, margin, and liquidation estimates.
- On-Chain Programs and LiteSVM Testing - program integrations and local tests.
REST, WebSocket, and RPC
Use REST for startup snapshots, historical data, and server-built transaction workflows. Use WebSocket streams for current market state, exchange deltas, orderbooks, and trader state. Use Solana RPC for blockhashes, simulation, transaction submission, confirmation, and custom account reads. The usual production pattern is:- Fetch HTTP snapshots on startup.
- Subscribe to WebSocket streams.
- Apply exchange and trader deltas locally through SDK caches.
- Build and sign instructions with the user’s wallet or signer service.
- Confirm transactions through Solana RPC.
- Reconcile from trader-state streams, falling back to fresh HTTP snapshots after reconnects or sequence gaps.