#[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>,
#[prost(message, optional, tag = "4")]
pub regulated_metadata: ::core::option::Option<RegulatedCoinMetadata>,
}
#[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 GetBalanceRequest {
#[prost(string, optional, tag = "1")]
pub owner: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub coin_type: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBalanceResponse {
#[prost(message, optional, tag = "1")]
pub balance: ::core::option::Option<Balance>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBalancesRequest {
#[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 ListBalancesResponse {
#[prost(message, repeated, tag = "1")]
pub balances: ::prost::alloc::vec::Vec<Balance>,
#[prost(bytes = "bytes", optional, tag = "2")]
pub next_page_token: ::core::option::Option<::prost::bytes::Bytes>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Balance {
#[prost(string, optional, tag = "1")]
pub coin_type: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "3")]
pub balance: ::core::option::Option<u64>,
}
#[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(enumeration = "dynamic_field::DynamicFieldKind", optional, tag = "1")]
pub kind: ::core::option::Option<i32>,
#[prost(string, optional, tag = "2")]
pub parent: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "3")]
pub field_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "4")]
pub name_type: ::core::option::Option<::prost::alloc::string::String>,
#[prost(bytes = "bytes", optional, tag = "5")]
pub name_value: ::core::option::Option<::prost::bytes::Bytes>,
#[prost(string, optional, tag = "6")]
pub value_type: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "7")]
pub dynamic_object_id: ::core::option::Option<::prost::alloc::string::String>,
}
pub mod dynamic_field {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum DynamicFieldKind {
Unknown = 0,
Field = 1,
Object = 2,
}
impl DynamicFieldKind {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "DYNAMIC_FIELD_KIND_UNKNOWN",
Self::Field => "FIELD",
Self::Object => "OBJECT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DYNAMIC_FIELD_KIND_UNKNOWN" => Some(Self::Unknown),
"FIELD" => Some(Self::Field),
"OBJECT" => Some(Self::Object),
_ => None,
}
}
}
}
#[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>,
#[prost(enumeration = "simulate_transaction_request::VmChecks", optional, tag = "3")]
pub checks: ::core::option::Option<i32>,
#[prost(bool, optional, tag = "4")]
pub do_gas_selection: ::core::option::Option<bool>,
}
pub mod simulate_transaction_request {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum VmChecks {
Enabled = 0,
Disabled = 1,
}
impl VmChecks {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Enabled => "ENABLED",
Self::Disabled => "DISABLED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENABLED" => Some(Self::Enabled),
"DISABLED" => Some(Self::Disabled),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SimulateTransactionResponse {
#[prost(message, optional, tag = "1")]
pub transaction: ::core::option::Option<super::v2beta::ExecutedTransaction>,
#[prost(message, repeated, tag = "2")]
pub outputs: ::prost::alloc::vec::Vec<CommandResult>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandResult {
#[prost(message, repeated, tag = "1")]
pub return_values: ::prost::alloc::vec::Vec<CommandOutput>,
#[prost(message, repeated, tag = "2")]
pub mutated_by_ref: ::prost::alloc::vec::Vec<CommandOutput>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandOutput {
#[prost(message, optional, tag = "1")]
pub argument: ::core::option::Option<super::v2beta::Argument>,
#[prost(message, optional, tag = "2")]
pub value: ::core::option::Option<super::v2beta::Bcs>,
#[prost(message, optional, boxed, tag = "3")]
pub json: ::core::option::Option<::prost::alloc::boxed::Box<::prost_types::Value>>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOwnedObjectsRequest {
#[prost(string, optional, tag = "1")]
pub owner: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "4")]
pub object_type: ::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 = "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 digest: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag = "5")]
pub owner: ::core::option::Option<super::v2beta::Owner>,
#[prost(string, optional, tag = "6")]
pub object_type: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "200")]
pub balance: ::core::option::Option<u64>,
}
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::Body>,
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::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::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 get_balance(
&mut self,
request: impl tonic::IntoRequest<super::GetBalanceRequest>,
) -> std::result::Result<
tonic::Response<super::GetBalanceResponse>,
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/GetBalance",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("sui.rpc.v2alpha.LiveDataService", "GetBalance"),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_balances(
&mut self,
request: impl tonic::IntoRequest<super::ListBalancesRequest>,
) -> std::result::Result<
tonic::Response<super::ListBalancesResponse>,
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/ListBalances",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("sui.rpc.v2alpha.LiveDataService", "ListBalances"),
);
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 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 get_balance(
&self,
request: tonic::Request<super::GetBalanceRequest>,
) -> std::result::Result<
tonic::Response<super::GetBalanceResponse>,
tonic::Status,
>;
async fn list_balances(
&self,
request: tonic::Request<super::ListBalancesRequest>,
) -> std::result::Result<
tonic::Response<super::ListBalancesResponse>,
tonic::Status,
>;
async fn simulate_transaction(
&self,
request: tonic::Request<super::SimulateTransactionRequest>,
) -> std::result::Result<
tonic::Response<super::SimulateTransactionResponse>,
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::Body>;
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/GetBalance" => {
#[allow(non_camel_case_types)]
struct GetBalanceSvc<T: LiveDataService>(pub Arc<T>);
impl<
T: LiveDataService,
> tonic::server::UnaryService<super::GetBalanceRequest>
for GetBalanceSvc<T> {
type Response = super::GetBalanceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetBalanceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as LiveDataService>::get_balance(&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 = GetBalanceSvc(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/ListBalances" => {
#[allow(non_camel_case_types)]
struct ListBalancesSvc<T: LiveDataService>(pub Arc<T>);
impl<
T: LiveDataService,
> tonic::server::UnaryService<super::ListBalancesRequest>
for ListBalancesSvc<T> {
type Response = super::ListBalancesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListBalancesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as LiveDataService>::list_balances(&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 = ListBalancesSvc(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)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
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 Package {
#[prost(string, optional, tag = "1")]
pub storage_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub original_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "3")]
pub version: ::core::option::Option<u64>,
#[prost(message, repeated, tag = "4")]
pub modules: ::prost::alloc::vec::Vec<Module>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PackageVersion {
#[prost(string, optional, tag = "1")]
pub package_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "2")]
pub version: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Module {
#[prost(string, optional, tag = "1")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, repeated, tag = "3")]
pub datatypes: ::prost::alloc::vec::Vec<DatatypeDescriptor>,
#[prost(message, repeated, tag = "4")]
pub functions: ::prost::alloc::vec::Vec<FunctionDescriptor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DatatypeDescriptor {
#[prost(string, optional, tag = "1")]
pub type_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub defining_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "3")]
pub module: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "4")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration = "Ability", repeated, tag = "5")]
pub abilities: ::prost::alloc::vec::Vec<i32>,
#[prost(message, repeated, tag = "6")]
pub type_parameters: ::prost::alloc::vec::Vec<TypeParameter>,
#[prost(enumeration = "datatype_descriptor::DatatypeKind", optional, tag = "7")]
pub kind: ::core::option::Option<i32>,
#[prost(message, repeated, tag = "8")]
pub fields: ::prost::alloc::vec::Vec<FieldDescriptor>,
#[prost(message, repeated, tag = "9")]
pub variants: ::prost::alloc::vec::Vec<VariantDescriptor>,
}
pub mod datatype_descriptor {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum DatatypeKind {
Unknown = 0,
Struct = 1,
Enum = 2,
}
impl DatatypeKind {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "DATATYPE_KIND_UNKNOWN",
Self::Struct => "STRUCT",
Self::Enum => "ENUM",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DATATYPE_KIND_UNKNOWN" => Some(Self::Unknown),
"STRUCT" => Some(Self::Struct),
"ENUM" => Some(Self::Enum),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AbilitySet {
#[prost(enumeration = "Ability", repeated, tag = "1")]
pub abilities: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TypeParameter {
#[prost(enumeration = "Ability", repeated, tag = "1")]
pub constraints: ::prost::alloc::vec::Vec<i32>,
#[prost(bool, optional, tag = "2")]
pub is_phantom: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FieldDescriptor {
#[prost(string, optional, tag = "1")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "2")]
pub position: ::core::option::Option<u32>,
#[prost(message, optional, tag = "3")]
pub r#type: ::core::option::Option<OpenSignatureBody>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VariantDescriptor {
#[prost(string, optional, tag = "1")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "2")]
pub position: ::core::option::Option<u32>,
#[prost(message, repeated, tag = "3")]
pub fields: ::prost::alloc::vec::Vec<FieldDescriptor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenSignatureBody {
#[prost(enumeration = "open_signature_body::Type", optional, tag = "1")]
pub r#type: ::core::option::Option<i32>,
#[prost(string, optional, tag = "2")]
pub type_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, repeated, tag = "3")]
pub type_parameter_instantiation: ::prost::alloc::vec::Vec<OpenSignatureBody>,
#[prost(uint32, optional, tag = "4")]
pub type_parameter: ::core::option::Option<u32>,
}
pub mod open_signature_body {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
Unknown = 0,
Address = 1,
Bool = 2,
U8 = 3,
U16 = 4,
U32 = 5,
U64 = 6,
U128 = 7,
U256 = 8,
Vector = 9,
Datatype = 10,
Parameter = 11,
}
impl Type {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "TYPE_UNKNOWN",
Self::Address => "ADDRESS",
Self::Bool => "BOOL",
Self::U8 => "U8",
Self::U16 => "U16",
Self::U32 => "U32",
Self::U64 => "U64",
Self::U128 => "U128",
Self::U256 => "U256",
Self::Vector => "VECTOR",
Self::Datatype => "DATATYPE",
Self::Parameter => "TYPE_PARAMETER",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNKNOWN" => Some(Self::Unknown),
"ADDRESS" => Some(Self::Address),
"BOOL" => Some(Self::Bool),
"U8" => Some(Self::U8),
"U16" => Some(Self::U16),
"U32" => Some(Self::U32),
"U64" => Some(Self::U64),
"U128" => Some(Self::U128),
"U256" => Some(Self::U256),
"VECTOR" => Some(Self::Vector),
"DATATYPE" => Some(Self::Datatype),
"TYPE_PARAMETER" => Some(Self::Parameter),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FunctionDescriptor {
#[prost(string, optional, tag = "1")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration = "function_descriptor::Visibility", optional, tag = "5")]
pub visibility: ::core::option::Option<i32>,
#[prost(bool, optional, tag = "6")]
pub is_entry: ::core::option::Option<bool>,
#[prost(message, repeated, tag = "7")]
pub type_parameters: ::prost::alloc::vec::Vec<AbilitySet>,
#[prost(message, repeated, tag = "8")]
pub parameters: ::prost::alloc::vec::Vec<OpenSignature>,
#[prost(message, repeated, tag = "9")]
pub returns: ::prost::alloc::vec::Vec<OpenSignature>,
}
pub mod function_descriptor {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Visibility {
Unknown = 0,
Private = 1,
Public = 2,
Friend = 3,
}
impl Visibility {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "VISIBILITY_UNKNOWN",
Self::Private => "PRIVATE",
Self::Public => "PUBLIC",
Self::Friend => "FRIEND",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"VISIBILITY_UNKNOWN" => Some(Self::Unknown),
"PRIVATE" => Some(Self::Private),
"PUBLIC" => Some(Self::Public),
"FRIEND" => Some(Self::Friend),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenSignature {
#[prost(enumeration = "open_signature::Reference", optional, tag = "1")]
pub reference: ::core::option::Option<i32>,
#[prost(message, optional, tag = "2")]
pub body: ::core::option::Option<OpenSignatureBody>,
}
pub mod open_signature {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Reference {
Unknown = 0,
Immutable = 1,
Mutable = 2,
}
impl Reference {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "REFERENCE_UNKNOWN",
Self::Immutable => "IMMUTABLE",
Self::Mutable => "MUTABLE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"REFERENCE_UNKNOWN" => Some(Self::Unknown),
"IMMUTABLE" => Some(Self::Immutable),
"MUTABLE" => Some(Self::Mutable),
_ => None,
}
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Ability {
Unknown = 0,
Copy = 1,
Drop = 2,
Store = 3,
Key = 4,
}
impl Ability {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "ABILITY_UNKNOWN",
Self::Copy => "COPY",
Self::Drop => "DROP",
Self::Store => "STORE",
Self::Key => "KEY",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ABILITY_UNKNOWN" => Some(Self::Unknown),
"COPY" => Some(Self::Copy),
"DROP" => Some(Self::Drop),
"STORE" => Some(Self::Store),
"KEY" => Some(Self::Key),
_ => None,
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetPackageRequest {
#[prost(string, optional, tag = "1")]
pub package_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetPackageResponse {
#[prost(message, optional, tag = "1")]
pub package: ::core::option::Option<Package>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetModuleRequest {
#[prost(string, optional, tag = "1")]
pub package_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub module_name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetModuleResponse {
#[prost(message, optional, tag = "1")]
pub module: ::core::option::Option<Module>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatatypeRequest {
#[prost(string, optional, tag = "1")]
pub package_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub module_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "3")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatatypeResponse {
#[prost(message, optional, tag = "1")]
pub datatype: ::core::option::Option<DatatypeDescriptor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetFunctionRequest {
#[prost(string, optional, tag = "1")]
pub package_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub module_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "3")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetFunctionResponse {
#[prost(message, optional, tag = "1")]
pub function: ::core::option::Option<FunctionDescriptor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPackageVersionsRequest {
#[prost(string, optional, tag = "1")]
pub package_id: ::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 ListPackageVersionsResponse {
#[prost(message, repeated, tag = "1")]
pub versions: ::prost::alloc::vec::Vec<PackageVersion>,
#[prost(bytes = "bytes", optional, tag = "2")]
pub next_page_token: ::core::option::Option<::prost::bytes::Bytes>,
}
pub mod move_package_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 MovePackageServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MovePackageServiceClient<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> MovePackageServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
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,
) -> MovePackageServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
MovePackageServiceClient::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 get_package(
&mut self,
request: impl tonic::IntoRequest<super::GetPackageRequest>,
) -> std::result::Result<
tonic::Response<super::GetPackageResponse>,
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.MovePackageService/GetPackage",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("sui.rpc.v2alpha.MovePackageService", "GetPackage"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_module(
&mut self,
request: impl tonic::IntoRequest<super::GetModuleRequest>,
) -> std::result::Result<
tonic::Response<super::GetModuleResponse>,
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.MovePackageService/GetModule",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("sui.rpc.v2alpha.MovePackageService", "GetModule"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_datatype(
&mut self,
request: impl tonic::IntoRequest<super::GetDatatypeRequest>,
) -> std::result::Result<
tonic::Response<super::GetDatatypeResponse>,
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.MovePackageService/GetDatatype",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("sui.rpc.v2alpha.MovePackageService", "GetDatatype"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_function(
&mut self,
request: impl tonic::IntoRequest<super::GetFunctionRequest>,
) -> std::result::Result<
tonic::Response<super::GetFunctionResponse>,
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.MovePackageService/GetFunction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("sui.rpc.v2alpha.MovePackageService", "GetFunction"),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_package_versions(
&mut self,
request: impl tonic::IntoRequest<super::ListPackageVersionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListPackageVersionsResponse>,
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.MovePackageService/ListPackageVersions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"sui.rpc.v2alpha.MovePackageService",
"ListPackageVersions",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod move_package_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait MovePackageService: std::marker::Send + std::marker::Sync + 'static {
async fn get_package(
&self,
request: tonic::Request<super::GetPackageRequest>,
) -> std::result::Result<
tonic::Response<super::GetPackageResponse>,
tonic::Status,
>;
async fn get_module(
&self,
request: tonic::Request<super::GetModuleRequest>,
) -> std::result::Result<
tonic::Response<super::GetModuleResponse>,
tonic::Status,
>;
async fn get_datatype(
&self,
request: tonic::Request<super::GetDatatypeRequest>,
) -> std::result::Result<
tonic::Response<super::GetDatatypeResponse>,
tonic::Status,
>;
async fn get_function(
&self,
request: tonic::Request<super::GetFunctionRequest>,
) -> std::result::Result<
tonic::Response<super::GetFunctionResponse>,
tonic::Status,
>;
async fn list_package_versions(
&self,
request: tonic::Request<super::ListPackageVersionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListPackageVersionsResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct MovePackageServiceServer<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> MovePackageServiceServer<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 MovePackageServiceServer<T>
where
T: MovePackageService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
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.MovePackageService/GetPackage" => {
#[allow(non_camel_case_types)]
struct GetPackageSvc<T: MovePackageService>(pub Arc<T>);
impl<
T: MovePackageService,
> tonic::server::UnaryService<super::GetPackageRequest>
for GetPackageSvc<T> {
type Response = super::GetPackageResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetPackageRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MovePackageService>::get_package(&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 = GetPackageSvc(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.MovePackageService/GetModule" => {
#[allow(non_camel_case_types)]
struct GetModuleSvc<T: MovePackageService>(pub Arc<T>);
impl<
T: MovePackageService,
> tonic::server::UnaryService<super::GetModuleRequest>
for GetModuleSvc<T> {
type Response = super::GetModuleResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetModuleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MovePackageService>::get_module(&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 = GetModuleSvc(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.MovePackageService/GetDatatype" => {
#[allow(non_camel_case_types)]
struct GetDatatypeSvc<T: MovePackageService>(pub Arc<T>);
impl<
T: MovePackageService,
> tonic::server::UnaryService<super::GetDatatypeRequest>
for GetDatatypeSvc<T> {
type Response = super::GetDatatypeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetDatatypeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MovePackageService>::get_datatype(&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 = GetDatatypeSvc(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.MovePackageService/GetFunction" => {
#[allow(non_camel_case_types)]
struct GetFunctionSvc<T: MovePackageService>(pub Arc<T>);
impl<
T: MovePackageService,
> tonic::server::UnaryService<super::GetFunctionRequest>
for GetFunctionSvc<T> {
type Response = super::GetFunctionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetFunctionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MovePackageService>::get_function(&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 = GetFunctionSvc(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.MovePackageService/ListPackageVersions" => {
#[allow(non_camel_case_types)]
struct ListPackageVersionsSvc<T: MovePackageService>(pub Arc<T>);
impl<
T: MovePackageService,
> tonic::server::UnaryService<super::ListPackageVersionsRequest>
for ListPackageVersionsSvc<T> {
type Response = super::ListPackageVersionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListPackageVersionsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MovePackageService>::list_package_versions(
&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 = ListPackageVersionsSvc(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(
tonic::body::Body::default(),
);
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 MovePackageServiceServer<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.MovePackageService";
impl<T> tonic::server::NamedService for MovePackageServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VerifySignatureRequest {
#[prost(message, optional, tag = "1")]
pub message: ::core::option::Option<super::v2beta::Bcs>,
#[prost(message, optional, tag = "2")]
pub signature: ::core::option::Option<super::v2beta::UserSignature>,
#[prost(string, optional, tag = "3")]
pub address: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, repeated, tag = "4")]
pub jwks: ::prost::alloc::vec::Vec<super::v2beta::ActiveJwk>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VerifySignatureResponse {
#[prost(bool, optional, tag = "1")]
pub is_valid: ::core::option::Option<bool>,
#[prost(string, optional, tag = "2")]
pub reason: ::core::option::Option<::prost::alloc::string::String>,
}
pub mod signature_verification_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 SignatureVerificationServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SignatureVerificationServiceClient<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> SignatureVerificationServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
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,
) -> SignatureVerificationServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
SignatureVerificationServiceClient::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 verify_signature(
&mut self,
request: impl tonic::IntoRequest<super::VerifySignatureRequest>,
) -> std::result::Result<
tonic::Response<super::VerifySignatureResponse>,
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.SignatureVerificationService/VerifySignature",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"sui.rpc.v2alpha.SignatureVerificationService",
"VerifySignature",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod signature_verification_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait SignatureVerificationService: std::marker::Send + std::marker::Sync + 'static {
async fn verify_signature(
&self,
request: tonic::Request<super::VerifySignatureRequest>,
) -> std::result::Result<
tonic::Response<super::VerifySignatureResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct SignatureVerificationServiceServer<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> SignatureVerificationServiceServer<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 SignatureVerificationServiceServer<T>
where
T: SignatureVerificationService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
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.SignatureVerificationService/VerifySignature" => {
#[allow(non_camel_case_types)]
struct VerifySignatureSvc<T: SignatureVerificationService>(
pub Arc<T>,
);
impl<
T: SignatureVerificationService,
> tonic::server::UnaryService<super::VerifySignatureRequest>
for VerifySignatureSvc<T> {
type Response = super::VerifySignatureResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::VerifySignatureRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SignatureVerificationService>::verify_signature(
&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 = VerifySignatureSvc(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(
tonic::body::Body::default(),
);
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 SignatureVerificationServiceServer<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.SignatureVerificationService";
impl<T> tonic::server::NamedService for SignatureVerificationServiceServer<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::Body>,
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::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::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::Body>;
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(
tonic::body::Body::default(),
);
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;
}
}