API

OpenTab (escrow)

REST surface around TabEscrowRouter. The on-chain create / claim / refund happens via viem in the sender or recipient's browser; these endpoints just stage and confirm the off-chain mirror so the dashboard has a row to render.

List my open tabs (as sender)

GET /api/escrow
Cookie: tab-session=…

→ 200 OK
{ "escrows": [ … ] }

Create an escrow record

POST /api/escrow
{
  "handleSlug": "alice",
  "amount": "10.00",
  "chain": "base-sepolia",
  "dueInHours": 168,
  "note": "thanks for the design"
}

→ 201 Created
{
  "escrow": { "id": "esc_xxx", "status": "pending_create", … },
  "onChainArgs": {
    "router": "0x…",
    "stable": "0x…",
    "handleSlug": "alice",
    "amount": "10000000",
    "deadline": 1762000000,
    "senderNonce": "…"
  }
}

Retrieve an escrow

GET /api/escrow/{escrow_id}
→ 200 OK
{ "escrow": { … } }

Confirm the create tx

POST /api/escrow/{escrow_id}
{
  "action": "confirm_create",
  "txHash": "0x…",
  "onChainId": "0x…"
}

Claim (recipient)

POST /api/escrow/{escrow_id}
{ "action": "claim" }

→ 200 OK
{ "escrow": { "status": "claimed", … }, "txHash": "0x…" }

Caller must be signed in as the handle this OpenTab was reserved for. Tab's executor submits the contract call and pays gas.

Refund (anyone, after deadline)

POST /api/escrow/{escrow_id}
{ "action": "refund" }

Webhooks

  • escrow.created
  • escrow.claimed
  • escrow.refunded