Agent API
sports-workbench exposes 6 methods on the SolanaAgentKit interface. Each method returns a Verifiable Settlement Receipt alongside its payload — agents can read the result, present it to a user, and ship the proof.
install
Add the plugin to your SolanaAgentKit instance. The plugin auto-registers all 6 methods on the agent.
import { TxlinePlugin } from "@srivtx/sports-workbench";
import { SolanaAgentKit } from "solana-agent-kit";
const agent = new SolanaAgentKit({ wallet, network: "devnet" });
agent.use(new TxlinePlugin({ apiToken: process.env.TXLINE_API_TOKEN }));backtestOdds
READReplay historical TxLINE odds against any of the 4 strategies. Returns a list of signals plus aggregate PnL, hit rate, and a Verifiable Settlement Receipt per signal.
agent.methods.backtestOdds({
strategy: "sharpDetector",
threshold: 0.5,
fixtureId: 17588234,
"kw">from: 1782400000000,
to: 1782500000000,
}): Promise<BacktestResult>{
"range": { "from": "2026-06-24 12: 00: 00Z", "to": "2026-06-25 12: 00: 00Z" },
"filter": { "strategy": "sharpDetector", "threshold": 0.5, "fixtureId": 17588234 },
"signals": 3,
"hitRate": 0.67,
"pnl": 1.24,
"signals_detail": [
{
"id": "sig_001",
"fixtureId": 17588234,
"market": "1X2 home",
"deltaPct": 40.61,
"receipt": { "verified": true, "merkleRoot": "0x7a9f3b..." }
}
]
}{ signals: Signal[], pnl: f64, hitRate: f64, receipts: Receipt[] }findSharpMove
READScan the live TxLINE SSE feed for a single fixture and emit signals the moment a threshold move is detected. Persists receipts to .sports-workbench-state.json.
agent.methods.findSharpMove({
fixtureId: 17588234,
strategy: "sharpDetector",
threshold: 0.5,
}): Promise<{ signals: Signal[], fired: number }>{
"strategy": "sharpDetector",
"fixtureId": 17588234,
"fired": 3,
"signals": [
{
"id": "sig_001",
"market": "O/U 1.5 home goals",
"deltaPct": 40.61,
"oddsBefore": 1.85,
"oddsAfter": 2.60,
"receipt": { "verified": true }
}
]
}Stream<Signal>getOdds
READFetch the current canonical odds for a fixture across all market types. Each call includes a Merkle proof so callers can verify the data on Solana.
agent.methods.getOdds({
fixtureId: 17588234,
marketType: "MATCH_RESULT_3WAY",
}): Promise<{ fixture: Fixture, markets: Market[] }>{
"fixtureId": 17588234,
"competition": "UEFA World Cup 2026 Qualifier",
"home": "BRA", "away": "ARG", "status": "live", "score": { "home": 0, "away": 0 },
"markets": [
{ "type": "MATCH_RESULT_3WAY", "home": 2.10, "draw": 3.40, "away": 3.60, "deltaPct": 12.4 }
],
"receipt": { "verified": true, "merkleRoot": "0x7a9f3b..." }
}{ fixtureId, markets: Market[], receipt: Receipt }getFixtures
READList fixtures for a competition (or all 8 leagues + World Cup). Free tier covers 8 soccer leagues; 7-day replay available for paid.
agent.methods.getFixtures({
competition: "worldcup",
status: "live",
}): Promise<{ count: number, fixtures: Fixture[] }>{
"count": 6,
"live": 3,
"upcoming": 2,
"fixtures": [
{ "id": 18172280, "home": "GER", "away": "ESP", "status": "live", "score": { "home": 1, "away": 1 }, "minute": 67 }
]
}Fixture[]proveOdds
PROOFResolve a (fixture, messageId) pair against the on-chain Merkle root. Returns a signed attestation suitable for downstream use (settlement, audit, dispute).
agent.methods.proveOdds({
fixtureId: 17588234,
messageId: "1835131630:00003:000063-10021-stab",
}): Promise<Receipt>{
"messageId": "1835131630: 00003: 000063-10021-stab",
"fixtureId": 17588234,
"programId": "6pW64gN1s2uqjHkn1unFeEjAwJkPGHoppGvS715wyP2J",
"subTreeRoot": "0x4a8f...",
"merkleRoot": "0x7a9f3b...",
"batchRootsPda": "ABC4…WXYZ (epochDay=20364)",
"subTreeProof": "6 sibling hashes · SHA-256",
"mainTreeProof": "12 ancestor hashes",
"verifyCall": "txoracle::validate_odds · compute=1,384,291",
"verified": true
}Receipt (programId, batchRootsPda, subTreeProof, mainTreeProof)describeStrategy
READReturn the natural-language + mathematical definition of a strategy. Useful for agent planning, prompt engineering, and audit trails.
agent.methods.describeStrategy({
strategy: "sharpDetector",
}): Promise<{ name, summary, math, params }>{
"name": "sharpDetector",
"summary": "Fires when max |deltaPct| across any market exceeds the threshold.",
"math": "if max(|Δprice_i|) over window W > threshold: emit signal",
"params": { "threshold": "f64 (default 0.5)", "window": "u64 ticks (default 50)" }
}{ name, summary, math, params: Param[] }