Skip to content

[Phase 2] feat(core): account fee history endpoint #89

@Tinna23

Description

@Tinna23

Overview

Add a GET /api/fees/account/:address endpoint that queries Horizon for all transactions belonging to a Stellar account address, aggregates the fee data, and returns a summary plus a timeline of fees paid.

Horizon Source

Horizon endpoint: GET https://horizon-testnet.stellar.org/accounts/:address/transactions
Supports pagination via cursor, limit, and order query params.
Key field per transaction: fee_charged

Response Shape

{
  "address": "GABC...",
  "summary": {
    "total_fees_paid": 4200,
    "transaction_count": 38,
    "avg_fee": 110,
    "max_fee": 500,
    "min_fee": 100
  },
  "transactions": [
    {
      "hash": "abc123...",
      "fee_charged": 150,
      "ledger": 1234567,
      "created_at": "2026-03-21T10:00:00Z"
    }
  ]
}

Acceptance Criteria

  • GET /api/fees/account/:address returns the above response shape
  • Fetches up to the last 50 transactions from Horizon (configurable via ?limit query param, max 200)
  • Aggregates summary stats: total fees, count, avg, max, min
  • Returns 404 with a clear error message if the account address is not found on Horizon
  • Returns 400 if the address format is clearly invalid
  • Transactions returned in reverse chronological order (newest first)
  • Unit tests for the aggregation logic
  • CORS headers consistent with existing endpoints

Notes

  • Related frontend issue: [Phase 2] feat(ui): dashboard — account fee history page
  • Pagination beyond 50 can be a future enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend / Rust core work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions