SDK and public API reference
Package:@slip/sdk
AI Rulebook compiler
compileMarketRule(options) calls an AI SDK language model with generateText and
Output.object(). Its Zod schema permits only semantic concepts that Slip can map to canonical
TxLINE leaves.
The structured output contains:
supportedand a nullable rejection reason;- one semantic expression kind: team stat, total, home-away difference, or team minimum;
- one TxLINE concept: goals, yellow cards, red cards, or corners;
- one documented period;
- two to five unique outcome labels;
- two to eight ordered, contiguous integer bands;
- a human-readable Rulebook sentence.
compileMarketRuleOutput deterministically maps its semantic output to TxLINE keys and calls
validateRule. Unsupported, ambiguous, non-integer, incomplete, or incoherent output throws
MarketRuleCompilationError before an instruction can be built.
RULEBOOK_PROMPT_SKILLS separates stat selection, expression selection, outcome partitioning, and
settlement safety. RULEBOOK_PROMPT_EXAMPLES supplies diverse five-band, BTTS, 1X2, red-card, and
unsupported-player demonstrations. buildRulebookSystemPrompt() assembles both for every provider;
no example bypasses schema or deterministic validation.
Deterministic construction
These functions do not call a model:
Validation mirrors program constants: five outcomes, eight bands, 48 UTF-8 bytes per label,
500 fee bps, 200 resolver-tip bps, and a 1,000,000-unit minimum stake.
TxLINE client
TxlineClient is browser-safe and uses the real TxLINE HTTP boundary. It owns short-lived guest JWT
acquisition, concurrent JWT reuse, one renewal after HTTP 401, API-token headers, timeouts, JSON
validation, and precise boundary errors.
Activation accepts real
subscribe() and signMessage() callbacks because wallet and transaction
authority remain application-owned. It rejects missing subscriptions, non-64-byte signatures, and
invalid activation responses.
Solana client
Instruction builders
SlipClient exposes:
createMarketIxbuyTicketIxresolveMarketIxclaimTicketIxvoidMarketIx
TransactionInstruction objects at the isolated Anchor boundary.
@slip/sdk/generated contains the Kit-native Codama output.
Executed transactions
The matching high-level methods arecreateMarket, buyTicket, resolveMarket, claimTicket, and
voidMarket. They use executeInstructions to:
- obtain a recent blockhash and last-valid block height;
- assemble required instructions and compute budget;
- request the application-owned authority signature;
- simulate with signature verification;
- submit without skipping preflight;
- confirm using the blockheight strategy;
- return signature, simulation compute units, and confirmation slot.
keypairAuthority adapts a server-side Keypair. Browser wallets can implement
TransactionAuthority or continue using the instruction builders with Wallet Standard tooling.
Buy, resolve, and claim prepend idempotent SPL-token ATA creation for required user, resolver,
treasury, and refund destinations.
Accounts
getMarket,getTicket,listMarkets,listTicketslistMarketsPage,listTicketsPagewatchMarkets,watchTicketsmarketAddress,ticketAddress,rootsPda
getProgramAccounts scan because it provides no server-side limit or cursor. The SDK states this
explicitly; production indexing requires a real Geyser or indexed RPC boundary.
Money helpers
All token arithmetic uses
bigint. No floating-point token calculation enters the SDK.
Public HTTP API
All routes are uncached and CORS-readable. Live-boundary failures do not return sample data.
The compile route returns 422 when language cannot become a supported market and 503 when AI or
TxLINE configuration is unavailable. Market creation controls remain absent when either the unified
program or the server-side compiler is unavailable.