Skip to content

Commit

Permalink
rpc: sunset the old experimental rest service
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Feb 7, 2025
1 parent e050af0 commit aa2493a
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 804 deletions.
4 changes: 1 addition & 3 deletions crates/sui-rpc-api/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
mod response_ext;
pub use response_ext::ResponseExt;

pub mod sdk;
use sdk::BoxError;

pub use reqwest;
use tap::Pipe;
use tonic::metadata::MetadataMap;
Expand All @@ -26,6 +23,7 @@ use sui_types::object::Object;
use sui_types::transaction::Transaction;

pub type Result<T, E = tonic::Status> = std::result::Result<T, E>;
pub type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;

use tonic::transport::channel::ClientTlsConfig;
use tonic::Status;
Expand Down
315 changes: 0 additions & 315 deletions crates/sui-rpc-api/src/client/sdk.rs

This file was deleted.

10 changes: 0 additions & 10 deletions crates/sui-rpc-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct Config {
/// Enable the experimental REST api
///
/// Defaults to `false`
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_experimental_rest_api: Option<bool>,

/// Enable indexing of transactions and objects
///
/// This enables indexing of transactions and objects which allows for a slightly richer rpc
Expand All @@ -30,10 +24,6 @@ pub struct Config {
}

impl Config {
pub fn enable_experimental_rest_api(&self) -> bool {
self.enable_experimental_rest_api.unwrap_or(false)
}

pub fn enable_indexing(&self) -> bool {
self.enable_indexing.unwrap_or(false)
}
Expand Down
10 changes: 2 additions & 8 deletions crates/sui-rpc-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use mysten_network::callback::CallbackLayer;
use proto::node::v2alpha::subscription_service_server::SubscriptionServiceServer;
use reader::StateReader;
use rest::build_rest_router;
use std::sync::Arc;
use subscription::SubscriptionServiceHandle;
use sui_types::storage::RpcStateReader;
Expand All @@ -19,7 +18,6 @@ mod metrics;
pub mod proto;
mod reader;
mod response;
pub mod rest;
mod service;
pub mod subscription;
pub mod types;
Expand Down Expand Up @@ -91,7 +89,7 @@ impl RpcService {
pub async fn into_router(self) -> axum::Router {
let metrics = self.metrics.clone();

let mut router = {
let router = {
let node_service =
crate::proto::node::v2::node_service_server::NodeServiceServer::new(self.clone());
let node_service_alpha =
Expand Down Expand Up @@ -153,12 +151,8 @@ impl RpcService {
services.into_router()
};

if self.config.enable_experimental_rest_api() {
router = router.merge(build_rest_router(self.clone()));
}

let health_endpoint = axum::Router::new()
.route("/health", axum::routing::get(rest::health::health))
.route("/health", axum::routing::get(service::health::health))
.with_state(self.clone());

router
Expand Down
Loading

0 comments on commit aa2493a

Please sign in to comment.