Executes docs/plan.md strategic refocus: - @stoa/sdk: StoaClient developer-facing commerce client (wraps verified skills) - commerce/ skill grouping (stoaCommerceSkills) — flagship skills made obvious - examples/99-full-commerce-loop.ts + pnpm demo:full / pnpm win - HACKATHON.md, docs/DEMO_SCRIPT.md, docs/WINNING_FLOW.md, NOTICE - README reframed: lead with commerce, catalog repositioned as supporting toolkit - complete .env.example (demo keys + all 13 contract addresses) All 6 packages typecheck clean; 16 skill tests + 54 contract tests green.
33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
# @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.
|
|
|
|
```ts
|
|
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`.
|