stoa 05a907e127 feat(sdk+mercator): SDK contract/x402/treasury submodules + Mercator prompts & full-loop
- 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
2026-06-12 01:12:18 +03:00
..

@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.
  • StoaClient is 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.