Skip to content

feat(escrow): add Pontmore escrow agent discovery and self-registration - #32

Merged
comwanga merged 8 commits into
mainfrom
feat/escrow-agent-discovery
Aug 8, 2026
Merged

feat(escrow): add Pontmore escrow agent discovery and self-registration#32
comwanga merged 8 commits into
mainfrom
feat/escrow-agent-discovery

Conversation

@comwanga

@comwanga comwanga commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Adds escrow agent discovery (Level A) and self-registration (Level B) to SquadSync, integrating with the Pontmore PIP-01 protocol (kind 30361).

What this does

Level A — Discover escrow agents from Nostr:
The backend reads kind-30361 escrow descriptors from Nostr relays (30s cache) and exposes them via GET /api/v1/escrow/agents. The payout modal in the frontend gains a Direct/Agent toggle — organizers can pick an escrow agent from the Nostr network instead of sending directly via their own NWC wallet.

Level B — Register as an escrow agent:
An organizer can self-register as an escrow agent from the new /dashboard/agent page. They fill a form configuring their escrow service (release trigger, refund trigger, dispute policy, etc.), the app builds and signs a kind-30361 PIP-01 event using the NostrIdentityProvider context, and publishes it to Nostr relays. Other organizers can then discover them in the payout modal.

Files changed

Backend (7 new, 6 modified)

  • backend/app/services/pip01.py — PIP-01 protocol in Python (types, build, parse, coordinate)
  • backend/app/services/nostr_service.pyfetch_escrow_agents() with 30s relay cache
  • backend/app/api/v1/escrow.pyGET/POST /agents, POST /publish
  • backend/app/api/v1/payouts.py — escrow_coordinate on create, POST escrow-funded/released
  • backend/app/models/escrow_agent.py — local storage of published agent events
  • backend/app/models/payout.pyescrow_coordinate + escrow_status columns
  • backend/app/schemas/payout.py — escrow fields on PayoutCreate/PayoutOut
  • backend/app/models/__init__.py — EscrowAgentEvent export
  • backend/app/main.py — escrow router registration
  • Alembic migration 0011_escrow_agent.py

Frontend (6 new, 5 modified)

  • frontend/lib/pip01.ts — TypeScript PIP-01 protocol port
  • frontend/hooks/use-nostr-identity.tsx — NostrIdentityProvider (signEvent, sessionStorage persistence)
  • frontend/components/dashboard/agent-settings.tsx — agent registration form + discovery list
  • frontend/app/dashboard/agent/page.tsx — route page
  • frontend/components/engine/payout-modal.tsx — Direct/Agent toggle + escrow selection UI
  • frontend/components/auth/nostr-connect.tsx — persist signing capability on login (all 3 methods)
  • frontend/components/providers.tsx — wrap with NostrIdentityProvider
  • frontend/components/layout/sidebar.tsx — Agent nav item (Shield icon)
  • frontend/hooks/use-allocation.ts — escrow types + API functions

Tests

  • backend/tests/test_pip01.py — 15 unit tests (build/parse round-trip, edge cases)
  • backend/tests/test_escrow_api.py — 8 API tests (publish, list, auth, lifecycle)
  • frontend/tests/lib/pip01.test.ts — 10 unit tests
  • frontend/tests/hooks/use-nostr-identity.test.tsx — 6 context tests

Out of scope (Level C)

Actual Lightning custody / HODL invoice support requires LNBits/Breez/LND integration — a separate project. This PR only handles discovery + agent registration.

@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
squadsync Ready Ready Preview Aug 8, 2026 11:09am

@comwanga
comwanga marked this pull request as ready for review August 8, 2026 11:13
@comwanga
comwanga merged commit e19e75b into main Aug 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant