Arming a wire, step by step
- 1.
list_events: pick an open event and one of its output assets. - 2.
register_trigger: the condition on that event; you get a fingerprint. - 3.
build_arm_tx: the unsigned arm transaction for the owner's wallet, and the wire's address. - 4. The owner's wallet signs and sends it.
- 5.
get_wire until it reads armed. build_cancel_tx returns the whole deposit while it is armed.
import { Connection, VersionedTransaction } from "@solana/web3.js";
const r = await fetch("https://settripwire.fun" + "/api/agent/v1/tx/arm", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(armArgs),
}).then((x) => x.json());
if (!r.ok) throw new Error(r.error.code + ": " + r.error.message);
const tx = VersionedTransaction.deserialize(Buffer.from(r.data.tx, "base64"));
tx.sign([ownerKeypair]); // your wallet signs, on your side
const sig = await new Connection(RPC_URL).sendRawTransaction(tx.serialize());
// then poll /api/agent/v1/wires/<r.data.wire> until state is "armed"A Model Context Protocol server over streamable HTTP at https://settripwire.fun/api/mcp. Its tools are the operations below, with the same answers. Add it to an MCP client:
{
"mcpServers": {
"tripwire": {
"type": "http",
"url": "https://settripwire.fun/api/mcp"
}
}
}Or call it directly:
curl -s -X POST 'https://settripwire.fun/api/mcp' \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'HTTP API
Base https://settripwire.fun/api/agent/v1. JSON in, JSON out. Every answer is { ok: true, data } or { ok: false, error: { code, message, details? } }. Token amounts are base units as strings.
GET/api/agent/v1/eventstool: list_events
Events a wire can be armed on, with their live odds, release or sentence state, armed wire count and the output assets offered.
kind Only events of this kind. One of odds, release, sentence.status Event status, default open. One of open, met, closed.
curl -s 'https://settripwire.fun/api/agent/v1/events?kind=odds'
GET/api/agent/v1/events/{id}tool: get_event
One event by id. With quote=1, inputMint, amount and outputMint it adds an indicative swap quote (never used as the worst price).
id required Event id from list_events, e.g. odds-poly-<marketId>.quote Set to 1 to add an indicative quote. One of 1.inputMint Input mint for the quote.amount Input amount for the quote, base units as a string.outputMint Output mint for the quote.
curl -s 'https://settripwire.fun/api/agent/v1/events/odds-poly-123'
GET/api/agent/v1/wirestool: list_wires
Every wire one wallet armed on the current network, read from chain: state, vault, receipt id. Trigger texts are left out (they need the owner's signature).
owner required Owner wallet address (base58).state Only wires in this state. One of armed, tripped, cancelled, expired.
curl -s 'https://settripwire.fun/api/agent/v1/wires?owner=%3Cwallet%20address%3E'
GET/api/agent/v1/wires/{address}tool: get_wire
One wire by its address. Not found until the arm transaction has landed and been indexed (poll for up to 60 s after sending).
address required Wire address returned by build_arm_tx.
curl -s 'https://settripwire.fun/api/agent/v1/wires/<wire address>'
GET/api/agent/v1/receipts/{id}tool: get_receipt
The receipt of a tripped wire: the trigger text and fingerprint, the sources seen, the gap from event to fire, the fill (input.spent, output.received) and the fee (input.fee, with its burnShare and keeperShare).
id required Receipt id (a wire's receiptId).
curl -s 'https://settripwire.fun/api/agent/v1/receipts/<receipt id>'
POST/api/agent/v1/triggerstool: register_trigger
Registers a trigger on a listed event and returns its fingerprint, which build_arm_tx needs. odds: side above|below and line 0-100 (YES %). release: side above|below|at_or_above|at_or_below and line in the release unit. sentence: no side or line.
eventId required Event id from list_events.kind required Must equal the event's kind. One of odds, release, sentence.side odds: above or below; release: any of the four. One of above, below, at_or_above, at_or_below.line odds: YES percent between 0 and 100; release: the value in the release unit.
curl -s -X POST 'https://settripwire.fun/api/agent/v1/triggers' \
-H 'content-type: application/json' \
-d '{"eventId":"odds-poly-123","kind":"odds","side":"above","line":60}'POST/api/agent/v1/tx/armtool: build_arm_tx
Builds the unsigned arm transaction for the owner's wallet (fee payer = owner). The owner signs and sends it; the deposit then waits in a program vault until the event happens, the wire expires or the owner cancels. Amounts are base units as strings.
owner required Owner wallet address; it signs and pays.fingerprint required 64 hex characters from register_trigger.inputMint required Input mint: USDC or wrapped SOL (So11111111111111111111111111111111111111112).amount required Input amount, base units as a string, inside the program's per-wire limits.outputMint required Output mint, one of the event's outputs.minOutput required Worst accepted output, base units as a string; the trip fails rather than fill below it.expiryDays 1 to 365, default 30.
curl -s -X POST 'https://settripwire.fun/api/agent/v1/tx/arm' \
-H 'content-type: application/json' \
-d '{"owner":"<wallet address>","fingerprint":"<64 hex>","inputMint":"<USDC mint>","amount":"1000000","outputMint":"So11111111111111111111111111111111111111112","minOutput":"5000000","expiryDays":7}'POST/api/agent/v1/tx/canceltool: build_cancel_tx
Builds the unsigned cancel transaction for an armed wire. The owner signs and sends it; the whole input and the rent return to the owner.
owner required Owner wallet address.wire required Wire address.
curl -s -X POST 'https://settripwire.fun/api/agent/v1/tx/cancel' \
-H 'content-type: application/json' \
-d '{"owner":"<wallet address>","wire":"<wire address>"}'