-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
backendBackend / Rust core workBackend / Rust core work
Description
Overview
Add a GET /api/fees/recommend endpoint that reads the latest fee stats already stored in SQLite and returns an optimal fee suggestion based on current network congestion. No new Horizon calls needed — all data is derived from what we already collect.
Recommendation Logic
Congestion is derived from the ratio of avg_fee to base_fee:
- LOW (ratio < 1.5×) → recommend
p20 - MEDIUM (ratio 1.5–3×) → recommend
p50 - HIGH (ratio > 3×) → recommend
p70
Response Shape
{
"recommended_fee": 120,
"congestion": "LOW",
"basis": "p20",
"base_fee": 100,
"avg_fee": 110,
"timestamp": "2026-03-21T10:00:00Z"
}Acceptance Criteria
-
GET /api/fees/recommendreturns the above response shape - Congestion logic applied correctly for all three levels
- Reads from the latest record in SQLite — no new Horizon call
- Returns a meaningful error if no fee data exists in the database yet
- Unit tests covering all three congestion levels with mocked fee data
- CORS headers consistent with existing endpoints
Notes
- No new database tables or migrations needed
- Congestion thresholds can be made configurable via env vars in a future iteration
- Related frontend issue:
[Phase 2] feat(ui): dashboard — fee recommendation widget
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backendBackend / Rust core workBackend / Rust core work