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

1/// MsgCreateVestingAccount defines a message that enables creating a vesting
2/// account.
3#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct MsgCreateVestingAccount {
6    #[prost(string, tag = "1")]
7    pub from_address: ::prost::alloc::string::String,
8    #[prost(string, tag = "2")]
9    pub to_address: ::prost::alloc::string::String,
10    #[prost(message, repeated, tag = "3")]
11    pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
12    #[prost(int64, tag = "4")]
13    pub end_time: i64,
14    #[prost(bool, tag = "5")]
15    pub delayed: bool,
16}
17/// MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type.
18#[allow(clippy::derive_partial_eq_without_eq)]
19#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct MsgCreateVestingAccountResponse {}
21/// Generated client implementations.
22#[cfg(feature = "grpc")]
23#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
24pub mod msg_client {
25    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
26    use tonic::codegen::http::Uri;
27    use tonic::codegen::*;
28    /// Msg defines the bank Msg service.
29    #[derive(Debug, Clone)]
30    pub struct MsgClient<T> {
31        inner: tonic::client::Grpc<T>,
32    }
33    #[cfg(feature = "grpc-transport")]
34    #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
35    impl MsgClient<tonic::transport::Channel> {
36        /// Attempt to create a new client by connecting to a given endpoint.
37        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
38        where
39            D: std::convert::TryInto<tonic::transport::Endpoint>,
40            D::Error: Into<StdError>,
41        {
42            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
43            Ok(Self::new(conn))
44        }
45    }
46    impl<T> MsgClient<T>
47    where
48        T: tonic::client::GrpcService<tonic::body::BoxBody>,
49        T::Error: Into<StdError>,
50        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
51        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
52    {
53        pub fn new(inner: T) -> Self {
54            let inner = tonic::client::Grpc::new(inner);
55            Self { inner }
56        }
57        pub fn with_origin(inner: T, origin: Uri) -> Self {
58            let inner = tonic::client::Grpc::with_origin(inner, origin);
59            Self { inner }
60        }
61        pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
62        where
63            F: tonic::service::Interceptor,
64            T::ResponseBody: Default,
65            T: tonic::codegen::Service<
66                http::Request<tonic::body::BoxBody>,
67                Response = http::Response<
68                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
69                >,
70            >,
71            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
72                Into<StdError> + Send + Sync,
73        {
74            MsgClient::new(InterceptedService::new(inner, interceptor))
75        }
76        /// Compress requests with the given encoding.
77        ///
78        /// This requires the server to support it otherwise it might respond with an
79        /// error.
80        #[must_use]
81        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
82            self.inner = self.inner.send_compressed(encoding);
83            self
84        }
85        /// Enable decompressing responses.
86        #[must_use]
87        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
88            self.inner = self.inner.accept_compressed(encoding);
89            self
90        }
91        /// CreateVestingAccount defines a method that enables creating a vesting
92        /// account.
93        pub async fn create_vesting_account(
94            &mut self,
95            request: impl tonic::IntoRequest<super::MsgCreateVestingAccount>,
96        ) -> Result<tonic::Response<super::MsgCreateVestingAccountResponse>, tonic::Status>
97        {
98            self.inner.ready().await.map_err(|e| {
99                tonic::Status::new(
100                    tonic::Code::Unknown,
101                    format!("Service was not ready: {}", e.into()),
102                )
103            })?;
104            let codec = tonic::codec::ProstCodec::default();
105            let path = http::uri::PathAndQuery::from_static(
106                "/cosmos.vesting.v1beta1.Msg/CreateVestingAccount",
107            );
108            self.inner.unary(request.into_request(), path, codec).await
109        }
110    }
111}
112/// Generated server implementations.
113#[cfg(feature = "grpc")]
114#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
115pub mod msg_server {
116    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
117    use tonic::codegen::*;
118    /// Generated trait containing gRPC methods that should be implemented for use with MsgServer.
119    #[async_trait]
120    pub trait Msg: Send + Sync + 'static {
121        /// CreateVestingAccount defines a method that enables creating a vesting
122        /// account.
123        async fn create_vesting_account(
124            &self,
125            request: tonic::Request<super::MsgCreateVestingAccount>,
126        ) -> Result<tonic::Response<super::MsgCreateVestingAccountResponse>, tonic::Status>;
127    }
128    /// Msg defines the bank Msg service.
129    #[derive(Debug)]
130    pub struct MsgServer<T: Msg> {
131        inner: _Inner<T>,
132        accept_compression_encodings: EnabledCompressionEncodings,
133        send_compression_encodings: EnabledCompressionEncodings,
134    }
135    struct _Inner<T>(Arc<T>);
136    impl<T: Msg> MsgServer<T> {
137        pub fn new(inner: T) -> Self {
138            Self::from_arc(Arc::new(inner))
139        }
140        pub fn from_arc(inner: Arc<T>) -> Self {
141            let inner = _Inner(inner);
142            Self {
143                inner,
144                accept_compression_encodings: Default::default(),
145                send_compression_encodings: Default::default(),
146            }
147        }
148        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
149        where
150            F: tonic::service::Interceptor,
151        {
152            InterceptedService::new(Self::new(inner), interceptor)
153        }
154        /// Enable decompressing requests with the given encoding.
155        #[must_use]
156        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
157            self.accept_compression_encodings.enable(encoding);
158            self
159        }
160        /// Compress responses with the given encoding, if the client supports it.
161        #[must_use]
162        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
163            self.send_compression_encodings.enable(encoding);
164            self
165        }
166    }
167    impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
168    where
169        T: Msg,
170        B: Body + Send + 'static,
171        B::Error: Into<StdError> + Send + 'static,
172    {
173        type Response = http::Response<tonic::body::BoxBody>;
174        type Error = std::convert::Infallible;
175        type Future = BoxFuture<Self::Response, Self::Error>;
176        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
177            Poll::Ready(Ok(()))
178        }
179        fn call(&mut self, req: http::Request<B>) -> Self::Future {
180            let inner = self.inner.clone();
181            match req.uri().path() {
182                "/cosmos.vesting.v1beta1.Msg/CreateVestingAccount" => {
183                    #[allow(non_camel_case_types)]
184                    struct CreateVestingAccountSvc<T: Msg>(pub Arc<T>);
185                    impl<T: Msg> tonic::server::UnaryService<super::MsgCreateVestingAccount>
186                        for CreateVestingAccountSvc<T>
187                    {
188                        type Response = super::MsgCreateVestingAccountResponse;
189                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
190                        fn call(
191                            &mut self,
192                            request: tonic::Request<super::MsgCreateVestingAccount>,
193                        ) -> Self::Future {
194                            let inner = self.0.clone();
195                            let fut = async move { (*inner).create_vesting_account(request).await };
196                            Box::pin(fut)
197                        }
198                    }
199                    let accept_compression_encodings = self.accept_compression_encodings;
200                    let send_compression_encodings = self.send_compression_encodings;
201                    let inner = self.inner.clone();
202                    let fut = async move {
203                        let inner = inner.0;
204                        let method = CreateVestingAccountSvc(inner);
205                        let codec = tonic::codec::ProstCodec::default();
206                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
207                            accept_compression_encodings,
208                            send_compression_encodings,
209                        );
210                        let res = grpc.unary(method, req).await;
211                        Ok(res)
212                    };
213                    Box::pin(fut)
214                }
215                _ => Box::pin(async move {
216                    Ok(http::Response::builder()
217                        .status(200)
218                        .header("grpc-status", "12")
219                        .header("content-type", "application/grpc")
220                        .body(empty_body())
221                        .unwrap())
222                }),
223            }
224        }
225    }
226    impl<T: Msg> Clone for MsgServer<T> {
227        fn clone(&self) -> Self {
228            let inner = self.inner.clone();
229            Self {
230                inner,
231                accept_compression_encodings: self.accept_compression_encodings,
232                send_compression_encodings: self.send_compression_encodings,
233            }
234        }
235    }
236    impl<T: Msg> Clone for _Inner<T> {
237        fn clone(&self) -> Self {
238            Self(self.0.clone())
239        }
240    }
241    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
242        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
243            write!(f, "{:?}", self.0)
244        }
245    }
246    impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
247        const NAME: &'static str = "cosmos.vesting.v1beta1.Msg";
248    }
249}
250/// BaseVestingAccount implements the VestingAccount interface. It contains all
251/// the necessary fields needed for any vesting account implementation.
252#[allow(clippy::derive_partial_eq_without_eq)]
253#[derive(Clone, PartialEq, ::prost::Message)]
254pub struct BaseVestingAccount {
255    #[prost(message, optional, tag = "1")]
256    pub base_account: ::core::option::Option<super::super::auth::v1beta1::BaseAccount>,
257    #[prost(message, repeated, tag = "2")]
258    pub original_vesting: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
259    #[prost(message, repeated, tag = "3")]
260    pub delegated_free: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
261    #[prost(message, repeated, tag = "4")]
262    pub delegated_vesting: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
263    #[prost(int64, tag = "5")]
264    pub end_time: i64,
265}
266/// ContinuousVestingAccount implements the VestingAccount interface. It
267/// continuously vests by unlocking coins linearly with respect to time.
268#[allow(clippy::derive_partial_eq_without_eq)]
269#[derive(Clone, PartialEq, ::prost::Message)]
270pub struct ContinuousVestingAccount {
271    #[prost(message, optional, tag = "1")]
272    pub base_vesting_account: ::core::option::Option<BaseVestingAccount>,
273    #[prost(int64, tag = "2")]
274    pub start_time: i64,
275}
276/// DelayedVestingAccount implements the VestingAccount interface. It vests all
277/// coins after a specific time, but non prior. In other words, it keeps them
278/// locked until a specified time.
279#[allow(clippy::derive_partial_eq_without_eq)]
280#[derive(Clone, PartialEq, ::prost::Message)]
281pub struct DelayedVestingAccount {
282    #[prost(message, optional, tag = "1")]
283    pub base_vesting_account: ::core::option::Option<BaseVestingAccount>,
284}
285/// Period defines a length of time and amount of coins that will vest.
286#[allow(clippy::derive_partial_eq_without_eq)]
287#[derive(Clone, PartialEq, ::prost::Message)]
288pub struct Period {
289    #[prost(int64, tag = "1")]
290    pub length: i64,
291    #[prost(message, repeated, tag = "2")]
292    pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
293}
294/// PeriodicVestingAccount implements the VestingAccount interface. It
295/// periodically vests by unlocking coins during each specified period.
296#[allow(clippy::derive_partial_eq_without_eq)]
297#[derive(Clone, PartialEq, ::prost::Message)]
298pub struct PeriodicVestingAccount {
299    #[prost(message, optional, tag = "1")]
300    pub base_vesting_account: ::core::option::Option<BaseVestingAccount>,
301    #[prost(int64, tag = "2")]
302    pub start_time: i64,
303    #[prost(message, repeated, tag = "3")]
304    pub vesting_periods: ::prost::alloc::vec::Vec<Period>,
305}
306/// PermanentLockedAccount implements the VestingAccount interface. It does
307/// not ever release coins, locking them indefinitely. Coins in this account can
308/// still be used for delegating and for governance votes even while locked.
309///
310/// Since: cosmos-sdk 0.43
311#[allow(clippy::derive_partial_eq_without_eq)]
312#[derive(Clone, PartialEq, ::prost::Message)]
313pub struct PermanentLockedAccount {
314    #[prost(message, optional, tag = "1")]
315    pub base_vesting_account: ::core::option::Option<BaseVestingAccount>,
316}