Skip to content

feat(api): implement prices feature with REST endpoints for signed#35

Open
JosueBrenes wants to merge 1 commit intoNeko-Protocol:mainfrom
JosueBrenes:feat/add-rest-endpoints-for-signed-price-feeds
Open

feat(api): implement prices feature with REST endpoints for signed#35
JosueBrenes wants to merge 1 commit intoNeko-Protocol:mainfrom
JosueBrenes:feat/add-rest-endpoints-for-signed-price-feeds

Conversation

@JosueBrenes
Copy link

…ice feeds

  • Added PricesModule, PricesController, and PricesService to manage signed price proofs.
  • Implemented endpoints to retrieve the latest prices for all symbols and for individual symbols.
  • Updated README.md with new API documentation for price feeds.
  • Added unit tests for PricesController and PricesService to ensure functionality.

🚀 Neko Pull Request

Mark with an x all the checkboxes that apply (like [x])


📌 Type of Change

  • Documentation (updates to README, docs, or comments)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

📝 Changes description

Implements REST endpoints for signed price feeds (API Publisher) as described in #32.

New files:

  • apps/api/src/prices/prices.module.ts — NestJS feature module for prices
  • apps/api/src/prices/prices.service.ts — In-memory store for SignedPriceProof with updatePrice(), getLatestPrice(), getAllLatestPrices(), and isReady()
  • apps/api/src/prices/prices.controller.ts — Two endpoints:
    • GET /prices/latest — returns all latest signed price proofs (503 if no data)
    • GET /prices/latest/:symbol — returns proof for a single symbol (404 if unknown, 503 if no data)
  • apps/api/src/prices/prices.controller.spec.ts — 6 unit tests for controller
  • apps/api/src/prices/prices.service.spec.ts — 8 unit tests for service

Modified files:

  • apps/api/src/app.module.ts — Registered PricesModule
  • apps/api/package.json — Added @oracle-stocks/signer dependency
  • apps/api/README.md — Documented new routes, response shapes, and how the store is populated

No breaking changes — existing GET / and GET /health endpoints remain untouched.

Response format uses SignedPriceProof from @oracle-stocks/signer:

{
  "data": { "symbol": "AAPL", "price": 189.45, "timestamp": 1719500000000, "source": "aggregator" },
  "signature": "3045022100...",
  "publicKey": "04abc123...",
  "timestamp": 1719500000000
}

Test results: 4 suites, 23 tests passing. Build succeeds with npm run build.


📸 Evidence (A Loom/Cap video is required as evidence, we WON'T merge if there's no proof)

(pending — will attach Loom/Cap recording)


⏰ Time spent breakdown

Task Time
Codebase exploration & planning ~10 min
Implementation (service, controller, module) ~15 min
Unit tests ~10 min
README documentation ~5 min
Build & test verification ~5 min
Total ~45 min

🌌 Comments

  • The PricesService uses an in-memory Map<string, SignedPriceProof> as a stub store. The updatePrice() method is exported so the aggregator/signer pipeline can push data in a future integration.
  • Symbol lookup is case-insensitive (normalized to uppercase internally).
  • The ingestor build failure in the pre-push hook is a pre-existing issue unrelated to these changes (as noted in the issue: "don't worry about CI workflow for now").

Thank you for contributing to Neko, you just helped us make RWAs consumer friendly on Stellar! We hope you can continue contributing to this project.

…ice feeds

- Added PricesModule, PricesController, and PricesService to manage signed price proofs.
- Implemented endpoints to retrieve the latest prices for all symbols and for individual symbols.
- Updated README.md with new API documentation for price feeds.
- Added unit tests for PricesController and PricesService to ensure functionality.
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.

Add REST endpoints for signed price feeds (API Publisher)

1 participant