How rohitamalraj/surety works
Surety is an on-chain insurance product for AI-agent activity: ENS records publish policy rules, a Uniswap v4 hook enforces swap limits, and World ID human verification gates payouts. The main user journey is to configure and purchase a policy, fund/use an agent vault, observe payment events and violations, then file and authorize a claim. The README documents contract capabilities not represented by source files in this tree; those are shown as external system components. Backend excerpts establish several service relationships; frontend-to-service links are limited to documented REST and wallet flows.
Main entry points: server.ts HTTP API server · app/page.tsx Surety web app · api.ts Frontend API client · insure/page.tsx Policy purchase
Components 26
Policy and discovery
- Surety web app
frontend/app/page.tsx - Policy purchase
frontend/app/insure/page.tsx - Agent activity
frontend/app/agents/payments/page.tsx - Policy and claims
frontend/app/policy/[agentName]/page.tsx - Dashboard and feed
frontend/app/dashboard/page.tsx - Frontend API client
frontend/lib/api.ts
Backend services
- HTTP API server
backend/src/server.ts - Policy and feed API
backend/src/routes/data.ts - Event indexer
backend/src/indexer/watchEvents.ts - ENS label lookup
backend/src/chain/labels.ts - Hosted payments agent
backend/src/agent/payments.ts - Agent simulator
backend/src/agent/simulator.ts
Human verification
- IDKit verification API
backend/src/routes/idkit.ts - Proof-of-human checks
backend/src/idkit/proofOfHuman.ts - World ID OIDC
backend/src/worldid/oidc.ts - Verification sessions
backend/src/worldid/sessions.ts - Human attestations
backend/src/worldid/signer.ts
On-chain insurance
- Ethereum Sepolia contracts
- Policy registry
- Agent vault
- Surety v4 hook
- Oracle and claim router
Other components
- Policyholder / user
- ENSv2
- World ID issuer
- Uniswap v4 PoolManager
Connections 35
- Policyholder / user → Surety web app: uses
README.md - Surety web app → Policy purchase: opens purchase
README.md - Surety web app → Agent activity: opens agents
README.md - Surety web app → Policy and claims: views policy
README.md - Surety web app → Dashboard and feed: views activity
README.md - Policy purchase → Frontend API client: requests REST
- Agent activity → Frontend API client: requests REST
- Policy and claims → Frontend API client: requests REST
- Dashboard and feed → Frontend API client: requests REST
- Frontend API client → HTTP API server: calls REST
README.md - HTTP API server → Policy and feed API: mounts routes
backend/src/server.ts - HTTP API server → Event indexer: starts and syncs
backend/src/server.ts - Policy and feed API → Event indexer: reads feed
backend/src/routes/data.ts - Policy and feed API → ENS label lookup: resolves labels
backend/src/routes/data.ts - ENS label lookup → Event indexer: reads events
backend/src/chain/labels.ts - HTTP API server → IDKit verification API: mounts routes
backend/src/server.ts - IDKit verification API → Proof-of-human checks: verifies proofs
backend/src/routes/idkit.ts - HTTP API server → World ID OIDC: starts and verifies login
backend/src/server.ts - HTTP API server → Verification sessions: creates and consumes
backend/src/server.ts - HTTP API server → Human attestations: submits claim approval
backend/src/server.ts - World ID OIDC → World ID issuer: exchanges and verifies tokens
backend/src/worldid/oidc.ts - Policy and feed API → Agent simulator: runs demo step
backend/src/routes/data.ts - Hosted payments agent → Agent simulator: uses swap helpers
backend/src/agent/payments.ts - Policy purchase → Policy registry: issues policy
README.md - Policy registry → ENSv2: registers policy name
README.md - Policy registry → Agent vault: creates agent coverage
README.md - Agent activity → Agent vault: sends agent payments
README.md - Agent vault → Surety v4 hook: routes swaps
README.md - Surety v4 hook → Uniswap v4 PoolManager: enforces before swap
README.md - Surety v4 hook → Oracle and claim router: releases verified payouts
README.md - Oracle and claim router → World ID issuer: requires fresh human proof
README.md - Human attestations → Oracle and claim router: signs claim approvals
README.md - Policy and claims → Oracle and claim router: files and tracks claims
README.md - Policy purchase → World ID issuer: enrolls policyholder
README.md - Policy registry → Surety v4 hook: checks reserve
README.md