feat(account): add ?sponsored filter to GET /account/:id/trustlines - #651
Merged
Sulex45 merged 2 commits intoJul 30, 2026
Merged
Conversation
Adds an optional ?sponsored query parameter to GET /account/:id/trustlines: - ?sponsored=true returns only trustlines sponsored by another account - ?sponsored=false returns only unsponsored trustlines - omitted returns all trustlines (unchanged default behaviour) Each trustline now always includes a sponsoredBy field (the sponsor's account ID, or null), sourced from Horizon's balance.sponsor field. - src/middleware/coerceQueryParams.js: coerce ?sponsored to boolean - src/routes/account.js: add sponsoredBy field + sponsored filter, and exclude filtered requests from the full-list cache (same treatment as the existing assetCode filter) - README.md: document the new sponsored param - tests/account.sponsoredTrustlines.test.js: cover sponsored=true, sponsored=false, omitted, combined with assetCode, and invalid values Closes stellarkit-lab-devtools#556
|
@Loisyy 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.
Description:
Adds an optional ?sponsored query parameter to GET /account/:id/trustlines:
?sponsored=true → only trustlines sponsored by another account
?sponsored=false → only unsponsored trustlines
omitted → all trustlines (unchanged default)
Every trustline now includes a sponsoredBy field (sponsor's account ID, or null), sourced from Horizon's balance.sponsor.
Changes:
src/routes/account.js — add sponsoredBy field + sponsored filter; excluded filtered requests from the full-list cache (same treatment as the existing assetCode filter)
src/middleware/coerceQueryParams.js — coerce ?sponsored to boolean
README.md — document the new param
tests/account.sponsoredTrustlines.test.js — covers sponsored=true, sponsored=false, omitted, combined with assetCode, and invalid values
Closes #556