feat(account): add GET /account/:id/offers endpoint with pagination#389
Open
JoshuaEdd wants to merge 1 commit into
Open
feat(account): add GET /account/:id/offers endpoint with pagination#389JoshuaEdd wants to merge 1 commit into
JoshuaEdd wants to merge 1 commit into
Conversation
|
@JoshuaEdd 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! 🚀 |
Contributor
|
Kindly resolve conflicts |
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 #273
Summary
Adds
GET /account/:id/offersendpoint to retrieve all open offers for a Stellar account on the DEX.What changed
src/routes/account.js— Rewrote/account/:id/offershandler:parsePaginationParamshelper forlimit,cursor, andorderparamsofferId,selling,buying,price,amount,lastModifiedLedgerdata.offersarray withtotal,limit,cursormetadatavalidateLimitin favour of the shared one invalidators.jstypes/index.d.ts— AddedOfferAsset,OfferData,AccountOffersResponsetypessdk/account.ts— Added typedgetOffers()method with pagination optionssdk/stellarkit-client.js— AddedgetAccountOffers()methodtests/account.offers.test.js(new) — 7 mock-based tests covering success, empty, pagination, validation, and cursortests/api.test.js— Updated 5 existing integration tests for new response shape (data.offers/offer.offerId), added cursor + order testsKey design decisions
{ offers, total, limit, cursor }) while renamingitems→offersandid→offerIdas requiredparsePaginationParamsfromsrc/utils/pagination.js— already the standard pagination helper in the codebase.order(order)chain call to the Horizon query since theparsePaginationParamshelper validates this paramvalidateLimitduplicate was removed since it's no longer neededAcceptance criteria checklist
success: trueanddata.offersarraylimitandcursorquery paramsparsePaginationParamshelperofferId,selling,buying,price,amount,lastModifiedLedgerTest output
All 13 offers-related tests pass. No regressions. Pre-existing test failures in
api.test.js(cache warming, CORS, asset verify, fee-estimate/trends) are unrelated to this change.Follow-ups
OfferDatatype for external consumersSecurity note
All user-supplied input (
accountId,limit,order,cursor) is validated server-side before reaching Horizon. No sensitive data is exposed or logged.