@mutinylabs/slip
v0.2.0
Published
Slip SDK — write a football rule in plain English, lock it on Solana, settle it with a TxLINE proof. Zero UI deps; node + browser.
Downloads
23
Maintainers
Readme
@mutinylabs/slip
Infrastructure SDK for AI-compiled, TxLINE-settled parimutuel markets on Solana.
Public boundaries
- The default
@mutinylabs/slipentry is browser safe and Kit based. SlipClient.compileRulebookcalls a configured real Slip server API and preserves consumer labels exactly.@mutinylabs/slip/aiuses AI SDK structured output to interpret natural language on a server.@mutinylabs/slip/txlineowns authenticated TxLINE fixtures, snapshots, and proofs.createGroqRuleModelruns it against Groq with an explicit server-side API key.compileMarketRuleOutputmaps semantic output to canonical TxLINE keys and rejects invalid partitions.RULEBOOK_PROMPT_SKILLSandRULEBOOK_PROMPT_EXAMPLESassemble reusable domain guidance and few-shot demonstrations.TxlineClientowns guest JWT renewal, fixture and score snapshots, proof retrieval, and token activation.- The public
SlipClientbuilds all five generated Kit instructions, verifies references, reads accounts, and closes browser subscriptions. ./generatedexports the checked-in Codama client rendered from the Anchor IDL.
The default package installs only @solana/kit. Server and Anchor entry points declare their
runtime libraries as optional peers, so a browser or automated reader does not inherit Anchor,
web3.js, SPL Token, or AI providers merely by installing the SDK. Consumers of /ai,
/txline, or /anchor install the optional peers used by that entry point explicitly.
The model never supplies fixture IDs, stat keys, fees, stakes, or settlement values. Model output is untrusted until the deterministic validator accepts it.
Compile a Rulebook
import { compileMarketRule } from "@mutinylabs/slip/ai";
import { TxlineClient } from "@mutinylabs/slip/txline";
const txline = new TxlineClient({
origin: process.env.TXLINE_DEVNET_ORIGIN,
apiToken: process.env.TXLINE_API_TOKEN,
});
const fixture = await txline.getFixture(18_209_181);
const rule = await compileMarketRule({
model: process.env.SLIP_RULE_MODEL!,
fixture,
text: "Will both teams score before halftime?",
});AI Gateway credentials belong on a server. Browser applications should call a server route such as
Slip's POST /api/v1/compile rather than embed provider credentials.
Build a public-client action
import { address } from "@solana/kit";
import { createSlipClient, parseAmount } from "@mutinylabs/slip";
const client = createSlipClient({
network: "devnet",
rpcUrl: process.env.SOLANA_RPC_DEVNET!,
websocketUrl: process.env.SOLANA_WS_DEVNET,
programAddress: address(process.env.SLIP_PROGRAM_ID!),
settlementMint: address(process.env.SLIP_SETTLEMENT_MINT!),
});
if (!(await client.supportsUnifiedMarkets())) throw new Error("Unified Slip binary unavailable");
const prepared = await client.buyTicket({
market: address(marketAddress),
buyer: address(walletAddress),
outcomeIndex: 2,
amount: parseAmount("3.5"),
nonce: 1n,
});The returned Kit instructions are real and include required idempotent ATA creation. The application retains signing, simulation, submission, and confirmation authority through Wallet Standard or its server signer; the public SDK never invents a successful transaction.
Reads and subscriptions
getMarket,getTicket,listMarkets,listWalletTicketswatchMarketwith an explicit teardown functionverifyReference,marketAddress,ticketAddress
Core Solana RPC has no server-side getProgramAccounts pagination. SDK cursor pages are deterministic
but perform one program-account scan. Operators with large account sets should back the same public
contract with a real Geyser or RPC indexer; the SDK does not pretend local slicing is provider-side pagination.
Verification
pnpm --filter @mutinylabs/slip test
pnpm --filter @mutinylabs/slip typecheck
pnpm --filter @mutinylabs/slip build
pnpm --filter @slip/program test:surfpoolLive boundaries are explicit commands because they require credentials:
pnpm --filter @mutinylabs/slip test:ai
pnpm --filter @mutinylabs/slip test:txline