PredixtPredixt
@predixia/sdkv0.1.0

Predixt SDK

Read markets, place bets, settle and claim. A TypeScript SDK on top of @solana/kit that wraps the Predixt program behind a tiny, fully-typed client.

Install

$ pnpm add @predixia/sdk @solana/kit

Live in four lines

Point the client at any RPC and you are ready to read markets and send transactions. No boilerplate, no manual account wrangling.

Read the protocol docs
setup.ts
import { createSolanaRpc, createSolanaRpcSubscriptions } from "@solana/kit";
import { PredixtClient, Side, computeOdds } from "@predixia/sdk";

const sdk = new PredixtClient({
  rpc: createSolanaRpc("https://api.mainnet-beta.solana.com"),
  rpcSubscriptions: createSolanaRpcSubscriptions("wss://api.mainnet-beta.solana.com"),
});

Fully typed client

Generated from the on-chain IDL. Every account, instruction and enum is type-safe.

PDAs & ATAs handled

Build instructions without deriving program addresses or token accounts by hand.

Live subscriptions

Subscribe to a market and get pushed updates the moment the odds move.

Parimutuel math built in

Odds, payouts and settlement helpers that match the program byte-for-byte.

Read markets & odds

// Read every open market and its live odds
const markets = await sdk.getMarkets();

for (const m of markets) {
  const { probYes } = computeOdds(m.data.yesTotal, m.data.noTotal);
  console.log(m.address, `${Math.round(probYes * 100)}% YES`);
}

Place a bet

// Place a bet (signer = a Kit wallet / TransactionSigner)
const ix = await sdk.placeBet(signer, market, Side.Yes, 1_000_000n);
const signature = await sdk.send(signer, [ix]);

Stream live odds

// Stream live odds as money flows in
const ctrl = new AbortController();
await sdk.subscribeMarket(market, (m) => {
  console.log(computeOdds(m.data.yesTotal, m.data.noTotal));
}, ctrl.signal);

Build on Predixt

Bots, dashboards, alt frontends. If it speaks Solana, it can speak Predixt.