Skip to content

feat: add POST /invoices/:id/release-escrow endpoint and ABI metadata CI#162

Open
Good-Coded wants to merge 1 commit into
WHEELBACK:mainfrom
Good-Coded:feat/backend-post-invoice-release-escrow-and-abi-ci
Open

feat: add POST /invoices/:id/release-escrow endpoint and ABI metadata CI#162
Good-Coded wants to merge 1 commit into
WHEELBACK:mainfrom
Good-Coded:feat/backend-post-invoice-release-escrow-and-abi-ci

Conversation

@Good-Coded

@Good-Coded Good-Coded commented Jun 29, 2026

Copy link
Copy Markdown

Summary
This PR resolves two open issues.

Closes #116 — feat: add backend REST endpoint POST /invoices/:id/release-escrow
Behaviour
Scenario HTTP status
Missing or invalid x-admin-key header 401
id not a positive integer 400
Missing required env vars 503
Contract returns Unauthorized (#1) 403
Soroban simulation/submission failure 422
Confirmation timeout 504
Success 200 { invoice_id, status: "Released", tx_hash }
Admin-only via x-admin-key header (matches existing compliance.ts pattern)
Calls release_escrow(invoice_id, caller) via submitContractCall from
soroban.ts
Exported releaseEscrow() function for testability with mock client injection
10 new tests covering all auth, validation, and Soroban error paths

Closes #117 — chore: add generate_abi_metadata to CI on contract change
New workflow
ci-abi-metadata.yml
:

Triggers on PRs touching COMEBACKHERE-contracts/contracts/**
Runs scripts/generate_abi_metadata.sh abis
Fails with a clear message if abis/ diff is non-empty (stale snapshots)
Developer fixes by running make update-abi-snapshots locally and committing
Pre-existing test failures also fixed
Mounted missing routers (/api/treasury, /api/invoice, /disputes) in app.ts
Installed rate-limiter-flexible + ioredis which were in package.json but not installed
Test results: 32/32 passing (was 20/28 on main)

- Add POST /invoices/:id/release-escrow route (closes WHEELBACK#116)
  - Admin-only via x-admin-key header (401 if missing/wrong)
  - Calls release_escrow on invoice contract via Soroban RPC
  - Maps contract Unauthorized(1) error to HTTP 403
  - Returns { invoice_id, status: 'Released', tx_hash } on success
  - Full test coverage: auth, validation, env guard, Soroban happy/error paths

- Mount all previously unmounted routers in app.ts (treasury, invoice-settings,
  threshold, disputes) and wire in rateLimitMiddleware so existing tests pass

- Install rate-limiter-flexible and ioredis (were listed in package.json but
  missing from node_modules, causing rateLimiter tests to fail)

- Add ci-abi-metadata.yml CI workflow (closes WHEELBACK#117)
  - Triggers on PRs where COMEBACKHERE-contracts/contracts/** changes
  - Runs scripts/generate_abi_metadata.sh and fails if abis/ diff is non-empty
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Good-Coded Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

chore: add generate_abi_metadata to CI on contract change feat: add backend REST endpoint POST /invoices/:id/release-escrow

1 participant