📌 Description
LiquidityRepository exposes byAsset(asset) (used by QuoteService) but has no symmetric byAnchor(anchor) to list every asset balance held by a single anchor. LiquidityService/routes currently have no efficient way to answer "what does anchor X hold across all assets" without calling all() and filtering client-side.
🧩 Requirements and context
- Add
byAnchor(anchor: string): LiquidityEntry[] to LiquidityRepository, mirroring the existing byAsset method's shape and doc-comment style.
- Add a corresponding
LiquidityService.listByAnchor(anchor) and a GET /api/v1/liquidity/anchors/:anchor route (chosen to avoid colliding with the existing GET /:asset route).
🛠️ Suggested execution
- Add
byAnchor to src/repositories/liquidityRepository.ts.
- Add
listByAnchor to src/services/liquidityService.ts.
- Add the route to
src/routes/liquidity.ts, taking care of route-ordering relative to the existing /:asset and /entries routes.
- Update
src/openapi.ts with the new path.
- Add tests in
src/repositories/liquidityRepository.test.ts, src/services/liquidityService.test.ts, and src/routes/liquidity.test.ts.
✅ Acceptance criteria
🔒 Security notes
N/A — read-only addition exposing data already reachable (less conveniently) via the existing unfiltered entries endpoint.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
LiquidityRepositoryexposesbyAsset(asset)(used byQuoteService) but has no symmetricbyAnchor(anchor)to list every asset balance held by a single anchor.LiquidityService/routes currently have no efficient way to answer "what does anchor X hold across all assets" without callingall()and filtering client-side.🧩 Requirements and context
byAnchor(anchor: string): LiquidityEntry[]toLiquidityRepository, mirroring the existingbyAssetmethod's shape and doc-comment style.LiquidityService.listByAnchor(anchor)and aGET /api/v1/liquidity/anchors/:anchorroute (chosen to avoid colliding with the existingGET /:assetroute).🛠️ Suggested execution
byAnchortosrc/repositories/liquidityRepository.ts.listByAnchortosrc/services/liquidityService.ts.src/routes/liquidity.ts, taking care of route-ordering relative to the existing/:assetand/entriesroutes.src/openapi.tswith the new path.src/repositories/liquidityRepository.test.ts,src/services/liquidityService.test.ts, andsrc/routes/liquidity.test.ts.✅ Acceptance criteria
byAnchorreturns exactly the entries belonging to the given anchor across all assets./:assetor/entries, verified by a routing test.🔒 Security notes
N/A — read-only addition exposing data already reachable (less conveniently) via the existing unfiltered
entriesendpoint.📋 Guidelines