#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetValidatorSetByHeightRequest {
#[prost(int64, tag = "1")]
pub height: i64,
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<super::super::query::v1beta1::PageRequest>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetValidatorSetByHeightResponse {
#[prost(int64, tag = "1")]
pub block_height: i64,
#[prost(message, repeated, tag = "2")]
pub validators: ::prost::alloc::vec::Vec<Validator>,
#[prost(message, optional, tag = "3")]
pub pagination: ::core::option::Option<super::super::query::v1beta1::PageResponse>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLatestValidatorSetRequest {
#[prost(message, optional, tag = "1")]
pub pagination: ::core::option::Option<super::super::query::v1beta1::PageRequest>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLatestValidatorSetResponse {
#[prost(int64, tag = "1")]
pub block_height: i64,
#[prost(message, repeated, tag = "2")]
pub validators: ::prost::alloc::vec::Vec<Validator>,
#[prost(message, optional, tag = "3")]
pub pagination: ::core::option::Option<super::super::query::v1beta1::PageResponse>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Validator {
#[prost(string, tag = "1")]
pub address: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub pub_key: ::core::option::Option<::prost_types::Any>,
#[prost(int64, tag = "3")]
pub voting_power: i64,
#[prost(int64, tag = "4")]
pub proposer_priority: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBlockByHeightRequest {
#[prost(int64, tag = "1")]
pub height: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBlockByHeightResponse {
#[prost(message, optional, tag = "1")]
pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>,
#[prost(message, optional, tag = "2")]
pub block: ::core::option::Option<::tendermint_proto::types::Block>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLatestBlockRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLatestBlockResponse {
#[prost(message, optional, tag = "1")]
pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>,
#[prost(message, optional, tag = "2")]
pub block: ::core::option::Option<::tendermint_proto::types::Block>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSyncingRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSyncingResponse {
#[prost(bool, tag = "1")]
pub syncing: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNodeInfoRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNodeInfoResponse {
#[prost(message, optional, tag = "1")]
pub default_node_info: ::core::option::Option<::tendermint_proto::p2p::DefaultNodeInfo>,
#[prost(message, optional, tag = "2")]
pub application_version: ::core::option::Option<VersionInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VersionInfo {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub app_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub version: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub git_commit: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub build_tags: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub go_version: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "7")]
pub build_deps: ::prost::alloc::vec::Vec<Module>,
#[prost(string, tag = "8")]
pub cosmos_sdk_version: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Module {
#[prost(string, tag = "1")]
pub path: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub sum: ::prost::alloc::string::String,
}
#[cfg(feature = "grpc")]
#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
pub mod service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct ServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
#[cfg(feature = "grpc-transport")]
#[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
impl ServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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,
) -> ServiceClient<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> + Send + Sync,
{
ServiceClient::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
}
pub async fn get_node_info(
&mut self,
request: impl tonic::IntoRequest<super::GetNodeInfoRequest>,
) -> Result<tonic::Response<super::GetNodeInfoResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cosmos.base.tendermint.v1beta1.Service/GetNodeInfo",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_syncing(
&mut self,
request: impl tonic::IntoRequest<super::GetSyncingRequest>,
) -> Result<tonic::Response<super::GetSyncingResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cosmos.base.tendermint.v1beta1.Service/GetSyncing",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_latest_block(
&mut self,
request: impl tonic::IntoRequest<super::GetLatestBlockRequest>,
) -> Result<tonic::Response<super::GetLatestBlockResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cosmos.base.tendermint.v1beta1.Service/GetLatestBlock",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_block_by_height(
&mut self,
request: impl tonic::IntoRequest<super::GetBlockByHeightRequest>,
) -> Result<tonic::Response<super::GetBlockByHeightResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cosmos.base.tendermint.v1beta1.Service/GetBlockByHeight",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_latest_validator_set(
&mut self,
request: impl tonic::IntoRequest<super::GetLatestValidatorSetRequest>,
) -> Result<tonic::Response<super::GetLatestValidatorSetResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cosmos.base.tendermint.v1beta1.Service/GetLatestValidatorSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_validator_set_by_height(
&mut self,
request: impl tonic::IntoRequest<super::GetValidatorSetByHeightRequest>,
) -> Result<tonic::Response<super::GetValidatorSetByHeightResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/cosmos.base.tendermint.v1beta1.Service/GetValidatorSetByHeight",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[cfg(feature = "grpc")]
#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
pub mod service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Service: Send + Sync + 'static {
async fn get_node_info(
&self,
request: tonic::Request<super::GetNodeInfoRequest>,
) -> Result<tonic::Response<super::GetNodeInfoResponse>, tonic::Status>;
async fn get_syncing(
&self,
request: tonic::Request<super::GetSyncingRequest>,
) -> Result<tonic::Response<super::GetSyncingResponse>, tonic::Status>;
async fn get_latest_block(
&self,
request: tonic::Request<super::GetLatestBlockRequest>,
) -> Result<tonic::Response<super::GetLatestBlockResponse>, tonic::Status>;
async fn get_block_by_height(
&self,
request: tonic::Request<super::GetBlockByHeightRequest>,
) -> Result<tonic::Response<super::GetBlockByHeightResponse>, tonic::Status>;
async fn get_latest_validator_set(
&self,
request: tonic::Request<super::GetLatestValidatorSetRequest>,
) -> Result<tonic::Response<super::GetLatestValidatorSetResponse>, tonic::Status>;
async fn get_validator_set_by_height(
&self,
request: tonic::Request<super::GetValidatorSetByHeightRequest>,
) -> Result<tonic::Response<super::GetValidatorSetByHeightResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct ServiceServer<T: Service> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: Service> ServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
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
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ServiceServer<T>
where
T: Service,
B: Body + Send + 'static,
B::Error: Into<StdError> + 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<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/cosmos.base.tendermint.v1beta1.Service/GetNodeInfo" => {
#[allow(non_camel_case_types)]
struct GetNodeInfoSvc<T: Service>(pub Arc<T>);
impl<T: Service> tonic::server::UnaryService<super::GetNodeInfoRequest> for GetNodeInfoSvc<T> {
type Response = super::GetNodeInfoResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetNodeInfoRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get_node_info(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetNodeInfoSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/cosmos.base.tendermint.v1beta1.Service/GetSyncing" => {
#[allow(non_camel_case_types)]
struct GetSyncingSvc<T: Service>(pub Arc<T>);
impl<T: Service> tonic::server::UnaryService<super::GetSyncingRequest> for GetSyncingSvc<T> {
type Response = super::GetSyncingResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetSyncingRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get_syncing(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetSyncingSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/cosmos.base.tendermint.v1beta1.Service/GetLatestBlock" => {
#[allow(non_camel_case_types)]
struct GetLatestBlockSvc<T: Service>(pub Arc<T>);
impl<T: Service> tonic::server::UnaryService<super::GetLatestBlockRequest>
for GetLatestBlockSvc<T>
{
type Response = super::GetLatestBlockResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetLatestBlockRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get_latest_block(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetLatestBlockSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/cosmos.base.tendermint.v1beta1.Service/GetBlockByHeight" => {
#[allow(non_camel_case_types)]
struct GetBlockByHeightSvc<T: Service>(pub Arc<T>);
impl<T: Service> tonic::server::UnaryService<super::GetBlockByHeightRequest>
for GetBlockByHeightSvc<T>
{
type Response = super::GetBlockByHeightResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetBlockByHeightRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get_block_by_height(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetBlockByHeightSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/cosmos.base.tendermint.v1beta1.Service/GetLatestValidatorSet" => {
#[allow(non_camel_case_types)]
struct GetLatestValidatorSetSvc<T: Service>(pub Arc<T>);
impl<T: Service>
tonic::server::UnaryService<super::GetLatestValidatorSetRequest>
for GetLatestValidatorSetSvc<T>
{
type Response = super::GetLatestValidatorSetResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetLatestValidatorSetRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut =
async move { (*inner).get_latest_validator_set(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetLatestValidatorSetSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/cosmos.base.tendermint.v1beta1.Service/GetValidatorSetByHeight" => {
#[allow(non_camel_case_types)]
struct GetValidatorSetByHeightSvc<T: Service>(pub Arc<T>);
impl<T: Service>
tonic::server::UnaryService<super::GetValidatorSetByHeightRequest>
for GetValidatorSetByHeightSvc<T>
{
type Response = super::GetValidatorSetByHeightResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetValidatorSetByHeightRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut =
async move { (*inner).get_validator_set_by_height(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetValidatorSetByHeightSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap())
}),
}
}
}
impl<T: Service> Clone for ServiceServer<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,
}
}
}
impl<T: Service> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Service> tonic::server::NamedService for ServiceServer<T> {
const NAME: &'static str = "cosmos.base.tendermint.v1beta1.Service";
}
}