Skip to content

sorted the /assets/popular endpoint#112

Open
ALLEN-AYODEJI wants to merge 1 commit into
Miracle656:mainfrom
ALLEN-AYODEJI:popular_endpoint
Open

sorted the /assets/popular endpoint#112
ALLEN-AYODEJI wants to merge 1 commit into
Miracle656:mainfrom
ALLEN-AYODEJI:popular_endpoint

Conversation

@ALLEN-AYODEJI

Copy link
Copy Markdown

src/routes/assets/popular.ts (new) — GET /assets/popular?window=24h&by=transfers

  • Validates window (1h/24h/7d) and by (transfers/volume)
  • Defaults: window=24h, by=transfers, limit=20, offset=0
    src/db.ts (modified)
  • Exported toDisplayAmount
  • Added queryPopularAssets — raw SQL aggregation: GROUP BY contractId, COUNT(*) for transfer count, SUM(CAST(amount AS NUMERIC)) for volume, ordered by the by param
    src/api.ts (modified) — mounted router at /assets
    Response shape:
    {
    "window": "24h",
    "by": "transfers",
    "limit": 20,
    "offset": 0,
    "total": 50,
    "assets": [
    { "contractId": "C...", "transferCount": 1234, "volume": "5000000000000000", "displayVolume": "500.0000000" }
    ]
    }

Closes #109

@drips-wave

drips-wave Bot commented Jun 23, 2026

Copy link
Copy Markdown

@ALLEN-AYODEJI 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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/assets/popular endpoint

1 participant