feat: add ?order=asc|desc query param to GET /transaction/:hash/effects - #596
Merged
Sulex45 merged 2 commits intoJul 26, 2026
Conversation
…pt optional ?order=asc|desc query parameter on the effects endpoint - Default to 'desc' when the param is omitted - Use existing validateOrder helper from utils/validators for validation - Return 400 ValidationError for invalid order values - Pass validated order through to the Horizon .order() call Fixes pre-existing bugs blocking the test suite: - Add missing qp() helper to validators.js (was undefined, broke validateOrder) - Add missing etagMiddleware import in src/index.js - Remove duplicate makeAccountNotFoundError import in account.js - Remove duplicate rawRecords declaration in account.js - Add isTransactionNotFound handler in errorHandler.js (404 -> NotFound) Tests: all 7 cases pass (default desc, explicit asc, explicit desc, invalid -> 400) Closes stellarkit-lab-devtools#499
|
@joshfatoye0011-bit 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 Closes #499 Adds an optional ?order=asc|desc query parameter to GET /transaction/:hash/effects, letting callers control the sort direction of effects returned from Horizon. ## Changes ### Core feature - src/routes/transaction.effects.js — imports �alidateOrder, reads
eq.query.order, validates it, defaults to desc when omitted, and forwards the value to Horizon via .order() - ** ests/transaction.effects.test.js** — four new tests covering all acceptance criteria ### Pre-existing bugs fixed - src/utils/validators.js — added missing qp() helper (undefined reference broke �alidateOrder) - src/index.js — added missing etagMiddleware import - src/routes/account.js — removed duplicate import and duplicate
awRecords declaration - src/middleware/errorHandler.js — isTransactionNotFound now returns 404/NotFound ## Test results 7/7 tests pass: default desc, explicit asc, explicit desc, invalid value returns 400.