Skip to content

feat(pyth-lazer-protocol): add price request #2444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 6, 2025
Merged

feat(pyth-lazer-protocol): add price request #2444

merged 3 commits into from
Mar 6, 2025

Conversation

keyvankhademi
Copy link
Contributor

Summary

Changes needed to support price request (historical prices with signatures)

Rationale

Our users need this api

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Manually tested the api

Copy link

vercel bot commented Mar 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 6, 2025 7:45pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 6, 2025 7:45pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 6, 2025 7:45pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 7:45pm
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 7:45pm
insights ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 7:45pm

@@ -236,6 +243,17 @@ mod channel_ids {
pub const FIXED_RATE_200: ChannelId = ChannelId(3);
}

impl Display for Channel {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could probably just use serde to serialize it as a string, which gets you the same result without a duplicate implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked into it but couldn't find a good way of handling it. If you want please give it a try and let me know if it worked.

@@ -21,6 +21,22 @@ pub struct LatestPriceRequest {
pub channel: Channel,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PriceRequest {
Copy link
Contributor

@darunrs darunrs Mar 6, 2025

Choose a reason for hiding this comment

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

How is this API different from the LatestPrice API that router already has? Can we just extend it instead? Granted this is a little late to say it, but I am confused on the positioning of this API.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok I see. We take in a timestamp to fetch the price for. Theoretically we could unify them but I guess that's not a big deal right now.

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.

3 participants