feat: add health, protocol-status, vote, and key-snapshot endpoints - #860
Merged
Chucks1093 merged 2 commits intoSep 8, 2026
Conversation
…ccesslayerorg#796, accesslayerorg#834, accesslayerorg#840, accesslayerorg#848) - GET /health: probe database (SELECT 1), Redis (PING), and Stellar Horizon (root fetch). Returns 200 when all healthy, 503 when any dependency is degraded, with per-dependency statuses. (accesslayerorg#796) - GET /protocol/status: return global trading pause state plus protocol-wide config from the get_protocol_status contract view. Cached in Redis for 30s; cache invalidated on any protocol config update. (accesslayerorg#848) - POST /keys/:keyId/proposals/:proposalId/vote: require a valid JWT, validate optionIndex, check holder eligibility (403 for non-holders), reject duplicate votes (409), 404 for missing/closed proposals, 422 for out-of-range options. Persists the vote to the new proposal_votes table. (accesslayerorg#834) - GET /admin/keys/:keyId/snapshot: return on-chain Soroban fields (circulatingSupply, currentPrice, holderCount, tradingPaused, supplyCap, holderCapBps, circuitBreakerThresholdBps) alongside the matching database values with a per-field drift boolean. Requires an admin JWT; 404 for unknown keys. (accesslayerorg#840)
|
@jajafwangshak86-ops 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! 🚀 |
Member
❌ CI Failed —
|
Closed
5 tasks
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.
Closes #796
Closes #834
Closes #840
Closes #848
Summary
Adds four new endpoint capabilities across the API:
GET /health(#796)Probes the database (
SELECT 1), Redis (PING), and Stellar Horizon (root endpoint fetch). Returns200when all dependencies are healthy and503when any is degraded, with per-dependency statuses and adegradedlist. No authentication required — suitable for load balancers and uptime monitors.GET /protocol/status(#848)Returns protocol-wide config and global trading pause state from the
get_protocol_statuscontract view:globalTradingPaused,protocolFeeBps,treasuryAddress,lockupDurationSeconds, andminInvestmentAmount. IncludespausedAtfrom the database when paused. Cached in Redis for 30 seconds (protocol:status) and invalidated whenever an admin updates any protocol config value via/admin/protocol/*.POST /keys/:keyId/proposals/:proposalId/vote(#834)Requires a valid JWT. Validates
optionIndexis within the proposal's option range, checks the caller holds at least one key, rejects duplicate votes, submits thecast_votecontract call, and persists the vote to the newproposal_votestable.409on duplicate vote422on out-of-rangeoptionIndex404if the proposal doesn't exist or is already closed403for a non-holder JWTGET /admin/keys/:keyId/snapshot(#840)Requires an admin JWT. Reads
circulatingSupply,currentPrice,holderCount,tradingPaused,supplyCap,holderCapBps, andcircuitBreakerThresholdBpsfrom the Soroban contract (via theget_protocol_status-style RPC read scaffolding) and returns them alongside the matching database values with a per-fielddriftboolean. Returns404for unknown key IDs.Migration
Adds
pausedAttoprotocol_configand creates theproposal_votestable (unique onkeyId, proposalId, voter). Migration:20260831000000_add_protocol_paused_and_proposal_votes.Notes
key-sync.service.ts,soroban-rpc.utils.ts) — the endpoints are fully functional against the database with the RPC reads as documented scaffolding.Verification
pnpm run build— no new TypeScript errors (the 3 reported errors are pre-existing onmaininerror.constants.tsandcreator.routes.ts).pnpm exec jest src/modules/health/— all 92 tests pass.eslintpasses on all changed/new files.