Skip to content

feat: add Rust client for Hermes price service #2686

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented May 14, 2025

Hermes Rust Client

This PR adds a Rust client for the Hermes price service, similar to the existing JavaScript client. The client allows users to interact with the Hermes API to fetch price data and stream real-time price updates.

Implementation Details

  • The client was generated using swagger-codegen from the Hermes OpenAPI specification
  • See the README for a full description
  • The streaming functionality is handled separately from the auto-generated code because:
    1. The auto-generated SSE implementation doesn't provide a true streaming experience (it polls in a loop)
    2. The custom implementation uses the eventsource-stream crate to handle Server-Sent Events properly

Features

  • Fetch latest price updates for specific price feed IDs
  • Stream real-time price updates using Server-Sent Events
  • Examples for both fetching latest prices and streaming updates
  • Comprehensive README with usage instructions

Testing

The implementation has been tested with example code that:

  • Fetches the latest price updates for BTC/USD and ETH/USD
  • Streams real-time price updates for BTC/USD and ETH/USD

Link to Devin run: https://app.devin.ai/sessions/68823d31375f4cb9bd88f8d362148446
Requested by: Tejas Badadare

@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner May 14, 2025 19:02
Copy link

vercel bot commented May 14, 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 May 27, 2025 0:35am
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 0:35am
developer-hub ❌ Failed (Inspect) May 27, 2025 0:35am
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 0:35am
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 0:35am
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 0:35am
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 0:35am
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 0:35am

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

Closing due to inactivity for more than 7 days.

}

/// **Deprecated: use /v2/updates/price/latest instead** Get the latest price updates by price feed id. Given a collection of price feed ids, retrieve the latest Pyth price for each price feed.
pub async fn latest_price_feeds(configuration: &configuration::Configuration, ids_left_square_bracket_right_square_bracket: Vec<String>, verbose: Option<bool>, binary: Option<bool>) -> Result<Vec<models::RpcPriceFeed>, Error<LatestPriceFeedsError>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ids_left_square_bracket_right_square_bracket lool

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please rename it to ids

Comment on lines 38 to 40
[[example]]
name = "sse_price_stream"
path = "examples/sse_price_stream.rs"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't exist.

@ali-behjati
Copy link
Collaborator

Devin, add a CI to build and test the code like ci-hermes-server.yml

Co-Authored-By: Tejas Badadare <[email protected]>
--additional-properties=packageName=hermes-client,packageVersion=0.1.0
```

3. Manually update dependencies in Cargo.toml and version number if necessary.
Copy link
Collaborator

Choose a reason for hiding this comment

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

add the other step you took here,

  1. a separate streaming code
  2. renaming field names to be more intuitive
  3. fixing format and clippy

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.

1 participant