Skip to content

Add pyth lazer latest price surface - #137

Open
jaspersagent wants to merge 3 commits into
sedaprotocol:mainfrom
jaspersagent:feat/pp-proxy-unify
Open

Add pyth lazer latest price surface#137
jaspersagent wants to merge 3 commits into
sedaprotocol:mainfrom
jaspersagent:feat/pp-proxy-unify

Conversation

@jaspersagent

Copy link
Copy Markdown
Collaborator

Summary

  • Add the POST /v1/latest_price pyth-lazer surface expected by deployed pyth_pro oracle programs.
  • Keep the existing GET /price/:symbols array surface backed by the same websocket cache.
  • Preserve all-or-fail request ordering for latest_price so response entries align with requested feed positions.
  • Store per-feed stream timestamps in cache so parsed.timestampUs is derived from the returned feeds, not unrelated updates.

Validation

  • bun test workspace/data-proxy/src/modules/pyth-lazer/pyth-lazer.test.ts
  • bunx biome check workspace/data-proxy/src/config/pyth-lazer-module-config.ts workspace/data-proxy/src/controllers/proxy/handle-proxy-request.ts workspace/data-proxy/src/modules/pyth-lazer/pyth-lazer.ts workspace/data-proxy/src/modules/pyth-lazer/pyth-lazer.test.ts
  • bun run check-ts
  • bun test

@jaspersagent
jaspersagent force-pushed the feat/pp-proxy-unify branch from bd29a91 to 17b5347 Compare May 29, 2026 17:31
@jasperdg jasperdg changed the title [codex] Add pyth lazer latest price surface Add pyth lazer latest price surface Jun 1, 2026
@jaspersagent
jaspersagent marked this pull request as ready for review June 1, 2026 13:56
@jaspersagent
jaspersagent force-pushed the feat/pp-proxy-unify branch from 31d01b6 to 925a683 Compare June 1, 2026 14:10
@jaspersagent
jaspersagent force-pushed the feat/pp-proxy-unify branch from 925a683 to af81443 Compare June 1, 2026 14:13

@hacheigriega hacheigriega left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I did wonder if it makes sense to have handlePathRequest be a part of the module but not handleLegacyLatestPriceRequest. But ultimately I didn't see a good reason against it.

The legacy latest_price surface forwarded raw cached feeds, so a feed missing optional fields produced an irregular shape. Map each feed through a fixed compat field set that fills absent values with null, matching the seda-oracle-programs pyth_pro fetcher's expected response.
The latest_price surface ignored the channel in the request body and served every feed from the single module-level subscription, so an op asking for a fixed-rate price could receive a real_time one. Key the subscription registry and price cache by (priceFeedId, channel), route inbound frames back to their channel via the subscriptionId they carry, and let the latest_price body select its channel, defaulting to the module channel. The path surface keeps using the module default.
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.

2 participants