46 lines
2.2 KiB
Markdown
46 lines
2.2 KiB
Markdown
# @stoa/web
|
|
|
|
The Stoa dApp — a Next.js dashboard for the Pharos agent commerce stack. Connect a wallet and run
|
|
the full loop on-chain: **register → list → hire → settle → rate**.
|
|
|
|
```bash
|
|
pnpm install
|
|
cp apps/web/.env.example apps/web/.env.local # fill NEXT_PUBLIC_STOA_*_ADDRESS after deploying
|
|
pnpm --filter @stoa/web dev # http://localhost:3000
|
|
```
|
|
|
|
## Pages
|
|
|
|
| Route | What it does |
|
|
|-------|--------------|
|
|
| `/` | Landing + live stats (skills / domains / contracts) and the flagship commerce skills. |
|
|
| `/marketplace` | Browse `ServiceRegistry` services by capability; **Hire via escrow** (real `StoaEscrow.createJob`). |
|
|
| `/agents` | List on-chain agents + reputation; **register** an identity inline. |
|
|
| `/dashboard` | Your agent, **list a service**, your escrow jobs with **release** + **rate provider**. |
|
|
| `/skills` | The full catalog (255 skills across 62 domains). |
|
|
| `/playground` | Run read-only skills live (pure + market-data) against the server. |
|
|
| `/protected` | The x402 paid-API demo (402 → pay → 200). |
|
|
| `/connect` | Wallet status + add Pharos network. |
|
|
|
|
## API routes
|
|
|
|
`/api/health` · `/api/skills` · `/api/services` · `/api/agents` · `/api/contracts` ·
|
|
`/api/run` + `/api/run/[skill]` (execute a skill) · `/api/x402/weather` (x402-paid).
|
|
|
|
## How it works
|
|
|
|
- **Wallet** — `components/WalletProvider` holds connection state (injected EIP-1193 + viem); the
|
|
navbar shows balance and a network switch. No wagmi/RainbowKit.
|
|
- **On-chain** — `lib/onchain.ts` does real reads (public RPC) and writes (wallet) against
|
|
`StoaRegistry`, `ServiceRegistry`, and `StoaEscrow`.
|
|
- **Catalog** — pages read a static `lib/skills-catalog.json` generated by `@stoa/skills`, so the UI
|
|
needs no runtime import of the skills package (the playground dynamically imports it to execute).
|
|
- **x402** — `/api/x402/weather` implements the x402 v1 handshake, vendored from the official x402
|
|
Next.js example.
|
|
|
|
## Config
|
|
|
|
Set in `.env.local`: `PHAROS_RPC_URL`, server addresses (`STOA_*_ADDRESS`) for the read API routes,
|
|
and **client** addresses (`NEXT_PUBLIC_STOA_REGISTRY_ADDRESS`, `NEXT_PUBLIC_STOA_SERVICES_ADDRESS`,
|
|
`NEXT_PUBLIC_STOA_ESCROW_ADDRESS`) for the wallet write flows.
|