Skip to content

Add cursor pagination passthrough to the Horizon remittance-history mapper in lib/remittance/horizon.ts #859

Description

@Baskarayelu

📋 Description

lib/remittance/horizon.ts wraps @stellar/stellar-sdk's Horizon.Server to map payment operations into TransactionItems for /api/remittance/history. The helper does not currently expose Horizon's native cursor paging, so the history route cannot page beyond the first batch — a problem given the documented testnet rate limit (~3500 req/hour/IP) called out in the file's own header comment.

This issue adds cursor-based pagination passthrough that aligns with the project's lib/utils/pagination.ts PaginatedResult<T> contract.

Why this matters: accounts with many payments cannot see their full history, and re-fetching from the top wastes the limited Horizon rate budget.

🎯 Requirements & Context

Functional requirements

  • Extend the history fetch in horizon.ts to accept limit and cursor and pass them to Horizon's .cursor() / .limit() builders.
  • Return { data, nextCursor, hasMore } consistent with PaginatedResult<T>.
  • Update /api/remittance/history to read paging params and forward them.

Context & constraints

  • Keep the lazily-initialised singleton (getHorizonServer).
  • Validate paging params with the existing validatePaginationParams.
  • Preserve TxStatus mapping and existing TransactionItem shape.

🛠️ Suggested Execution

git checkout -b feature/horizon-cursor-pagination
  • Implement paging passthrough + TSDoc.
  • Add vitest tests with a mocked Horizon server: first page sets nextCursor, last page sets hasMore: false, invalid cursor handled gracefully.
  • Edge cases: empty account, limit clamping to 100, malformed cursor.
npx vitest run && npx tsc --noEmit && npm run lint
feat(remittance): expose Horizon cursor pagination in history mapper

✅ Acceptance Criteria & Guidelines

Requirement Target
Cursor + limit passthrough Required
Conforms to PaginatedResult<T> Required
Test coverage of paging branches ≥ 90%
tsc --noEmit, lint clean Required
Timeframe 96 hours from assignment

💬 Community & Support

Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA

Comment to claim, and ask questions in the channel. 🚀

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions