-
Notifications
You must be signed in to change notification settings - Fork 12
Description
📝 Description
Context: The API app (apps/api/) currently only exposes a root message and GET /health. The pipeline will serve signed price data to clients; this issue adds the price endpoints that expose signed feeds produced by the aggregator + signer.
Goal: Implement REST endpoints to read signed price data, e.g. GET /prices/:symbol (or GET /prices/latest/:symbol) and GET /prices/latest (all symbols). Data can be in-memory for now (e.g. a simple store or service that the aggregator/signer populate via internal API or stub). Focus on route shape, response format, and integration with @oracle-stocks/signer types (SignedPriceProof). No full end-to-end ingest yet — minimal scaffolding to get the API contract right.
Expected inputs/outputs:
- Input: HTTP GET with optional symbol.
- Output: JSON with signed price proof(s), e.g.
SignedPriceProofor{ symbol, price, timestamp, signature, publicKey }. Use 404 when symbol is unknown and 503 if price data is not available yet.
Tech stack / conventions: NestJS (existing in apps/api), TypeScript. Reuse or depend on @oracle-stocks/signer for types; optionally @oracle-stocks/shared for shared types. Keep controllers thin; put logic in a dedicated prices service.
Complexity: ~6/10 — well-scoped REST layer and one or two endpoints; in-memory or stub data source is enough for this issue.
✅ Requirements
- Add a Prices module (or extend AppModule) with a controller and service.
- Implement at least:
GET /prices/latest— return latest signed price for all configured symbols (array of signed proofs).GET /prices/latest/:symbol(orGET /prices/:symbol) — return latest signed price for one symbol (single signed proof).
- Response body shape matches or is compatible with
SignedPriceProoffrompackages/signer. - Return 404 when the requested symbol has no data; 503 when the price source is not ready (e.g. no data at all).
- Use a simple in-memory store or stub that can be replaced later by real aggregator/signer integration; document how the store is intended to be filled (e.g. internal call or background job).
- Keep existing
GET /andGET /healthunchanged.
🎯 Acceptance Criteria
-
GET /prices/latestandGET /prices/latest/:symbol(or equivalent) are implemented and documented (e.g. in README or OpenAPI comment). - Responses return JSON with signature and publicKey (signed proof shape); 404/503 behavior is as specified.
- At least one unit or integration test for the new endpoints (e.g. controller or e2e).
-
apps/apibuilds and passesnpm run buildand tests. - No breaking changes to existing health or root endpoint.
📁 Expected files to change/structure
apps/api/src/prices/— e.g.prices.module.ts,prices.controller.ts,prices.service.ts.apps/api/src/app.module.ts— import and register the prices module.apps/api/src/main.ts— only if global prefix or versioning is added (optional).- New or updated spec:
prices.controller.spec.tsorprices.service.spec.ts(or e2e). apps/api/README.md— document new routes and response format (optional but recommended).
Note: don't worry about CI workflow for now, it's an issue on our end we will fix after we merge all issues!
Thank you for taking this issue! You are helping us make RWAs consumer friendly on Stellar.