HTTP SDK
The @raptortrade/solana SDK is the recommended way to use the HTTP transport: typed market classes return fully typed data. It is built on the low-level @raptortrade/client, documented at the end.
Install
npm install @raptortrade/solana
# or: pnpm add @raptortrade/solanaConnect
Use connect_http to open an HTTP client, then build market helpers on top of it. See HTTP Authentication.
import { connect_http } from "@raptortrade/solana";
// Connect to the HTTP transport
const client = connect_http({
url: "https://rpc.raptor.trade",
token: process.env.RAPTOR_TOKEN,
});Query
Create a market with the topics you need, then call get(options) for fully typed data. Selectors are passed by name (base, quote, mint, limit), and windowed topics take duration - the SDK maps it to the wire window param.
import { connect_http, Market } from "@raptortrade/solana";
const client = connect_http({
url: "https://rpc.raptor.trade",
token: process.env.RAPTOR_TOKEN,
});
// Pick the topics you need
const market = Market.create(client, ["ohlcv"]);
// Typed query - returns Ohlcv[]
const candles = await market.ohlcv.get({
base: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
duration: "1m",
limit: 100,
});Markets and topics
- DEX market -
Market. Exposestrades,ohlcv,block,twap,vwap,volume,token. - PriorityFee -
block,fee,stats,cluster,recommendation,top_txs,top_accounts,account_block,account_stats,account_recommendation.
Each topic decodes into its typed data (Ohlcv, Trade, Twap, Vwap, Volume, Block, Token); priority-fee topics decode into their own data types. Every data point carries a numeric id.
Low level
@raptortrade/solana is built on the low-level @raptortrade/client transport (and re-exports its connect_http). To write the method and params yourself, call the client directly - it returns data as plain JSON, with numbers as strings and the wire window param. query_batch sends up to 64 queries in one request, each result tagged with ok so one failure does not compromise the rest.
import { connect_http } from "@raptortrade/client";
// @raptortrade/client is the transport @raptortrade/solana wraps
const http = connect_http({
url: "https://rpc.raptor.trade",
token: process.env.RAPTOR_TOKEN,
});
// method + params over the wire (note: window, not duration)
const rows = await http.query("solana::market::ohlcv", {
base: "Dez...",
window: "1m",
limit: 100,
});
// batch up to 64 queries in one request
const results = await http.query_batch([
{ method: "solana::market::ohlcv", params: { base: "Dez...", window: "1m" } },
{ method: "solana::market::token", params: { mint: "Dez..." } },
]);Browse the Methods Catalog for every method and its params.
