feat: add POST /invoices/:id/release-escrow endpoint and ABI metadata CI#162
Open
Good-Coded wants to merge 1 commit into
Open
Conversation
- 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
|
@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! 🚀 |
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
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)