sigil
@sigil/sdk · v0.1.0

The TypeScript SDK for Ritual primitives.

Encoders, decoders, and code-export helpers for every Ritual precompile — JQ, HTTP, LLM, Image, Audio, Video, ZK, FHE, agents, the works. Extracted from the Sigil playground.

install
bun add @sigil/sdk viem
# or npm / pnpm / yarn

Available now from the monorepo. npm publish lands once the API surface is reviewed by the community.

highlights
  • · 16 precompile namespaces
  • · ESM + CJS dual build
  • · Tree-shakable subpath imports
  • · Solidity + viem code-export
  • · Strict TS, zero any
  • · MIT licensed
quick start
import { ritualTestnet, jq, http, llm, callPrecompile } from "@sigil/sdk";
import { createPublicClient, http as viemHttp } from "viem";

const client = createPublicClient({
  chain: ritualTestnet,
  transport: viemHttp(),
});

// Sync precompile — returns inline.
const result = await jq.runJQ({
  expression: ".data.price",
  json: '{"data":{"price":42000}}',
  outputType: 1, // uint256
});
console.log(result.decoded); // 42000n

// SPC precompile — encode + submit via wallet for real result.
const encoded = http.encodeHTTPInput({
  executor: "0x...",
  url: "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd",
  method: 1,
  headers: [{ key: "Accept", value: "application/json" }],
  body: "",
  ttl: 100,
  piiEnabled: false,
});
precompile namespaces
jq
0x0803sync
http
0x0801SPC
llm
0x0802SPC
ed25519
0x0009sync
secp256r1
0x0100sync
dkms
0x081BSPC
onnx
0x0800sync
image
0x0818two-phase
audio
0x0819two-phase
video
0x081Atwo-phase
longHttp
0x0805two-phase
zk
0x0806two-phase
fhe
0x0807two-phase
sovereignAgent
0x080Ctwo-phase
persistentAgent
0x0820two-phase
scheduler
0x56e7…system

Each namespace exports encodeXxxInput, runXxxSimulation, a decoder, and exportXxxSolidity / exportXxxViem helpers.

receipt + lifecycle
import { extractSpcOutput, asyncJobTrackerAbi, ASYNC_JOB_TRACKER_ADDRESS } from "@sigil/sdk";

// Decode SPC settlement from receipt.
const receipt = await client.getTransactionReceipt({ hash });
const output = extractSpcOutput(receipt); // Hex | null

// Watch two-phase callbacks.
client.watchContractEvent({
  address: ASYNC_JOB_TRACKER_ADDRESS,
  abi: asyncJobTrackerAbi,
  eventName: "ResultDelivered",
  onLogs(logs) { /* ... */ },
});
subpath imports
// Pull only what you need — fully tree-shakable.
import { encodeJQInput, runJQ } from "@sigil/sdk/precompiles/jq";
import { ritualTestnet } from "@sigil/sdk/chain";
try it live
Use the Playground
Each run exports working Solidity + viem TS.
source
packages/sdk on GitHub
Read the full README, browse encoders, follow releases.