feat(escrow): add Pontmore escrow agent discovery and self-registration - #32
Merged
Conversation
…te to createPayout type
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/agentpage. 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 theNostrIdentityProvidercontext, 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.py—fetch_escrow_agents()with 30s relay cachebackend/app/api/v1/escrow.py—GET/POST /agents,POST /publishbackend/app/api/v1/payouts.py— escrow_coordinate on create,POST escrow-funded/releasedbackend/app/models/escrow_agent.py— local storage of published agent eventsbackend/app/models/payout.py—escrow_coordinate+escrow_statuscolumnsbackend/app/schemas/payout.py— escrow fields on PayoutCreate/PayoutOutbackend/app/models/__init__.py— EscrowAgentEvent exportbackend/app/main.py— escrow router registration0011_escrow_agent.pyFrontend (6 new, 5 modified)
frontend/lib/pip01.ts— TypeScript PIP-01 protocol portfrontend/hooks/use-nostr-identity.tsx— NostrIdentityProvider (signEvent, sessionStorage persistence)frontend/components/dashboard/agent-settings.tsx— agent registration form + discovery listfrontend/app/dashboard/agent/page.tsx— route pagefrontend/components/engine/payout-modal.tsx— Direct/Agent toggle + escrow selection UIfrontend/components/auth/nostr-connect.tsx— persist signing capability on login (all 3 methods)frontend/components/providers.tsx— wrap with NostrIdentityProviderfrontend/components/layout/sidebar.tsx— Agent nav item (Shield icon)frontend/hooks/use-allocation.ts— escrow types + API functionsTests
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 testsfrontend/tests/hooks/use-nostr-identity.test.tsx— 6 context testsOut 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.