juno_rust_proto/prost/cosmos-sdk/
cosmos.tx.v1beta1.rs

1/// Tx is the standard type used for broadcasting transactions.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Tx {
5    /// body is the processable content of the transaction
6    #[prost(message, optional, tag = "1")]
7    pub body: ::core::option::Option<TxBody>,
8    /// auth_info is the authorization related content of the transaction,
9    /// specifically signers, signer modes and fee
10    #[prost(message, optional, tag = "2")]
11    pub auth_info: ::core::option::Option<AuthInfo>,
12    /// signatures is a list of signatures that matches the length and order of
13    /// AuthInfo's signer_infos to allow connecting signature meta information like
14    /// public key and signing mode by position.
15    #[prost(bytes = "vec", repeated, tag = "3")]
16    pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
17}
18/// TxRaw is a variant of Tx that pins the signer's exact binary representation
19/// of body and auth_info. This is used for signing, broadcasting and
20/// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and
21/// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used
22/// as the transaction ID.
23#[allow(clippy::derive_partial_eq_without_eq)]
24#[derive(Clone, PartialEq, ::prost::Message)]
25pub struct TxRaw {
26    /// body_bytes is a protobuf serialization of a TxBody that matches the
27    /// representation in SignDoc.
28    #[prost(bytes = "vec", tag = "1")]
29    pub body_bytes: ::prost::alloc::vec::Vec<u8>,
30    /// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the
31    /// representation in SignDoc.
32    #[prost(bytes = "vec", tag = "2")]
33    pub auth_info_bytes: ::prost::alloc::vec::Vec<u8>,
34    /// signatures is a list of signatures that matches the length and order of
35    /// AuthInfo's signer_infos to allow connecting signature meta information like
36    /// public key and signing mode by position.
37    #[prost(bytes = "vec", repeated, tag = "3")]
38    pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
39}
40/// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT.
41#[allow(clippy::derive_partial_eq_without_eq)]
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct SignDoc {
44    /// body_bytes is protobuf serialization of a TxBody that matches the
45    /// representation in TxRaw.
46    #[prost(bytes = "vec", tag = "1")]
47    pub body_bytes: ::prost::alloc::vec::Vec<u8>,
48    /// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the
49    /// representation in TxRaw.
50    #[prost(bytes = "vec", tag = "2")]
51    pub auth_info_bytes: ::prost::alloc::vec::Vec<u8>,
52    /// chain_id is the unique identifier of the chain this transaction targets.
53    /// It prevents signed transactions from being used on another chain by an
54    /// attacker
55    #[prost(string, tag = "3")]
56    pub chain_id: ::prost::alloc::string::String,
57    /// account_number is the account number of the account in state
58    #[prost(uint64, tag = "4")]
59    pub account_number: u64,
60}
61/// TxBody is the body of a transaction that all signers sign over.
62#[allow(clippy::derive_partial_eq_without_eq)]
63#[derive(Clone, PartialEq, ::prost::Message)]
64pub struct TxBody {
65    /// messages is a list of messages to be executed. The required signers of
66    /// those messages define the number and order of elements in AuthInfo's
67    /// signer_infos and Tx's signatures. Each required signer address is added to
68    /// the list only the first time it occurs.
69    /// By convention, the first required signer (usually from the first message)
70    /// is referred to as the primary signer and pays the fee for the whole
71    /// transaction.
72    #[prost(message, repeated, tag = "1")]
73    pub messages: ::prost::alloc::vec::Vec<::prost_types::Any>,
74    /// memo is any arbitrary note/comment to be added to the transaction.
75    /// WARNING: in clients, any publicly exposed text should not be called memo,
76    /// but should be called `note` instead (see <https://github.com/cosmos/cosmos-sdk/issues/9122>).
77    #[prost(string, tag = "2")]
78    pub memo: ::prost::alloc::string::String,
79    /// timeout is the block height after which this transaction will not
80    /// be processed by the chain
81    #[prost(uint64, tag = "3")]
82    pub timeout_height: u64,
83    /// extension_options are arbitrary options that can be added by chains
84    /// when the default options are not sufficient. If any of these are present
85    /// and can't be handled, the transaction will be rejected
86    #[prost(message, repeated, tag = "1023")]
87    pub extension_options: ::prost::alloc::vec::Vec<::prost_types::Any>,
88    /// extension_options are arbitrary options that can be added by chains
89    /// when the default options are not sufficient. If any of these are present
90    /// and can't be handled, they will be ignored
91    #[prost(message, repeated, tag = "2047")]
92    pub non_critical_extension_options: ::prost::alloc::vec::Vec<::prost_types::Any>,
93}
94/// AuthInfo describes the fee and signer modes that are used to sign a
95/// transaction.
96#[allow(clippy::derive_partial_eq_without_eq)]
97#[derive(Clone, PartialEq, ::prost::Message)]
98pub struct AuthInfo {
99    /// signer_infos defines the signing modes for the required signers. The number
100    /// and order of elements must match the required signers from TxBody's
101    /// messages. The first element is the primary signer and the one which pays
102    /// the fee.
103    #[prost(message, repeated, tag = "1")]
104    pub signer_infos: ::prost::alloc::vec::Vec<SignerInfo>,
105    /// Fee is the fee and gas limit for the transaction. The first signer is the
106    /// primary signer and the one which pays the fee. The fee can be calculated
107    /// based on the cost of evaluating the body and doing signature verification
108    /// of the signers. This can be estimated via simulation.
109    #[prost(message, optional, tag = "2")]
110    pub fee: ::core::option::Option<Fee>,
111}
112/// SignerInfo describes the public key and signing mode of a single top-level
113/// signer.
114#[allow(clippy::derive_partial_eq_without_eq)]
115#[derive(Clone, PartialEq, ::prost::Message)]
116pub struct SignerInfo {
117    /// public_key is the public key of the signer. It is optional for accounts
118    /// that already exist in state. If unset, the verifier can use the required \
119    /// signer address for this position and lookup the public key.
120    #[prost(message, optional, tag = "1")]
121    pub public_key: ::core::option::Option<::prost_types::Any>,
122    /// mode_info describes the signing mode of the signer and is a nested
123    /// structure to support nested multisig pubkey's
124    #[prost(message, optional, tag = "2")]
125    pub mode_info: ::core::option::Option<ModeInfo>,
126    /// sequence is the sequence of the account, which describes the
127    /// number of committed transactions signed by a given address. It is used to
128    /// prevent replay attacks.
129    #[prost(uint64, tag = "3")]
130    pub sequence: u64,
131}
132/// ModeInfo describes the signing mode of a single or nested multisig signer.
133#[allow(clippy::derive_partial_eq_without_eq)]
134#[derive(Clone, PartialEq, ::prost::Message)]
135pub struct ModeInfo {
136    /// sum is the oneof that specifies whether this represents a single or nested
137    /// multisig signer
138    #[prost(oneof = "mode_info::Sum", tags = "1, 2")]
139    pub sum: ::core::option::Option<mode_info::Sum>,
140}
141/// Nested message and enum types in `ModeInfo`.
142pub mod mode_info {
143    /// Single is the mode info for a single signer. It is structured as a message
144    /// to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the
145    /// future
146    #[allow(clippy::derive_partial_eq_without_eq)]
147    #[derive(Clone, PartialEq, ::prost::Message)]
148    pub struct Single {
149        /// mode is the signing mode of the single signer
150        #[prost(enumeration = "super::super::signing::v1beta1::SignMode", tag = "1")]
151        pub mode: i32,
152    }
153    /// Multi is the mode info for a multisig public key
154    #[allow(clippy::derive_partial_eq_without_eq)]
155    #[derive(Clone, PartialEq, ::prost::Message)]
156    pub struct Multi {
157        /// bitarray specifies which keys within the multisig are signing
158        #[prost(message, optional, tag = "1")]
159        pub bitarray:
160            ::core::option::Option<super::super::super::crypto::multisig::v1beta1::CompactBitArray>,
161        /// mode_infos is the corresponding modes of the signers of the multisig
162        /// which could include nested multisig public keys
163        #[prost(message, repeated, tag = "2")]
164        pub mode_infos: ::prost::alloc::vec::Vec<super::ModeInfo>,
165    }
166    /// sum is the oneof that specifies whether this represents a single or nested
167    /// multisig signer
168    #[allow(clippy::derive_partial_eq_without_eq)]
169    #[derive(Clone, PartialEq, ::prost::Oneof)]
170    pub enum Sum {
171        /// single represents a single signer
172        #[prost(message, tag = "1")]
173        Single(Single),
174        /// multi represents a nested multisig signer
175        #[prost(message, tag = "2")]
176        Multi(Multi),
177    }
178}
179/// Fee includes the amount of coins paid in fees and the maximum
180/// gas to be used by the transaction. The ratio yields an effective "gasprice",
181/// which must be above some miminum to be accepted into the mempool.
182#[allow(clippy::derive_partial_eq_without_eq)]
183#[derive(Clone, PartialEq, ::prost::Message)]
184pub struct Fee {
185    /// amount is the amount of coins to be paid as a fee
186    #[prost(message, repeated, tag = "1")]
187    pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
188    /// gas_limit is the maximum gas that can be used in transaction processing
189    /// before an out of gas error occurs
190    #[prost(uint64, tag = "2")]
191    pub gas_limit: u64,
192    /// if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees.
193    /// the payer must be a tx signer (and thus have signed this field in AuthInfo).
194    /// setting this field does *not* change the ordering of required signers for the transaction.
195    #[prost(string, tag = "3")]
196    pub payer: ::prost::alloc::string::String,
197    /// if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used
198    /// to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does
199    /// not support fee grants, this will fail
200    #[prost(string, tag = "4")]
201    pub granter: ::prost::alloc::string::String,
202}
203/// GetTxsEventRequest is the request type for the Service.TxsByEvents
204/// RPC method.
205#[allow(clippy::derive_partial_eq_without_eq)]
206#[derive(Clone, PartialEq, ::prost::Message)]
207pub struct GetTxsEventRequest {
208    /// events is the list of transaction event type.
209    #[prost(string, repeated, tag = "1")]
210    pub events: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
211    /// pagination defines a pagination for the request.
212    #[prost(message, optional, tag = "2")]
213    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
214    #[prost(enumeration = "OrderBy", tag = "3")]
215    pub order_by: i32,
216}
217/// GetTxsEventResponse is the response type for the Service.TxsByEvents
218/// RPC method.
219#[allow(clippy::derive_partial_eq_without_eq)]
220#[derive(Clone, PartialEq, ::prost::Message)]
221pub struct GetTxsEventResponse {
222    /// txs is the list of queried transactions.
223    #[prost(message, repeated, tag = "1")]
224    pub txs: ::prost::alloc::vec::Vec<Tx>,
225    /// tx_responses is the list of queried TxResponses.
226    #[prost(message, repeated, tag = "2")]
227    pub tx_responses: ::prost::alloc::vec::Vec<super::super::base::abci::v1beta1::TxResponse>,
228    /// pagination defines a pagination for the response.
229    #[prost(message, optional, tag = "3")]
230    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
231}
232/// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest
233/// RPC method.
234#[allow(clippy::derive_partial_eq_without_eq)]
235#[derive(Clone, PartialEq, ::prost::Message)]
236pub struct BroadcastTxRequest {
237    /// tx_bytes is the raw transaction.
238    #[prost(bytes = "vec", tag = "1")]
239    pub tx_bytes: ::prost::alloc::vec::Vec<u8>,
240    #[prost(enumeration = "BroadcastMode", tag = "2")]
241    pub mode: i32,
242}
243/// BroadcastTxResponse is the response type for the
244/// Service.BroadcastTx method.
245#[allow(clippy::derive_partial_eq_without_eq)]
246#[derive(Clone, PartialEq, ::prost::Message)]
247pub struct BroadcastTxResponse {
248    /// tx_response is the queried TxResponses.
249    #[prost(message, optional, tag = "1")]
250    pub tx_response: ::core::option::Option<super::super::base::abci::v1beta1::TxResponse>,
251}
252/// SimulateRequest is the request type for the Service.Simulate
253/// RPC method.
254#[allow(clippy::derive_partial_eq_without_eq)]
255#[derive(Clone, PartialEq, ::prost::Message)]
256pub struct SimulateRequest {
257    /// tx is the transaction to simulate.
258    /// Deprecated. Send raw tx bytes instead.
259    #[deprecated]
260    #[prost(message, optional, tag = "1")]
261    pub tx: ::core::option::Option<Tx>,
262    /// tx_bytes is the raw transaction.
263    ///
264    /// Since: cosmos-sdk 0.43
265    #[prost(bytes = "vec", tag = "2")]
266    pub tx_bytes: ::prost::alloc::vec::Vec<u8>,
267}
268/// SimulateResponse is the response type for the
269/// Service.SimulateRPC method.
270#[allow(clippy::derive_partial_eq_without_eq)]
271#[derive(Clone, PartialEq, ::prost::Message)]
272pub struct SimulateResponse {
273    /// gas_info is the information about gas used in the simulation.
274    #[prost(message, optional, tag = "1")]
275    pub gas_info: ::core::option::Option<super::super::base::abci::v1beta1::GasInfo>,
276    /// result is the result of the simulation.
277    #[prost(message, optional, tag = "2")]
278    pub result: ::core::option::Option<super::super::base::abci::v1beta1::Result>,
279}
280/// GetTxRequest is the request type for the Service.GetTx
281/// RPC method.
282#[allow(clippy::derive_partial_eq_without_eq)]
283#[derive(Clone, PartialEq, ::prost::Message)]
284pub struct GetTxRequest {
285    /// hash is the tx hash to query, encoded as a hex string.
286    #[prost(string, tag = "1")]
287    pub hash: ::prost::alloc::string::String,
288}
289/// GetTxResponse is the response type for the Service.GetTx method.
290#[allow(clippy::derive_partial_eq_without_eq)]
291#[derive(Clone, PartialEq, ::prost::Message)]
292pub struct GetTxResponse {
293    /// tx is the queried transaction.
294    #[prost(message, optional, tag = "1")]
295    pub tx: ::core::option::Option<Tx>,
296    /// tx_response is the queried TxResponses.
297    #[prost(message, optional, tag = "2")]
298    pub tx_response: ::core::option::Option<super::super::base::abci::v1beta1::TxResponse>,
299}
300/// GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs
301/// RPC method.
302///
303/// Since: cosmos-sdk 0.45.2
304#[allow(clippy::derive_partial_eq_without_eq)]
305#[derive(Clone, PartialEq, ::prost::Message)]
306pub struct GetBlockWithTxsRequest {
307    /// height is the height of the block to query.
308    #[prost(int64, tag = "1")]
309    pub height: i64,
310    /// pagination defines a pagination for the request.
311    #[prost(message, optional, tag = "2")]
312    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
313}
314/// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method.
315///
316/// Since: cosmos-sdk 0.45.2
317#[allow(clippy::derive_partial_eq_without_eq)]
318#[derive(Clone, PartialEq, ::prost::Message)]
319pub struct GetBlockWithTxsResponse {
320    /// txs are the transactions in the block.
321    #[prost(message, repeated, tag = "1")]
322    pub txs: ::prost::alloc::vec::Vec<Tx>,
323    #[prost(message, optional, tag = "2")]
324    pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>,
325    #[prost(message, optional, tag = "3")]
326    pub block: ::core::option::Option<::tendermint_proto::types::Block>,
327    /// pagination defines a pagination for the response.
328    #[prost(message, optional, tag = "4")]
329    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
330}
331/// OrderBy defines the sorting order
332#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
333#[repr(i32)]
334pub enum OrderBy {
335    /// ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case.
336    Unspecified = 0,
337    /// ORDER_BY_ASC defines ascending order
338    Asc = 1,
339    /// ORDER_BY_DESC defines descending order
340    Desc = 2,
341}
342impl OrderBy {
343    /// String value of the enum field names used in the ProtoBuf definition.
344    ///
345    /// The values are not transformed in any way and thus are considered stable
346    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
347    pub fn as_str_name(&self) -> &'static str {
348        match self {
349            OrderBy::Unspecified => "ORDER_BY_UNSPECIFIED",
350            OrderBy::Asc => "ORDER_BY_ASC",
351            OrderBy::Desc => "ORDER_BY_DESC",
352        }
353    }
354    /// Creates an enum from field names used in the ProtoBuf definition.
355    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
356        match value {
357            "ORDER_BY_UNSPECIFIED" => Some(Self::Unspecified),
358            "ORDER_BY_ASC" => Some(Self::Asc),
359            "ORDER_BY_DESC" => Some(Self::Desc),
360            _ => None,
361        }
362    }
363}
364/// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method.
365#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
366#[repr(i32)]
367pub enum BroadcastMode {
368    /// zero-value for mode ordering
369    Unspecified = 0,
370    /// BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for
371    /// the tx to be committed in a block.
372    Block = 1,
373    /// BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for
374    /// a CheckTx execution response only.
375    Sync = 2,
376    /// BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns
377    /// immediately.
378    Async = 3,
379}
380impl BroadcastMode {
381    /// String value of the enum field names used in the ProtoBuf definition.
382    ///
383    /// The values are not transformed in any way and thus are considered stable
384    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
385    pub fn as_str_name(&self) -> &'static str {
386        match self {
387            BroadcastMode::Unspecified => "BROADCAST_MODE_UNSPECIFIED",
388            BroadcastMode::Block => "BROADCAST_MODE_BLOCK",
389            BroadcastMode::Sync => "BROADCAST_MODE_SYNC",
390            BroadcastMode::Async => "BROADCAST_MODE_ASYNC",
391        }
392    }
393    /// Creates an enum from field names used in the ProtoBuf definition.
394    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
395        match value {
396            "BROADCAST_MODE_UNSPECIFIED" => Some(Self::Unspecified),
397            "BROADCAST_MODE_BLOCK" => Some(Self::Block),
398            "BROADCAST_MODE_SYNC" => Some(Self::Sync),
399            "BROADCAST_MODE_ASYNC" => Some(Self::Async),
400            _ => None,
401        }
402    }
403}
404/// Generated client implementations.
405#[cfg(feature = "grpc")]
406#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
407pub mod service_client {
408    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
409    use tonic::codegen::http::Uri;
410    use tonic::codegen::*;
411    /// Service defines a gRPC service for interacting with transactions.
412    #[derive(Debug, Clone)]
413    pub struct ServiceClient<T> {
414        inner: tonic::client::Grpc<T>,
415    }
416    #[cfg(feature = "grpc-transport")]
417    #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
418    impl ServiceClient<tonic::transport::Channel> {
419        /// Attempt to create a new client by connecting to a given endpoint.
420        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
421        where
422            D: std::convert::TryInto<tonic::transport::Endpoint>,
423            D::Error: Into<StdError>,
424        {
425            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
426            Ok(Self::new(conn))
427        }
428    }
429    impl<T> ServiceClient<T>
430    where
431        T: tonic::client::GrpcService<tonic::body::BoxBody>,
432        T::Error: Into<StdError>,
433        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
434        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
435    {
436        pub fn new(inner: T) -> Self {
437            let inner = tonic::client::Grpc::new(inner);
438            Self { inner }
439        }
440        pub fn with_origin(inner: T, origin: Uri) -> Self {
441            let inner = tonic::client::Grpc::with_origin(inner, origin);
442            Self { inner }
443        }
444        pub fn with_interceptor<F>(
445            inner: T,
446            interceptor: F,
447        ) -> ServiceClient<InterceptedService<T, F>>
448        where
449            F: tonic::service::Interceptor,
450            T::ResponseBody: Default,
451            T: tonic::codegen::Service<
452                http::Request<tonic::body::BoxBody>,
453                Response = http::Response<
454                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
455                >,
456            >,
457            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
458                Into<StdError> + Send + Sync,
459        {
460            ServiceClient::new(InterceptedService::new(inner, interceptor))
461        }
462        /// Compress requests with the given encoding.
463        ///
464        /// This requires the server to support it otherwise it might respond with an
465        /// error.
466        #[must_use]
467        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
468            self.inner = self.inner.send_compressed(encoding);
469            self
470        }
471        /// Enable decompressing responses.
472        #[must_use]
473        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
474            self.inner = self.inner.accept_compressed(encoding);
475            self
476        }
477        /// Simulate simulates executing a transaction for estimating gas usage.
478        pub async fn simulate(
479            &mut self,
480            request: impl tonic::IntoRequest<super::SimulateRequest>,
481        ) -> Result<tonic::Response<super::SimulateResponse>, tonic::Status> {
482            self.inner.ready().await.map_err(|e| {
483                tonic::Status::new(
484                    tonic::Code::Unknown,
485                    format!("Service was not ready: {}", e.into()),
486                )
487            })?;
488            let codec = tonic::codec::ProstCodec::default();
489            let path = http::uri::PathAndQuery::from_static("/cosmos.tx.v1beta1.Service/Simulate");
490            self.inner.unary(request.into_request(), path, codec).await
491        }
492        /// GetTx fetches a tx by hash.
493        pub async fn get_tx(
494            &mut self,
495            request: impl tonic::IntoRequest<super::GetTxRequest>,
496        ) -> Result<tonic::Response<super::GetTxResponse>, tonic::Status> {
497            self.inner.ready().await.map_err(|e| {
498                tonic::Status::new(
499                    tonic::Code::Unknown,
500                    format!("Service was not ready: {}", e.into()),
501                )
502            })?;
503            let codec = tonic::codec::ProstCodec::default();
504            let path = http::uri::PathAndQuery::from_static("/cosmos.tx.v1beta1.Service/GetTx");
505            self.inner.unary(request.into_request(), path, codec).await
506        }
507        /// BroadcastTx broadcast transaction.
508        pub async fn broadcast_tx(
509            &mut self,
510            request: impl tonic::IntoRequest<super::BroadcastTxRequest>,
511        ) -> Result<tonic::Response<super::BroadcastTxResponse>, tonic::Status> {
512            self.inner.ready().await.map_err(|e| {
513                tonic::Status::new(
514                    tonic::Code::Unknown,
515                    format!("Service was not ready: {}", e.into()),
516                )
517            })?;
518            let codec = tonic::codec::ProstCodec::default();
519            let path =
520                http::uri::PathAndQuery::from_static("/cosmos.tx.v1beta1.Service/BroadcastTx");
521            self.inner.unary(request.into_request(), path, codec).await
522        }
523        /// GetTxsEvent fetches txs by event.
524        pub async fn get_txs_event(
525            &mut self,
526            request: impl tonic::IntoRequest<super::GetTxsEventRequest>,
527        ) -> Result<tonic::Response<super::GetTxsEventResponse>, tonic::Status> {
528            self.inner.ready().await.map_err(|e| {
529                tonic::Status::new(
530                    tonic::Code::Unknown,
531                    format!("Service was not ready: {}", e.into()),
532                )
533            })?;
534            let codec = tonic::codec::ProstCodec::default();
535            let path =
536                http::uri::PathAndQuery::from_static("/cosmos.tx.v1beta1.Service/GetTxsEvent");
537            self.inner.unary(request.into_request(), path, codec).await
538        }
539        /// GetBlockWithTxs fetches a block with decoded txs.
540        ///
541        /// Since: cosmos-sdk 0.45.2
542        pub async fn get_block_with_txs(
543            &mut self,
544            request: impl tonic::IntoRequest<super::GetBlockWithTxsRequest>,
545        ) -> Result<tonic::Response<super::GetBlockWithTxsResponse>, tonic::Status> {
546            self.inner.ready().await.map_err(|e| {
547                tonic::Status::new(
548                    tonic::Code::Unknown,
549                    format!("Service was not ready: {}", e.into()),
550                )
551            })?;
552            let codec = tonic::codec::ProstCodec::default();
553            let path =
554                http::uri::PathAndQuery::from_static("/cosmos.tx.v1beta1.Service/GetBlockWithTxs");
555            self.inner.unary(request.into_request(), path, codec).await
556        }
557    }
558}
559/// Generated server implementations.
560#[cfg(feature = "grpc")]
561#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
562pub mod service_server {
563    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
564    use tonic::codegen::*;
565    /// Generated trait containing gRPC methods that should be implemented for use with ServiceServer.
566    #[async_trait]
567    pub trait Service: Send + Sync + 'static {
568        /// Simulate simulates executing a transaction for estimating gas usage.
569        async fn simulate(
570            &self,
571            request: tonic::Request<super::SimulateRequest>,
572        ) -> Result<tonic::Response<super::SimulateResponse>, tonic::Status>;
573        /// GetTx fetches a tx by hash.
574        async fn get_tx(
575            &self,
576            request: tonic::Request<super::GetTxRequest>,
577        ) -> Result<tonic::Response<super::GetTxResponse>, tonic::Status>;
578        /// BroadcastTx broadcast transaction.
579        async fn broadcast_tx(
580            &self,
581            request: tonic::Request<super::BroadcastTxRequest>,
582        ) -> Result<tonic::Response<super::BroadcastTxResponse>, tonic::Status>;
583        /// GetTxsEvent fetches txs by event.
584        async fn get_txs_event(
585            &self,
586            request: tonic::Request<super::GetTxsEventRequest>,
587        ) -> Result<tonic::Response<super::GetTxsEventResponse>, tonic::Status>;
588        /// GetBlockWithTxs fetches a block with decoded txs.
589        ///
590        /// Since: cosmos-sdk 0.45.2
591        async fn get_block_with_txs(
592            &self,
593            request: tonic::Request<super::GetBlockWithTxsRequest>,
594        ) -> Result<tonic::Response<super::GetBlockWithTxsResponse>, tonic::Status>;
595    }
596    /// Service defines a gRPC service for interacting with transactions.
597    #[derive(Debug)]
598    pub struct ServiceServer<T: Service> {
599        inner: _Inner<T>,
600        accept_compression_encodings: EnabledCompressionEncodings,
601        send_compression_encodings: EnabledCompressionEncodings,
602    }
603    struct _Inner<T>(Arc<T>);
604    impl<T: Service> ServiceServer<T> {
605        pub fn new(inner: T) -> Self {
606            Self::from_arc(Arc::new(inner))
607        }
608        pub fn from_arc(inner: Arc<T>) -> Self {
609            let inner = _Inner(inner);
610            Self {
611                inner,
612                accept_compression_encodings: Default::default(),
613                send_compression_encodings: Default::default(),
614            }
615        }
616        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
617        where
618            F: tonic::service::Interceptor,
619        {
620            InterceptedService::new(Self::new(inner), interceptor)
621        }
622        /// Enable decompressing requests with the given encoding.
623        #[must_use]
624        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
625            self.accept_compression_encodings.enable(encoding);
626            self
627        }
628        /// Compress responses with the given encoding, if the client supports it.
629        #[must_use]
630        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
631            self.send_compression_encodings.enable(encoding);
632            self
633        }
634    }
635    impl<T, B> tonic::codegen::Service<http::Request<B>> for ServiceServer<T>
636    where
637        T: Service,
638        B: Body + Send + 'static,
639        B::Error: Into<StdError> + Send + 'static,
640    {
641        type Response = http::Response<tonic::body::BoxBody>;
642        type Error = std::convert::Infallible;
643        type Future = BoxFuture<Self::Response, Self::Error>;
644        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
645            Poll::Ready(Ok(()))
646        }
647        fn call(&mut self, req: http::Request<B>) -> Self::Future {
648            let inner = self.inner.clone();
649            match req.uri().path() {
650                "/cosmos.tx.v1beta1.Service/Simulate" => {
651                    #[allow(non_camel_case_types)]
652                    struct SimulateSvc<T: Service>(pub Arc<T>);
653                    impl<T: Service> tonic::server::UnaryService<super::SimulateRequest> for SimulateSvc<T> {
654                        type Response = super::SimulateResponse;
655                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
656                        fn call(
657                            &mut self,
658                            request: tonic::Request<super::SimulateRequest>,
659                        ) -> Self::Future {
660                            let inner = self.0.clone();
661                            let fut = async move { (*inner).simulate(request).await };
662                            Box::pin(fut)
663                        }
664                    }
665                    let accept_compression_encodings = self.accept_compression_encodings;
666                    let send_compression_encodings = self.send_compression_encodings;
667                    let inner = self.inner.clone();
668                    let fut = async move {
669                        let inner = inner.0;
670                        let method = SimulateSvc(inner);
671                        let codec = tonic::codec::ProstCodec::default();
672                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
673                            accept_compression_encodings,
674                            send_compression_encodings,
675                        );
676                        let res = grpc.unary(method, req).await;
677                        Ok(res)
678                    };
679                    Box::pin(fut)
680                }
681                "/cosmos.tx.v1beta1.Service/GetTx" => {
682                    #[allow(non_camel_case_types)]
683                    struct GetTxSvc<T: Service>(pub Arc<T>);
684                    impl<T: Service> tonic::server::UnaryService<super::GetTxRequest> for GetTxSvc<T> {
685                        type Response = super::GetTxResponse;
686                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
687                        fn call(
688                            &mut self,
689                            request: tonic::Request<super::GetTxRequest>,
690                        ) -> Self::Future {
691                            let inner = self.0.clone();
692                            let fut = async move { (*inner).get_tx(request).await };
693                            Box::pin(fut)
694                        }
695                    }
696                    let accept_compression_encodings = self.accept_compression_encodings;
697                    let send_compression_encodings = self.send_compression_encodings;
698                    let inner = self.inner.clone();
699                    let fut = async move {
700                        let inner = inner.0;
701                        let method = GetTxSvc(inner);
702                        let codec = tonic::codec::ProstCodec::default();
703                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
704                            accept_compression_encodings,
705                            send_compression_encodings,
706                        );
707                        let res = grpc.unary(method, req).await;
708                        Ok(res)
709                    };
710                    Box::pin(fut)
711                }
712                "/cosmos.tx.v1beta1.Service/BroadcastTx" => {
713                    #[allow(non_camel_case_types)]
714                    struct BroadcastTxSvc<T: Service>(pub Arc<T>);
715                    impl<T: Service> tonic::server::UnaryService<super::BroadcastTxRequest> for BroadcastTxSvc<T> {
716                        type Response = super::BroadcastTxResponse;
717                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
718                        fn call(
719                            &mut self,
720                            request: tonic::Request<super::BroadcastTxRequest>,
721                        ) -> Self::Future {
722                            let inner = self.0.clone();
723                            let fut = async move { (*inner).broadcast_tx(request).await };
724                            Box::pin(fut)
725                        }
726                    }
727                    let accept_compression_encodings = self.accept_compression_encodings;
728                    let send_compression_encodings = self.send_compression_encodings;
729                    let inner = self.inner.clone();
730                    let fut = async move {
731                        let inner = inner.0;
732                        let method = BroadcastTxSvc(inner);
733                        let codec = tonic::codec::ProstCodec::default();
734                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
735                            accept_compression_encodings,
736                            send_compression_encodings,
737                        );
738                        let res = grpc.unary(method, req).await;
739                        Ok(res)
740                    };
741                    Box::pin(fut)
742                }
743                "/cosmos.tx.v1beta1.Service/GetTxsEvent" => {
744                    #[allow(non_camel_case_types)]
745                    struct GetTxsEventSvc<T: Service>(pub Arc<T>);
746                    impl<T: Service> tonic::server::UnaryService<super::GetTxsEventRequest> for GetTxsEventSvc<T> {
747                        type Response = super::GetTxsEventResponse;
748                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
749                        fn call(
750                            &mut self,
751                            request: tonic::Request<super::GetTxsEventRequest>,
752                        ) -> Self::Future {
753                            let inner = self.0.clone();
754                            let fut = async move { (*inner).get_txs_event(request).await };
755                            Box::pin(fut)
756                        }
757                    }
758                    let accept_compression_encodings = self.accept_compression_encodings;
759                    let send_compression_encodings = self.send_compression_encodings;
760                    let inner = self.inner.clone();
761                    let fut = async move {
762                        let inner = inner.0;
763                        let method = GetTxsEventSvc(inner);
764                        let codec = tonic::codec::ProstCodec::default();
765                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
766                            accept_compression_encodings,
767                            send_compression_encodings,
768                        );
769                        let res = grpc.unary(method, req).await;
770                        Ok(res)
771                    };
772                    Box::pin(fut)
773                }
774                "/cosmos.tx.v1beta1.Service/GetBlockWithTxs" => {
775                    #[allow(non_camel_case_types)]
776                    struct GetBlockWithTxsSvc<T: Service>(pub Arc<T>);
777                    impl<T: Service> tonic::server::UnaryService<super::GetBlockWithTxsRequest>
778                        for GetBlockWithTxsSvc<T>
779                    {
780                        type Response = super::GetBlockWithTxsResponse;
781                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
782                        fn call(
783                            &mut self,
784                            request: tonic::Request<super::GetBlockWithTxsRequest>,
785                        ) -> Self::Future {
786                            let inner = self.0.clone();
787                            let fut = async move { (*inner).get_block_with_txs(request).await };
788                            Box::pin(fut)
789                        }
790                    }
791                    let accept_compression_encodings = self.accept_compression_encodings;
792                    let send_compression_encodings = self.send_compression_encodings;
793                    let inner = self.inner.clone();
794                    let fut = async move {
795                        let inner = inner.0;
796                        let method = GetBlockWithTxsSvc(inner);
797                        let codec = tonic::codec::ProstCodec::default();
798                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
799                            accept_compression_encodings,
800                            send_compression_encodings,
801                        );
802                        let res = grpc.unary(method, req).await;
803                        Ok(res)
804                    };
805                    Box::pin(fut)
806                }
807                _ => Box::pin(async move {
808                    Ok(http::Response::builder()
809                        .status(200)
810                        .header("grpc-status", "12")
811                        .header("content-type", "application/grpc")
812                        .body(empty_body())
813                        .unwrap())
814                }),
815            }
816        }
817    }
818    impl<T: Service> Clone for ServiceServer<T> {
819        fn clone(&self) -> Self {
820            let inner = self.inner.clone();
821            Self {
822                inner,
823                accept_compression_encodings: self.accept_compression_encodings,
824                send_compression_encodings: self.send_compression_encodings,
825            }
826        }
827    }
828    impl<T: Service> Clone for _Inner<T> {
829        fn clone(&self) -> Self {
830            Self(self.0.clone())
831        }
832    }
833    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
834        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
835            write!(f, "{:?}", self.0)
836        }
837    }
838    impl<T: Service> tonic::server::NamedService for ServiceServer<T> {
839        const NAME: &'static str = "cosmos.tx.v1beta1.Service";
840    }
841}