- sdk: config + contracts/{registry,escrow,services,tipjar} + x402/{client,server,types} + treasury/{policy,guard,simulate}, namespaced in barrel (0 tsc errors)
- mercator: prompts.ts (orchestrator system/selection/settlement prompts) + demo/full-loop.ts (planner->loop->trace)
- completes plan.md's package file trees
@stoa/sdk
StoaClient — a clean, typed client for the Pharos agent commerce stack. It wraps the verified
Stoa skills behind ergonomic methods that return data directly and throw on error.
import { StoaClient } from "@stoa/sdk";
const stoa = StoaClient.fromEnv(); // STOA_PRIVATE_KEY, PHAROS_RPC_URL, STOA_*_ADDRESS
const { agentId } = await stoa.registerAgent("ipfs://my-agent-card.json");
await stoa.listService({ capability: "research", endpoint: "https://api/x", price: "0.01" });
const { jobId } = await stoa.createEscrow({ payee: "0xWorker", milestones: ["0.001"] });
await stoa.payX402("https://api/x/result", "0.05");
await stoa.releaseEscrow(jobId!, 0);
await stoa.writeReputation(agentId!, 5, "stoa:job/1");
Why a separate SDK
- Skills (
@stoa/skills) are LLM-facing tools ({name, schema, handler}) for LangChain / Vercel AI SDK / MCP / ElizaOS. StoaClientis developer-facing: a plain typed API for scripts, backends, and the Mercator agent.
Both share the exact same on-chain logic, so behavior is identical.
Methods
registerAgent · resolveAgent · listService · discoverServices · createEscrow ·
releaseEscrow · refundEscrow · getEscrow · writeReputation · getReputation ·
guardedTransfer · payX402 · tip · post.