#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WeightedVoteOption {
#[prost(enumeration = "VoteOption", tag = "1")]
pub option: i32,
#[prost(string, tag = "2")]
pub weight: ::prost::alloc::string::String,
}
impl ::prost::Name for WeightedVoteOption {
const NAME: &'static str = "WeightedVoteOption";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextProposal {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
}
impl ::prost::Name for TextProposal {
const NAME: &'static str = "TextProposal";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Deposit {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(string, tag = "2")]
pub depositor: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
}
impl ::prost::Name for Deposit {
const NAME: &'static str = "Deposit";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Proposal {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(message, optional, tag = "2")]
pub content: ::core::option::Option<super::super::super::google::protobuf::Any>,
#[prost(enumeration = "ProposalStatus", tag = "3")]
pub status: i32,
#[prost(message, optional, tag = "4")]
pub final_tally_result: ::core::option::Option<TallyResult>,
#[prost(message, optional, tag = "5")]
pub submit_time: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, optional, tag = "6")]
pub deposit_end_time: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, repeated, tag = "7")]
pub total_deposit: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
#[prost(message, optional, tag = "8")]
pub voting_start_time: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, optional, tag = "9")]
pub voting_end_time: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
}
impl ::prost::Name for Proposal {
const NAME: &'static str = "Proposal";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TallyResult {
#[prost(string, tag = "1")]
pub yes: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub abstain: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub no: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub no_with_veto: ::prost::alloc::string::String,
}
impl ::prost::Name for TallyResult {
const NAME: &'static str = "TallyResult";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Vote {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(string, tag = "2")]
pub voter: ::prost::alloc::string::String,
#[deprecated]
#[prost(enumeration = "VoteOption", tag = "3")]
pub option: i32,
#[prost(message, repeated, tag = "4")]
pub options: ::prost::alloc::vec::Vec<WeightedVoteOption>,
}
impl ::prost::Name for Vote {
const NAME: &'static str = "Vote";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DepositParams {
#[prost(message, repeated, tag = "1")]
pub min_deposit: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
#[prost(message, optional, tag = "2")]
pub max_deposit_period: ::core::option::Option<
super::super::super::google::protobuf::Duration,
>,
}
impl ::prost::Name for DepositParams {
const NAME: &'static str = "DepositParams";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VotingParams {
#[prost(message, optional, tag = "1")]
pub voting_period: ::core::option::Option<
super::super::super::google::protobuf::Duration,
>,
}
impl ::prost::Name for VotingParams {
const NAME: &'static str = "VotingParams";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TallyParams {
#[prost(bytes = "vec", tag = "1")]
pub quorum: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub threshold: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub veto_threshold: ::prost::alloc::vec::Vec<u8>,
}
impl ::prost::Name for TallyParams {
const NAME: &'static str = "TallyParams";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum VoteOption {
Unspecified = 0,
Yes = 1,
Abstain = 2,
No = 3,
NoWithVeto = 4,
}
impl VoteOption {
pub fn as_str_name(&self) -> &'static str {
match self {
VoteOption::Unspecified => "VOTE_OPTION_UNSPECIFIED",
VoteOption::Yes => "VOTE_OPTION_YES",
VoteOption::Abstain => "VOTE_OPTION_ABSTAIN",
VoteOption::No => "VOTE_OPTION_NO",
VoteOption::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"VOTE_OPTION_UNSPECIFIED" => Some(Self::Unspecified),
"VOTE_OPTION_YES" => Some(Self::Yes),
"VOTE_OPTION_ABSTAIN" => Some(Self::Abstain),
"VOTE_OPTION_NO" => Some(Self::No),
"VOTE_OPTION_NO_WITH_VETO" => Some(Self::NoWithVeto),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ProposalStatus {
Unspecified = 0,
DepositPeriod = 1,
VotingPeriod = 2,
Passed = 3,
Rejected = 4,
Failed = 5,
}
impl ProposalStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
ProposalStatus::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED",
ProposalStatus::DepositPeriod => "PROPOSAL_STATUS_DEPOSIT_PERIOD",
ProposalStatus::VotingPeriod => "PROPOSAL_STATUS_VOTING_PERIOD",
ProposalStatus::Passed => "PROPOSAL_STATUS_PASSED",
ProposalStatus::Rejected => "PROPOSAL_STATUS_REJECTED",
ProposalStatus::Failed => "PROPOSAL_STATUS_FAILED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PROPOSAL_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"PROPOSAL_STATUS_DEPOSIT_PERIOD" => Some(Self::DepositPeriod),
"PROPOSAL_STATUS_VOTING_PERIOD" => Some(Self::VotingPeriod),
"PROPOSAL_STATUS_PASSED" => Some(Self::Passed),
"PROPOSAL_STATUS_REJECTED" => Some(Self::Rejected),
"PROPOSAL_STATUS_FAILED" => Some(Self::Failed),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSubmitProposal {
#[prost(message, optional, tag = "1")]
pub content: ::core::option::Option<super::super::super::google::protobuf::Any>,
#[prost(message, repeated, tag = "2")]
pub initial_deposit: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
#[prost(string, tag = "3")]
pub proposer: ::prost::alloc::string::String,
}
impl ::prost::Name for MsgSubmitProposal {
const NAME: &'static str = "MsgSubmitProposal";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSubmitProposalResponse {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
}
impl ::prost::Name for MsgSubmitProposalResponse {
const NAME: &'static str = "MsgSubmitProposalResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgVote {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(string, tag = "2")]
pub voter: ::prost::alloc::string::String,
#[prost(enumeration = "VoteOption", tag = "3")]
pub option: i32,
}
impl ::prost::Name for MsgVote {
const NAME: &'static str = "MsgVote";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgVoteResponse {}
impl ::prost::Name for MsgVoteResponse {
const NAME: &'static str = "MsgVoteResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgVoteWeighted {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(string, tag = "2")]
pub voter: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub options: ::prost::alloc::vec::Vec<WeightedVoteOption>,
}
impl ::prost::Name for MsgVoteWeighted {
const NAME: &'static str = "MsgVoteWeighted";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgVoteWeightedResponse {}
impl ::prost::Name for MsgVoteWeightedResponse {
const NAME: &'static str = "MsgVoteWeightedResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgDeposit {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(string, tag = "2")]
pub depositor: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
}
impl ::prost::Name for MsgDeposit {
const NAME: &'static str = "MsgDeposit";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgDepositResponse {}
impl ::prost::Name for MsgDepositResponse {
const NAME: &'static str = "MsgDepositResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[cfg(feature = "client")]
pub mod msg_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MsgClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MsgClient<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> MsgClient<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,
) -> MsgClient<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,
{
MsgClient::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 submit_proposal(
&mut self,
request: impl tonic::IntoRequest<super::MsgSubmitProposal>,
) -> std::result::Result<
tonic::Response<super::MsgSubmitProposalResponse>,
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.gov.v1beta1.Msg/SubmitProposal",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Msg", "SubmitProposal"));
self.inner.unary(req, path, codec).await
}
pub async fn vote(
&mut self,
request: impl tonic::IntoRequest<super::MsgVote>,
) -> std::result::Result<
tonic::Response<super::MsgVoteResponse>,
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.gov.v1beta1.Msg/Vote",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Msg", "Vote"));
self.inner.unary(req, path, codec).await
}
pub async fn vote_weighted(
&mut self,
request: impl tonic::IntoRequest<super::MsgVoteWeighted>,
) -> std::result::Result<
tonic::Response<super::MsgVoteWeightedResponse>,
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.gov.v1beta1.Msg/VoteWeighted",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Msg", "VoteWeighted"));
self.inner.unary(req, path, codec).await
}
pub async fn deposit(
&mut self,
request: impl tonic::IntoRequest<super::MsgDeposit>,
) -> std::result::Result<
tonic::Response<super::MsgDepositResponse>,
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.gov.v1beta1.Msg/Deposit",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Msg", "Deposit"));
self.inner.unary(req, path, codec).await
}
}
}
#[cfg(feature = "server")]
pub mod msg_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Msg: Send + Sync + 'static {
async fn submit_proposal(
&self,
request: tonic::Request<super::MsgSubmitProposal>,
) -> std::result::Result<
tonic::Response<super::MsgSubmitProposalResponse>,
tonic::Status,
>;
async fn vote(
&self,
request: tonic::Request<super::MsgVote>,
) -> std::result::Result<tonic::Response<super::MsgVoteResponse>, tonic::Status>;
async fn vote_weighted(
&self,
request: tonic::Request<super::MsgVoteWeighted>,
) -> std::result::Result<
tonic::Response<super::MsgVoteWeightedResponse>,
tonic::Status,
>;
async fn deposit(
&self,
request: tonic::Request<super::MsgDeposit>,
) -> std::result::Result<
tonic::Response<super::MsgDepositResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct MsgServer<T: Msg> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: Msg> MsgServer<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(),
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 MsgServer<T>
where
T: Msg,
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<std::result::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.gov.v1beta1.Msg/SubmitProposal" => {
#[allow(non_camel_case_types)]
struct SubmitProposalSvc<T: Msg>(pub Arc<T>);
impl<T: Msg> tonic::server::UnaryService<super::MsgSubmitProposal>
for SubmitProposalSvc<T> {
type Response = super::MsgSubmitProposalResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgSubmitProposal>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Msg>::submit_proposal(&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 inner = inner.0;
let method = SubmitProposalSvc(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)
}
"/cosmos.gov.v1beta1.Msg/Vote" => {
#[allow(non_camel_case_types)]
struct VoteSvc<T: Msg>(pub Arc<T>);
impl<T: Msg> tonic::server::UnaryService<super::MsgVote>
for VoteSvc<T> {
type Response = super::MsgVoteResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgVote>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Msg>::vote(&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 inner = inner.0;
let method = VoteSvc(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)
}
"/cosmos.gov.v1beta1.Msg/VoteWeighted" => {
#[allow(non_camel_case_types)]
struct VoteWeightedSvc<T: Msg>(pub Arc<T>);
impl<T: Msg> tonic::server::UnaryService<super::MsgVoteWeighted>
for VoteWeightedSvc<T> {
type Response = super::MsgVoteWeightedResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgVoteWeighted>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Msg>::vote_weighted(&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 inner = inner.0;
let method = VoteWeightedSvc(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)
}
"/cosmos.gov.v1beta1.Msg/Deposit" => {
#[allow(non_camel_case_types)]
struct DepositSvc<T: Msg>(pub Arc<T>);
impl<T: Msg> tonic::server::UnaryService<super::MsgDeposit>
for DepositSvc<T> {
type Response = super::MsgDepositResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgDeposit>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Msg>::deposit(&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 inner = inner.0;
let method = DepositSvc(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 {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Msg> Clone for MsgServer<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,
}
}
}
impl<T: Msg> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
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: Msg> tonic::server::NamedService for MsgServer<T> {
const NAME: &'static str = "cosmos.gov.v1beta1.Msg";
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryProposalRequest {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
}
impl ::prost::Name for QueryProposalRequest {
const NAME: &'static str = "QueryProposalRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryProposalResponse {
#[prost(message, optional, tag = "1")]
pub proposal: ::core::option::Option<Proposal>,
}
impl ::prost::Name for QueryProposalResponse {
const NAME: &'static str = "QueryProposalResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryProposalsRequest {
#[prost(enumeration = "ProposalStatus", tag = "1")]
pub proposal_status: i32,
#[prost(string, tag = "2")]
pub voter: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub depositor: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub pagination: ::core::option::Option<
super::super::base::query::v1beta1::PageRequest,
>,
}
impl ::prost::Name for QueryProposalsRequest {
const NAME: &'static str = "QueryProposalsRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryProposalsResponse {
#[prost(message, repeated, tag = "1")]
pub proposals: ::prost::alloc::vec::Vec<Proposal>,
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<
super::super::base::query::v1beta1::PageResponse,
>,
}
impl ::prost::Name for QueryProposalsResponse {
const NAME: &'static str = "QueryProposalsResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryVoteRequest {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(string, tag = "2")]
pub voter: ::prost::alloc::string::String,
}
impl ::prost::Name for QueryVoteRequest {
const NAME: &'static str = "QueryVoteRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryVoteResponse {
#[prost(message, optional, tag = "1")]
pub vote: ::core::option::Option<Vote>,
}
impl ::prost::Name for QueryVoteResponse {
const NAME: &'static str = "QueryVoteResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryVotesRequest {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<
super::super::base::query::v1beta1::PageRequest,
>,
}
impl ::prost::Name for QueryVotesRequest {
const NAME: &'static str = "QueryVotesRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryVotesResponse {
#[prost(message, repeated, tag = "1")]
pub votes: ::prost::alloc::vec::Vec<Vote>,
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<
super::super::base::query::v1beta1::PageResponse,
>,
}
impl ::prost::Name for QueryVotesResponse {
const NAME: &'static str = "QueryVotesResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsRequest {
#[prost(string, tag = "1")]
pub params_type: ::prost::alloc::string::String,
}
impl ::prost::Name for QueryParamsRequest {
const NAME: &'static str = "QueryParamsRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsResponse {
#[prost(message, optional, tag = "1")]
pub voting_params: ::core::option::Option<VotingParams>,
#[prost(message, optional, tag = "2")]
pub deposit_params: ::core::option::Option<DepositParams>,
#[prost(message, optional, tag = "3")]
pub tally_params: ::core::option::Option<TallyParams>,
}
impl ::prost::Name for QueryParamsResponse {
const NAME: &'static str = "QueryParamsResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryDepositRequest {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(string, tag = "2")]
pub depositor: ::prost::alloc::string::String,
}
impl ::prost::Name for QueryDepositRequest {
const NAME: &'static str = "QueryDepositRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryDepositResponse {
#[prost(message, optional, tag = "1")]
pub deposit: ::core::option::Option<Deposit>,
}
impl ::prost::Name for QueryDepositResponse {
const NAME: &'static str = "QueryDepositResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryDepositsRequest {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<
super::super::base::query::v1beta1::PageRequest,
>,
}
impl ::prost::Name for QueryDepositsRequest {
const NAME: &'static str = "QueryDepositsRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryDepositsResponse {
#[prost(message, repeated, tag = "1")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<
super::super::base::query::v1beta1::PageResponse,
>,
}
impl ::prost::Name for QueryDepositsResponse {
const NAME: &'static str = "QueryDepositsResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryTallyResultRequest {
#[prost(uint64, tag = "1")]
pub proposal_id: u64,
}
impl ::prost::Name for QueryTallyResultRequest {
const NAME: &'static str = "QueryTallyResultRequest";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryTallyResultResponse {
#[prost(message, optional, tag = "1")]
pub tally: ::core::option::Option<TallyResult>,
}
impl ::prost::Name for QueryTallyResultResponse {
const NAME: &'static str = "QueryTallyResultResponse";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}
#[cfg(feature = "client")]
pub mod query_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct QueryClient<T> {
inner: tonic::client::Grpc<T>,
}
impl QueryClient<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> QueryClient<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,
) -> QueryClient<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,
{
QueryClient::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 proposal(
&mut self,
request: impl tonic::IntoRequest<super::QueryProposalRequest>,
) -> std::result::Result<
tonic::Response<super::QueryProposalResponse>,
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.gov.v1beta1.Query/Proposal",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "Proposal"));
self.inner.unary(req, path, codec).await
}
pub async fn proposals(
&mut self,
request: impl tonic::IntoRequest<super::QueryProposalsRequest>,
) -> std::result::Result<
tonic::Response<super::QueryProposalsResponse>,
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.gov.v1beta1.Query/Proposals",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "Proposals"));
self.inner.unary(req, path, codec).await
}
pub async fn vote(
&mut self,
request: impl tonic::IntoRequest<super::QueryVoteRequest>,
) -> std::result::Result<
tonic::Response<super::QueryVoteResponse>,
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.gov.v1beta1.Query/Vote",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "Vote"));
self.inner.unary(req, path, codec).await
}
pub async fn votes(
&mut self,
request: impl tonic::IntoRequest<super::QueryVotesRequest>,
) -> std::result::Result<
tonic::Response<super::QueryVotesResponse>,
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.gov.v1beta1.Query/Votes",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "Votes"));
self.inner.unary(req, path, codec).await
}
pub async fn params(
&mut self,
request: impl tonic::IntoRequest<super::QueryParamsRequest>,
) -> std::result::Result<
tonic::Response<super::QueryParamsResponse>,
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.gov.v1beta1.Query/Params",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "Params"));
self.inner.unary(req, path, codec).await
}
pub async fn deposit(
&mut self,
request: impl tonic::IntoRequest<super::QueryDepositRequest>,
) -> std::result::Result<
tonic::Response<super::QueryDepositResponse>,
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.gov.v1beta1.Query/Deposit",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "Deposit"));
self.inner.unary(req, path, codec).await
}
pub async fn deposits(
&mut self,
request: impl tonic::IntoRequest<super::QueryDepositsRequest>,
) -> std::result::Result<
tonic::Response<super::QueryDepositsResponse>,
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.gov.v1beta1.Query/Deposits",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "Deposits"));
self.inner.unary(req, path, codec).await
}
pub async fn tally_result(
&mut self,
request: impl tonic::IntoRequest<super::QueryTallyResultRequest>,
) -> std::result::Result<
tonic::Response<super::QueryTallyResultResponse>,
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.gov.v1beta1.Query/TallyResult",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.gov.v1beta1.Query", "TallyResult"));
self.inner.unary(req, path, codec).await
}
}
}
#[cfg(feature = "server")]
pub mod query_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Query: Send + Sync + 'static {
async fn proposal(
&self,
request: tonic::Request<super::QueryProposalRequest>,
) -> std::result::Result<
tonic::Response<super::QueryProposalResponse>,
tonic::Status,
>;
async fn proposals(
&self,
request: tonic::Request<super::QueryProposalsRequest>,
) -> std::result::Result<
tonic::Response<super::QueryProposalsResponse>,
tonic::Status,
>;
async fn vote(
&self,
request: tonic::Request<super::QueryVoteRequest>,
) -> std::result::Result<
tonic::Response<super::QueryVoteResponse>,
tonic::Status,
>;
async fn votes(
&self,
request: tonic::Request<super::QueryVotesRequest>,
) -> std::result::Result<
tonic::Response<super::QueryVotesResponse>,
tonic::Status,
>;
async fn params(
&self,
request: tonic::Request<super::QueryParamsRequest>,
) -> std::result::Result<
tonic::Response<super::QueryParamsResponse>,
tonic::Status,
>;
async fn deposit(
&self,
request: tonic::Request<super::QueryDepositRequest>,
) -> std::result::Result<
tonic::Response<super::QueryDepositResponse>,
tonic::Status,
>;
async fn deposits(
&self,
request: tonic::Request<super::QueryDepositsRequest>,
) -> std::result::Result<
tonic::Response<super::QueryDepositsResponse>,
tonic::Status,
>;
async fn tally_result(
&self,
request: tonic::Request<super::QueryTallyResultRequest>,
) -> std::result::Result<
tonic::Response<super::QueryTallyResultResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct QueryServer<T: Query> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: Query> QueryServer<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(),
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 QueryServer<T>
where
T: Query,
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<std::result::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.gov.v1beta1.Query/Proposal" => {
#[allow(non_camel_case_types)]
struct ProposalSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryProposalRequest>
for ProposalSvc<T> {
type Response = super::QueryProposalResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryProposalRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::proposal(&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 inner = inner.0;
let method = ProposalSvc(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)
}
"/cosmos.gov.v1beta1.Query/Proposals" => {
#[allow(non_camel_case_types)]
struct ProposalsSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryProposalsRequest>
for ProposalsSvc<T> {
type Response = super::QueryProposalsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryProposalsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::proposals(&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 inner = inner.0;
let method = ProposalsSvc(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)
}
"/cosmos.gov.v1beta1.Query/Vote" => {
#[allow(non_camel_case_types)]
struct VoteSvc<T: Query>(pub Arc<T>);
impl<T: Query> tonic::server::UnaryService<super::QueryVoteRequest>
for VoteSvc<T> {
type Response = super::QueryVoteResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryVoteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::vote(&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 inner = inner.0;
let method = VoteSvc(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)
}
"/cosmos.gov.v1beta1.Query/Votes" => {
#[allow(non_camel_case_types)]
struct VotesSvc<T: Query>(pub Arc<T>);
impl<T: Query> tonic::server::UnaryService<super::QueryVotesRequest>
for VotesSvc<T> {
type Response = super::QueryVotesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryVotesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::votes(&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 inner = inner.0;
let method = VotesSvc(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)
}
"/cosmos.gov.v1beta1.Query/Params" => {
#[allow(non_camel_case_types)]
struct ParamsSvc<T: Query>(pub Arc<T>);
impl<T: Query> tonic::server::UnaryService<super::QueryParamsRequest>
for ParamsSvc<T> {
type Response = super::QueryParamsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryParamsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::params(&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 inner = inner.0;
let method = ParamsSvc(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)
}
"/cosmos.gov.v1beta1.Query/Deposit" => {
#[allow(non_camel_case_types)]
struct DepositSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryDepositRequest>
for DepositSvc<T> {
type Response = super::QueryDepositResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryDepositRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::deposit(&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 inner = inner.0;
let method = DepositSvc(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)
}
"/cosmos.gov.v1beta1.Query/Deposits" => {
#[allow(non_camel_case_types)]
struct DepositsSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryDepositsRequest>
for DepositsSvc<T> {
type Response = super::QueryDepositsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryDepositsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::deposits(&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 inner = inner.0;
let method = DepositsSvc(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)
}
"/cosmos.gov.v1beta1.Query/TallyResult" => {
#[allow(non_camel_case_types)]
struct TallyResultSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryTallyResultRequest>
for TallyResultSvc<T> {
type Response = super::QueryTallyResultResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryTallyResultRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Query>::tally_result(&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 inner = inner.0;
let method = TallyResultSvc(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 {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Query> Clone for QueryServer<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,
}
}
}
impl<T: Query> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
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: Query> tonic::server::NamedService for QueryServer<T> {
const NAME: &'static str = "cosmos.gov.v1beta1.Query";
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenesisState {
#[prost(uint64, tag = "1")]
pub starting_proposal_id: u64,
#[prost(message, repeated, tag = "2")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag = "3")]
pub votes: ::prost::alloc::vec::Vec<Vote>,
#[prost(message, repeated, tag = "4")]
pub proposals: ::prost::alloc::vec::Vec<Proposal>,
#[prost(message, optional, tag = "5")]
pub deposit_params: ::core::option::Option<DepositParams>,
#[prost(message, optional, tag = "6")]
pub voting_params: ::core::option::Option<VotingParams>,
#[prost(message, optional, tag = "7")]
pub tally_params: ::core::option::Option<TallyParams>,
}
impl ::prost::Name for GenesisState {
const NAME: &'static str = "GenesisState";
const PACKAGE: &'static str = "cosmos.gov.v1beta1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("cosmos.gov.v1beta1.{}", Self::NAME)
}
}