feat(escrow): escrow session lifecycle — create, fund, settle - #35
Merged
Conversation
Adds a full escrow session flow on top of the agent discovery layer: - Escrow model with state machine (draft → awaiting_funding → funded → active → release_pending → released, plus cancel/refund/dispute paths) - API router at /api/v1/escrows: create, list, get, activate, fund, confirm-funded, release, cancel - Pydantic schemas and escrow_service with validated state transitions Frontend: - /dashboard/escrows — list view with active/past grouping, status badges, agent labels, amounts - /dashboard/escrows/create?agent=<coordinate> — create form with amount, rail selector (lightning/bitcoin/spark), review card - /dashboard/escrows/[id] — detail view with progress steps, funding screen (NWC wallet + manual invoice), status cards for each state - Sidebar nav: Escrows (Wallet icon) Wiring: - 'Use this agent' in agent detail dialog now routes to create escrow with the agent coordinate pre-filled - NWC one-click pay reuses existing lib/lightning.ts payWithNwc Tests: - backend/tests/test_escrow_sessions.py: 13 tests covering create, list, filter, 403, activate, fund, full lifecycle, cancel, amount validation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
comwanga
marked this pull request as ready for review
August 8, 2026 20:10
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 the full escrow session lifecycle on top of the existing agent discovery layer. Agents are service providers, escrows are transaction instances, wallets are payment tools — these three concepts are now cleanly separated.
Flow
Backend
escrowstable with state machine:draft→awaiting_funding→funded→active→release_pending→released, pluscancelled,refunded,disputed,failed,expired/api/v1/escrows:POSTcreate,GETlist (with status filter),GETdetail,POSTactivate,POSTfund (generates bolt11 invoice),POSTconfirm-funded,POSTrelease,POSTcancelFrontend
/dashboard/escrows/dashboard/escrows/create?agent=<coordinate>/dashboard/escrows/[id]Wiring
/dashboard/escrows/create?agent=<coordinate>lib/lightning.tsOut of scope (future)