Skip to content

Commit

Permalink
[hermes] Add deprecation notices to old API methods (#1516)
Browse files Browse the repository at this point in the history
* [hermes] Add deprecation notices for doc purposes

* bump version

* deprecation
  • Loading branch information
jayantk committed Apr 29, 2024
1 parent 050a341 commit 6da2e1b
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 2 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.8"
version = "0.5.9"
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
edition = "2021"

Expand Down
1 change: 1 addition & 0 deletions apps/hermes/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ pub async fn run(opts: RunOptions, state: ApiState) -> Result<()> {
// Initialize Axum Router. Note the type here is a `Router<State>` due to the use of the
// `with_state` method which replaces `Body` with `State` in the type signature.
let app = Router::new();
#[allow(deprecated)]
let app = app
.merge(SwaggerUi::new("/docs").url("/docs/openapi.json", ApiDoc::openapi()))
.route("/", get(rest::index))
Expand Down
3 changes: 3 additions & 0 deletions apps/hermes/src/api/rest/get_price_feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pub struct GetPriceFeedQueryParams {
binary: bool,
}

/// **Deprecated: use /v2/updates/price/{publish_time} instead**
///
/// Get a price update for a price feed with a specific timestamp
///
/// Given a price feed id and timestamp, retrieve the Pyth price update closest to that timestamp.
Expand All @@ -62,6 +64,7 @@ pub struct GetPriceFeedQueryParams {
GetPriceFeedQueryParams
)
)]
#[deprecated]
pub async fn get_price_feed<S>(
State(state): State<ApiState<S>>,
QsQuery(params): QsQuery<GetPriceFeedQueryParams>,
Expand Down
3 changes: 3 additions & 0 deletions apps/hermes/src/api/rest/get_vaa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub struct GetVaaResponse {
publish_time: UnixTimestamp,
}

/// **Deprecated: use /v2/updates/price/{publish_time} instead**
///
/// Get a VAA for a price feed with a specific timestamp
///
/// Given a price feed id and timestamp, retrieve the Pyth price update closest to that timestamp.
Expand All @@ -69,6 +71,7 @@ pub struct GetVaaResponse {
GetVaaQueryParams
)
)]
#[deprecated]
pub async fn get_vaa<S>(
State(state): State<ApiState<S>>,
QsQuery(params): QsQuery<GetVaaQueryParams>,
Expand Down
3 changes: 3 additions & 0 deletions apps/hermes/src/api/rest/get_vaa_ccip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pub struct GetVaaCcipResponse {
data: String, // TODO: Use a typed wrapper for the hex output with leading 0x.
}

/// **Deprecated: use /v2/updates/price/{publish_time} instead**
///
/// Get a VAA for a price feed using CCIP
///
/// This endpoint accepts a single argument which is a hex-encoded byte string of the following form:
Expand All @@ -60,6 +62,7 @@ pub struct GetVaaCcipResponse {
GetVaaCcipQueryParams
)
)]
#[deprecated]
pub async fn get_vaa_ccip<S>(
State(state): State<ApiState<S>>,
QsQuery(params): QsQuery<GetVaaCcipQueryParams>,
Expand Down
3 changes: 3 additions & 0 deletions apps/hermes/src/api/rest/latest_price_feeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub struct LatestPriceFeedsQueryParams {
binary: bool,
}

/// **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.
Expand All @@ -63,6 +65,7 @@ pub struct LatestPriceFeedsQueryParams {
LatestPriceFeedsQueryParams
)
)]
#[deprecated]
pub async fn latest_price_feeds<S>(
State(state): State<ApiState<S>>,
QsQuery(params): QsQuery<LatestPriceFeedsQueryParams>,
Expand Down
3 changes: 3 additions & 0 deletions apps/hermes/src/api/rest/latest_vaas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub struct LatestVaasQueryParams {
}


/// **Deprecated: use /v2/updates/price/latest instead**
///
/// Get VAAs for a set of price feed ids.
///
/// Given a collection of price feed ids, retrieve the latest VAA for each. The returned VAA(s) can
Expand All @@ -58,6 +60,7 @@ pub struct LatestVaasQueryParams {
(status = 200, description = "VAAs retrieved successfully", body = Vec<String>, example=json!([doc_examples::vaa_example()]))
),
)]
#[deprecated]
pub async fn latest_vaas<S>(
State(state): State<ApiState<S>>,
QsQuery(params): QsQuery<LatestVaasQueryParams>,
Expand Down
3 changes: 3 additions & 0 deletions apps/hermes/src/api/rest/price_feed_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use {
},
};

/// **Deprecated: use /v2/price_feeds instead**
///
/// Get the set of price feed IDs.
///
/// This endpoint fetches all of the price feed IDs for which price updates can be retrieved.
Expand All @@ -25,6 +27,7 @@ use {
(status = 200, description = "Price feed ids retrieved successfully", body = Vec<RpcPriceIdentifier>)
),
)]
#[deprecated]
pub async fn price_feed_ids<S>(
State(state): State<ApiState<S>>,
) -> Result<Json<Vec<RpcPriceIdentifier>>, RestError>
Expand Down

0 comments on commit 6da2e1b

Please sign in to comment.