Skip to content

Add an ?asset= filter to GET /api/v1/liquidity/entries in routes/liquidity.ts #135

Description

@Jagadeeshftw

📌 Description

routes/liquidity.ts's GET /entries calls service.listEntries() unfiltered, returning every raw per-anchor liquidity entry across all assets. liquidityRepository.ts already exposes a byAsset(asset) method used internally by quoteService, but there is no way for an API client to filter entries by asset the same way GET /api/v1/liquidity/:asset already filters pools by asset.

🧩 Requirements and context

  • Accept an optional ?asset= query param on GET /api/v1/liquidity/entries, normalized via normalizeAsset from utils/validation.ts.
  • When provided, return only entries matching that asset; when omitted, preserve current unfiltered behavior.
  • Add a corresponding LiquidityService.listEntries(filters?: { asset?: string }) overload/parameter rather than filtering in the route handler directly, matching the existing services-own-the-rules pattern used elsewhere.

🛠️ Suggested execution

  • Modify src/services/liquidityService.ts's listEntries to accept an optional asset filter and delegate to this.repo.byAsset(asset) when present.
  • Modify src/routes/liquidity.ts's GET /entries handler to pass req.query.asset through.
  • Update src/openapi.ts's /api/v1/liquidity/entries entry to document the new parameter.
  • Add tests in src/services/liquidityService.test.ts and src/routes/liquidity.test.ts.

✅ Acceptance criteria

  • GET /api/v1/liquidity/entries?asset=usdc returns only USDC entries (case-insensitive, normalized).
  • Omitting ?asset= returns every entry as before.
  • New tests pass at both the service and route level.

🔒 Security notes

N/A — read-only filter over data already fully exposed by the unfiltered endpoint.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issueapiHTTP/WebSocket APIenhancementNew feature or improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions