#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCoinInfoRequest {
#[prost(string, optional, tag = "1")]
pub coin_type: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCoinInfoResponse {
#[prost(string, optional, tag = "1")]
pub coin_type: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag = "2")]
pub metadata: ::core::option::Option<CoinMetadata>,
#[prost(message, optional, tag = "3")]
pub treasury: ::core::option::Option<CoinTreasury>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CoinMetadata {
#[prost(string, optional, tag = "1")]
pub id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "2")]
pub decimals: ::core::option::Option<u32>,
#[prost(string, optional, tag = "3")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "4")]
pub symbol: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "5")]
pub description: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "6")]
pub icon_url: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CoinTreasury {
#[prost(string, optional, tag = "1")]
pub id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "2")]
pub total_supply: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegulatedCoinMetadata {
#[prost(string, optional, tag = "1")]
pub id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub coin_metadata_object: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "3")]
pub deny_cap_object: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDynamicFieldsRequest {
#[prost(string, optional, tag = "1")]
pub parent: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "2")]
pub page_size: ::core::option::Option<u32>,
#[prost(bytes = "bytes", optional, tag = "3")]
pub page_token: ::core::option::Option<::prost::bytes::Bytes>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDynamicFieldsResponse {
#[prost(message, repeated, tag = "1")]
pub dynamic_fields: ::prost::alloc::vec::Vec<DynamicField>,
#[prost(bytes = "bytes", optional, tag = "2")]
pub next_page_token: ::core::option::Option<::prost::bytes::Bytes>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DynamicField {
#[prost(string, optional, tag = "1")]
pub parent: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub field_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "3")]
pub name_type: ::core::option::Option<::prost::alloc::string::String>,
#[prost(bytes = "bytes", optional, tag = "4")]
pub name_value: ::core::option::Option<::prost::bytes::Bytes>,
#[prost(string, optional, tag = "5")]
pub dynamic_object_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SimulateTransactionRequest {
#[prost(message, optional, tag = "1")]
pub transaction: ::core::option::Option<super::v2beta::Transaction>,
#[prost(message, optional, tag = "2")]
pub read_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SimulateTransactionResponse {
#[prost(message, optional, tag = "1")]
pub transaction: ::core::option::Option<super::v2beta::ExecutedTransaction>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResolveTransactionRequest {
#[prost(string, optional, tag = "1")]
pub unresolved_transaction: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag = "2")]
pub read_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResolveTransactionResponse {
#[prost(message, optional, tag = "1")]
pub transaction: ::core::option::Option<super::v2beta::Transaction>,
#[prost(message, optional, tag = "2")]
pub simulation: ::core::option::Option<SimulateTransactionResponse>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOwnedObjectsRequest {
#[prost(string, optional, tag = "1")]
pub owner: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "2")]
pub page_size: ::core::option::Option<u32>,
#[prost(bytes = "bytes", optional, tag = "3")]
pub page_token: ::core::option::Option<::prost::bytes::Bytes>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOwnedObjectsResponse {
#[prost(message, repeated, tag = "1")]
pub objects: ::prost::alloc::vec::Vec<OwnedObject>,
#[prost(bytes = "bytes", optional, tag = "2")]
pub next_page_token: ::core::option::Option<::prost::bytes::Bytes>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OwnedObject {
#[prost(string, optional, tag = "1")]
pub owner: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub object_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "3")]
pub version: ::core::option::Option<u64>,
#[prost(string, optional, tag = "4")]
pub object_type: ::core::option::Option<::prost::alloc::string::String>,
}
pub mod live_data_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct LiveDataServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl LiveDataServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> LiveDataServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> LiveDataServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
LiveDataServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn list_dynamic_fields(
&mut self,
request: impl tonic::IntoRequest<super::ListDynamicFieldsRequest>,
) -> std::result::Result<
tonic::Response<super::ListDynamicFieldsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.rpc.v2alpha.LiveDataService/ListDynamicFields",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"sui.rpc.v2alpha.LiveDataService",
"ListDynamicFields",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_owned_objects(
&mut self,
request: impl tonic::IntoRequest<super::ListOwnedObjectsRequest>,
) -> std::result::Result<
tonic::Response<super::ListOwnedObjectsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.rpc.v2alpha.LiveDataService/ListOwnedObjects",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"sui.rpc.v2alpha.LiveDataService",
"ListOwnedObjects",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_coin_info(
&mut self,
request: impl tonic::IntoRequest<super::GetCoinInfoRequest>,
) -> std::result::Result<
tonic::Response<super::GetCoinInfoResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.rpc.v2alpha.LiveDataService/GetCoinInfo",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("sui.rpc.v2alpha.LiveDataService", "GetCoinInfo"),
);
self.inner.unary(req, path, codec).await
}
pub async fn simulate_transaction(
&mut self,
request: impl tonic::IntoRequest<super::SimulateTransactionRequest>,
) -> std::result::Result<
tonic::Response<super::SimulateTransactionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.rpc.v2alpha.LiveDataService/SimulateTransaction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"sui.rpc.v2alpha.LiveDataService",
"SimulateTransaction",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn resolve_transaction(
&mut self,
request: impl tonic::IntoRequest<super::ResolveTransactionRequest>,
) -> std::result::Result<
tonic::Response<super::ResolveTransactionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.rpc.v2alpha.LiveDataService/ResolveTransaction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"sui.rpc.v2alpha.LiveDataService",
"ResolveTransaction",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod live_data_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait LiveDataService: std::marker::Send + std::marker::Sync + 'static {
async fn list_dynamic_fields(
&self,
request: tonic::Request<super::ListDynamicFieldsRequest>,
) -> std::result::Result<
tonic::Response<super::ListDynamicFieldsResponse>,
tonic::Status,
>;
async fn list_owned_objects(
&self,
request: tonic::Request<super::ListOwnedObjectsRequest>,
) -> std::result::Result<
tonic::Response<super::ListOwnedObjectsResponse>,
tonic::Status,
>;
async fn get_coin_info(
&self,
request: tonic::Request<super::GetCoinInfoRequest>,
) -> std::result::Result<
tonic::Response<super::GetCoinInfoResponse>,
tonic::Status,
>;
async fn simulate_transaction(
&self,
request: tonic::Request<super::SimulateTransactionRequest>,
) -> std::result::Result<
tonic::Response<super::SimulateTransactionResponse>,
tonic::Status,
>;
async fn resolve_transaction(
&self,
request: tonic::Request<super::ResolveTransactionRequest>,
) -> std::result::Result<
tonic::Response<super::ResolveTransactionResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct LiveDataServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> LiveDataServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for LiveDataServiceServer<T>
where
T: LiveDataService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/sui.rpc.v2alpha.LiveDataService/ListDynamicFields" => {
#[allow(non_camel_case_types)]
struct ListDynamicFieldsSvc<T: LiveDataService>(pub Arc<T>);
impl<
T: LiveDataService,
> tonic::server::UnaryService<super::ListDynamicFieldsRequest>
for ListDynamicFieldsSvc<T> {
type Response = super::ListDynamicFieldsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListDynamicFieldsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as LiveDataService>::list_dynamic_fields(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListDynamicFieldsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/sui.rpc.v2alpha.LiveDataService/ListOwnedObjects" => {
#[allow(non_camel_case_types)]
struct ListOwnedObjectsSvc<T: LiveDataService>(pub Arc<T>);
impl<
T: LiveDataService,
> tonic::server::UnaryService<super::ListOwnedObjectsRequest>
for ListOwnedObjectsSvc<T> {
type Response = super::ListOwnedObjectsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListOwnedObjectsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as LiveDataService>::list_owned_objects(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListOwnedObjectsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/sui.rpc.v2alpha.LiveDataService/GetCoinInfo" => {
#[allow(non_camel_case_types)]
struct GetCoinInfoSvc<T: LiveDataService>(pub Arc<T>);
impl<
T: LiveDataService,
> tonic::server::UnaryService<super::GetCoinInfoRequest>
for GetCoinInfoSvc<T> {
type Response = super::GetCoinInfoResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetCoinInfoRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as LiveDataService>::get_coin_info(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetCoinInfoSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/sui.rpc.v2alpha.LiveDataService/SimulateTransaction" => {
#[allow(non_camel_case_types)]
struct SimulateTransactionSvc<T: LiveDataService>(pub Arc<T>);
impl<
T: LiveDataService,
> tonic::server::UnaryService<super::SimulateTransactionRequest>
for SimulateTransactionSvc<T> {
type Response = super::SimulateTransactionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SimulateTransactionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as LiveDataService>::simulate_transaction(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SimulateTransactionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/sui.rpc.v2alpha.LiveDataService/ResolveTransaction" => {
#[allow(non_camel_case_types)]
struct ResolveTransactionSvc<T: LiveDataService>(pub Arc<T>);
impl<
T: LiveDataService,
> tonic::server::UnaryService<super::ResolveTransactionRequest>
for ResolveTransactionSvc<T> {
type Response = super::ResolveTransactionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ResolveTransactionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as LiveDataService>::resolve_transaction(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ResolveTransactionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for LiveDataServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "sui.rpc.v2alpha.LiveDataService";
impl<T> tonic::server::NamedService for LiveDataServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeCheckpointsRequest {
#[prost(message, optional, tag = "1")]
pub read_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeCheckpointsResponse {
#[prost(uint64, optional, tag = "1")]
pub cursor: ::core::option::Option<u64>,
#[prost(message, optional, tag = "2")]
pub checkpoint: ::core::option::Option<super::v2beta::Checkpoint>,
}
pub mod subscription_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct SubscriptionServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SubscriptionServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SubscriptionServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SubscriptionServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
SubscriptionServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn subscribe_checkpoints(
&mut self,
request: impl tonic::IntoRequest<super::SubscribeCheckpointsRequest>,
) -> std::result::Result<
tonic::Response<
tonic::codec::Streaming<super::SubscribeCheckpointsResponse>,
>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.rpc.v2alpha.SubscriptionService/SubscribeCheckpoints",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"sui.rpc.v2alpha.SubscriptionService",
"SubscribeCheckpoints",
),
);
self.inner.server_streaming(req, path, codec).await
}
}
}
pub mod subscription_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait SubscriptionService: std::marker::Send + std::marker::Sync + 'static {
type SubscribeCheckpointsStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<
super::SubscribeCheckpointsResponse,
tonic::Status,
>,
>
+ std::marker::Send
+ 'static;
async fn subscribe_checkpoints(
&self,
request: tonic::Request<super::SubscribeCheckpointsRequest>,
) -> std::result::Result<
tonic::Response<Self::SubscribeCheckpointsStream>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct SubscriptionServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> SubscriptionServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for SubscriptionServiceServer<T>
where
T: SubscriptionService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/sui.rpc.v2alpha.SubscriptionService/SubscribeCheckpoints" => {
#[allow(non_camel_case_types)]
struct SubscribeCheckpointsSvc<T: SubscriptionService>(pub Arc<T>);
impl<
T: SubscriptionService,
> tonic::server::ServerStreamingService<
super::SubscribeCheckpointsRequest,
> for SubscribeCheckpointsSvc<T> {
type Response = super::SubscribeCheckpointsResponse;
type ResponseStream = T::SubscribeCheckpointsStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubscribeCheckpointsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SubscriptionService>::subscribe_checkpoints(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SubscribeCheckpointsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for SubscriptionServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "sui.rpc.v2alpha.SubscriptionService";
impl<T> tonic::server::NamedService for SubscriptionServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}