Skip to content

Add a GET /api/stellar/account route to fetch current user's Stellar balance #17

Description

@Codex723

ISSUE #17


Category: Stellar API Routes
Difficulty: intermediate
Labels: stellar, backend, api, intermediate

Files involved

  • src/app/api/stellar/account/route.ts

Background

There's no way to fetch the authenticated user's current on-chain balances. Add a GET handler that loads the account from Horizon and returns balances by asset.

This issue is part of the RemitX contributor backlog, generated from a full codebase audit of the project. RemitX is a Stellar-based remittance platform (Next.js 16, Prisma/Postgres, the Stellar SDK, and a Soroban escrow contract) currently at the "foundation build" stage: auth and the data model are real, while the Stellar integration, escrow contract internals, and several frontend pages are intentionally scaffolded with TODO(contributor) markers. See FOUNDATION.md in the repo root for the full project map and current status of every subsystem before starting.

Suggested approach

  1. Review the current implementation in src/app/api/stellar/account/route.ts and confirm the stub/gap described below.
  2. There's no way to fetch the authenticated user's current on-chain balances. Add a GET handler that loads the account from Horizon and returns balances by asset.
  3. Add or update tests so the behavior is verifiable and won't silently regress.
  4. Update any relevant comments/docs (e.g. remove the TODO(contributor) marker this issue resolves, if applicable).

Acceptance criteria

  • Returns balances array with asset code + amount
  • 404/graceful response if account not yet funded
  • Covered by a route test with a mocked Horizon response

Notes for contributors

  • Keep the change scoped to this issue — if you notice other stubs or bugs nearby, open a separate issue rather than bundling fixes into this PR.
  • Match the existing code style in the surrounding file. This codebase uses TypeScript strict mode, Zod for input validation, and the shared successResponse/errorResponse helpers in src/lib/api-response.ts for every API route.
  • If this issue depends on another issue in this area being done first, check the related issues below before starting — some subsystems (e.g. the escrow contract's release() authorization) need a design decision made before implementation can proceed.
  • Please reference this issue number in your PR description, and check off acceptance criteria as you satisfy them.

Related issues in this area

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions