From 6835dc6b468b3b0d1d71f3e9fbec7501b7a342f3 Mon Sep 17 00:00:00 2001 From: raychu86 <14917648+raychu86@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:34:16 -0700 Subject: [PATCH] Remove deprecated rest endpoints --- node/rest/src/lib.rs | 16 ---------------- node/rest/src/routes.rs | 36 ------------------------------------ 2 files changed, 52 deletions(-) diff --git a/node/rest/src/lib.rs b/node/rest/src/lib.rs index 202dbcca0f..be4c074c9c 100644 --- a/node/rest/src/lib.rs +++ b/node/rest/src/lib.rs @@ -135,22 +135,6 @@ impl, R: Routing> Rest { .route(&format!("/{network}/node/address"), get(Self::get_node_address)) .route_layer(middleware::from_fn(auth_middleware)) - // ----------------- DEPRECATED ROUTES ----------------- - // The following `GET ../latest/..` routes will be removed before mainnet. - // Please refer to the recommended routes for each endpoint: - - // Deprecated: use `//block/height/latest` instead. - .route(&format!("/{network}/latest/height"), get(Self::latest_height)) - // Deprecated: use `//block/hash/latest` instead. - .route(&format!("/{network}/latest/hash"), get(Self::latest_hash)) - // Deprecated: use `//latest/block/height` instead. - .route(&format!("/{network}/latest/block"), get(Self::latest_block)) - // Deprecated: use `//stateRoot/latest` instead. - .route(&format!("/{network}/latest/stateRoot"), get(Self::latest_state_root)) - // Deprecated: use `//committee/latest` instead. - .route(&format!("/{network}/latest/committee"), get(Self::latest_committee)) - // ------------------------------------------------------ - // GET ../block/.. .route(&format!("/{network}/block/height/latest"), get(Self::get_block_height_latest)) .route(&format!("/{network}/block/hash/latest"), get(Self::get_block_hash_latest)) diff --git a/node/rest/src/routes.rs b/node/rest/src/routes.rs index 500cbf9b96..8f6807f5b7 100644 --- a/node/rest/src/routes.rs +++ b/node/rest/src/routes.rs @@ -40,42 +40,6 @@ pub(crate) struct Metadata { } impl, R: Routing> Rest { - // ----------------- DEPRECATED FUNCTIONS ----------------- - // The functions below are associated with deprecated routes. - // Please use the recommended alternatives when implementing new features or refactoring. - - // Deprecated: Use `get_block_height_latest` instead. - // GET //latest/height - pub(crate) async fn latest_height(State(rest): State) -> ErasedJson { - ErasedJson::pretty(rest.ledger.latest_height()) - } - - // Deprecated: Use `get_block_hash_latest` instead. - // GET //latest/hash - pub(crate) async fn latest_hash(State(rest): State) -> ErasedJson { - ErasedJson::pretty(rest.ledger.latest_hash()) - } - - // Deprecated: Use `get_block_latest` instead. - // GET //latest/block - pub(crate) async fn latest_block(State(rest): State) -> ErasedJson { - ErasedJson::pretty(rest.ledger.latest_block()) - } - - // Deprecated: Use `get_state_root_latest` instead. - // GET //latest/stateRoot - pub(crate) async fn latest_state_root(State(rest): State) -> ErasedJson { - ErasedJson::pretty(rest.ledger.latest_state_root()) - } - - // Deprecated: Use `get_committee_latest` instead. - // GET //latest/committee - pub(crate) async fn latest_committee(State(rest): State) -> Result { - Ok(ErasedJson::pretty(rest.ledger.latest_committee()?)) - } - - // --------------------------------------------------------- - // GET //block/height/latest pub(crate) async fn get_block_height_latest(State(rest): State) -> ErasedJson { ErasedJson::pretty(rest.ledger.latest_height())