Skip to content

Commit

Permalink
fix(apps/hermes/server): use RpcPriceIdentifier instead of PriceIdent…
Browse files Browse the repository at this point in the history
…ifier (#1662)

* use RpcPriceIdentifier instead of PriceIdentifier

* fix test

* fix imports
  • Loading branch information
cctdaniel authored Jun 6, 2024
1 parent 83c1e43 commit 421f349
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/hermes/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/hermes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hermes"
version = "0.5.11"
version = "0.5.12"
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion apps/hermes/src/api/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl TryFrom<PriceUpdate> for PriceFeedsWithUpdateData {

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct PriceFeedMetadata {
pub id: PriceIdentifier,
pub id: RpcPriceIdentifier,
// BTreeMap is used to automatically sort the keys to ensure consistent ordering of attributes in the JSON response.
// This enhances user experience by providing a predictable structure, avoiding confusion from varying orders in different responses.
pub attributes: BTreeMap<String, String>,
Expand Down
8 changes: 5 additions & 3 deletions apps/hermes/src/network/pythnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

use {
crate::{
api::types::PriceFeedMetadata,
api::types::{
PriceFeedMetadata,
RpcPriceIdentifier,
},
config::RunOptions,
network::wormhole::{
BridgeData,
Expand All @@ -30,7 +33,6 @@ use {
},
borsh::BorshDeserialize,
futures::stream::StreamExt,
pyth_sdk::PriceIdentifier,
pyth_sdk_solana::state::{
load_mapping_account,
load_product_account,
Expand Down Expand Up @@ -442,7 +444,7 @@ async fn fetch_price_feeds_metadata(
.expect("Invalid length for PriceIdentifier");

let price_feed_metadata = PriceFeedMetadata {
id: PriceIdentifier::new(px_pkey_array),
id: RpcPriceIdentifier::new(px_pkey_array),
attributes,
};

Expand Down
3 changes: 2 additions & 1 deletion apps/hermes/src/state/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use {
WormholeMerkleState,
},
crate::{
api::types::RpcPriceIdentifier,
network::wormhole::VaaBytes,
state::{
benchmarks::Benchmarks,
Expand Down Expand Up @@ -870,7 +871,7 @@ mod test {
// Add a dummy price feeds metadata
state
.store_price_feeds_metadata(&[PriceFeedMetadata {
id: PriceIdentifier::new([100; 32]),
id: RpcPriceIdentifier::new([100; 32]),
attributes: Default::default(),
}])
.await
Expand Down

0 comments on commit 421f349

Please sign in to comment.