penumbra_sdk_proto/gen/
penumbra.core.component.community_pool.v1.rs

1// This file is @generated by prost-build.
2/// CommunityPool parameter data.
3#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct CommunityPoolParameters {
5    /// Whether Community Pool spend proposals are enabled.
6    #[prost(bool, tag = "1")]
7    pub community_pool_spend_proposals_enabled: bool,
8}
9impl ::prost::Name for CommunityPoolParameters {
10    const NAME: &'static str = "CommunityPoolParameters";
11    const PACKAGE: &'static str = "penumbra.core.component.community_pool.v1";
12    fn full_name() -> ::prost::alloc::string::String {
13        "penumbra.core.component.community_pool.v1.CommunityPoolParameters".into()
14    }
15    fn type_url() -> ::prost::alloc::string::String {
16        "/penumbra.core.component.community_pool.v1.CommunityPoolParameters".into()
17    }
18}
19/// CommunityPool genesis state.
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct GenesisContent {
22    /// CommunityPool parameters.
23    #[prost(message, optional, tag = "1")]
24    pub community_pool_params: ::core::option::Option<CommunityPoolParameters>,
25    /// The initial balance of the Community Pool.
26    #[prost(message, optional, tag = "2")]
27    pub initial_balance: ::core::option::Option<super::super::super::asset::v1::Value>,
28}
29impl ::prost::Name for GenesisContent {
30    const NAME: &'static str = "GenesisContent";
31    const PACKAGE: &'static str = "penumbra.core.component.community_pool.v1";
32    fn full_name() -> ::prost::alloc::string::String {
33        "penumbra.core.component.community_pool.v1.GenesisContent".into()
34    }
35    fn type_url() -> ::prost::alloc::string::String {
36        "/penumbra.core.component.community_pool.v1.GenesisContent".into()
37    }
38}
39/// Requests the list of all asset balances associated with the Community Pool.
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct CommunityPoolAssetBalancesRequest {
42    /// (Optional): The specific asset balances to retrieve, if excluded all will be returned.
43    #[prost(message, repeated, tag = "2")]
44    pub asset_ids: ::prost::alloc::vec::Vec<super::super::super::asset::v1::AssetId>,
45}
46impl ::prost::Name for CommunityPoolAssetBalancesRequest {
47    const NAME: &'static str = "CommunityPoolAssetBalancesRequest";
48    const PACKAGE: &'static str = "penumbra.core.component.community_pool.v1";
49    fn full_name() -> ::prost::alloc::string::String {
50        "penumbra.core.component.community_pool.v1.CommunityPoolAssetBalancesRequest"
51            .into()
52    }
53    fn type_url() -> ::prost::alloc::string::String {
54        "/penumbra.core.component.community_pool.v1.CommunityPoolAssetBalancesRequest"
55            .into()
56    }
57}
58/// The Community Pool's balance of a single asset.
59#[derive(Clone, PartialEq, ::prost::Message)]
60pub struct CommunityPoolAssetBalancesResponse {
61    /// The balance for a single asset.
62    #[prost(message, optional, tag = "1")]
63    pub balance: ::core::option::Option<super::super::super::asset::v1::Value>,
64}
65impl ::prost::Name for CommunityPoolAssetBalancesResponse {
66    const NAME: &'static str = "CommunityPoolAssetBalancesResponse";
67    const PACKAGE: &'static str = "penumbra.core.component.community_pool.v1";
68    fn full_name() -> ::prost::alloc::string::String {
69        "penumbra.core.component.community_pool.v1.CommunityPoolAssetBalancesResponse"
70            .into()
71    }
72    fn type_url() -> ::prost::alloc::string::String {
73        "/penumbra.core.component.community_pool.v1.CommunityPoolAssetBalancesResponse"
74            .into()
75    }
76}
77/// Generated client implementations.
78#[cfg(feature = "rpc")]
79pub mod query_service_client {
80    #![allow(
81        unused_variables,
82        dead_code,
83        missing_docs,
84        clippy::wildcard_imports,
85        clippy::let_unit_value,
86    )]
87    use tonic::codegen::*;
88    use tonic::codegen::http::Uri;
89    /// Query operations for the community_pool component.
90    #[derive(Debug, Clone)]
91    pub struct QueryServiceClient<T> {
92        inner: tonic::client::Grpc<T>,
93    }
94    impl QueryServiceClient<tonic::transport::Channel> {
95        /// Attempt to create a new client by connecting to a given endpoint.
96        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
97        where
98            D: TryInto<tonic::transport::Endpoint>,
99            D::Error: Into<StdError>,
100        {
101            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
102            Ok(Self::new(conn))
103        }
104    }
105    impl<T> QueryServiceClient<T>
106    where
107        T: tonic::client::GrpcService<tonic::body::BoxBody>,
108        T::Error: Into<StdError>,
109        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
110        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
111    {
112        pub fn new(inner: T) -> Self {
113            let inner = tonic::client::Grpc::new(inner);
114            Self { inner }
115        }
116        pub fn with_origin(inner: T, origin: Uri) -> Self {
117            let inner = tonic::client::Grpc::with_origin(inner, origin);
118            Self { inner }
119        }
120        pub fn with_interceptor<F>(
121            inner: T,
122            interceptor: F,
123        ) -> QueryServiceClient<InterceptedService<T, F>>
124        where
125            F: tonic::service::Interceptor,
126            T::ResponseBody: Default,
127            T: tonic::codegen::Service<
128                http::Request<tonic::body::BoxBody>,
129                Response = http::Response<
130                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
131                >,
132            >,
133            <T as tonic::codegen::Service<
134                http::Request<tonic::body::BoxBody>,
135            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
136        {
137            QueryServiceClient::new(InterceptedService::new(inner, interceptor))
138        }
139        /// Compress requests with the given encoding.
140        ///
141        /// This requires the server to support it otherwise it might respond with an
142        /// error.
143        #[must_use]
144        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
145            self.inner = self.inner.send_compressed(encoding);
146            self
147        }
148        /// Enable decompressing responses.
149        #[must_use]
150        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
151            self.inner = self.inner.accept_compressed(encoding);
152            self
153        }
154        /// Limits the maximum size of a decoded message.
155        ///
156        /// Default: `4MB`
157        #[must_use]
158        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
159            self.inner = self.inner.max_decoding_message_size(limit);
160            self
161        }
162        /// Limits the maximum size of an encoded message.
163        ///
164        /// Default: `usize::MAX`
165        #[must_use]
166        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
167            self.inner = self.inner.max_encoding_message_size(limit);
168            self
169        }
170        pub async fn community_pool_asset_balances(
171            &mut self,
172            request: impl tonic::IntoRequest<super::CommunityPoolAssetBalancesRequest>,
173        ) -> std::result::Result<
174            tonic::Response<
175                tonic::codec::Streaming<super::CommunityPoolAssetBalancesResponse>,
176            >,
177            tonic::Status,
178        > {
179            self.inner
180                .ready()
181                .await
182                .map_err(|e| {
183                    tonic::Status::unknown(
184                        format!("Service was not ready: {}", e.into()),
185                    )
186                })?;
187            let codec = tonic::codec::ProstCodec::default();
188            let path = http::uri::PathAndQuery::from_static(
189                "/penumbra.core.component.community_pool.v1.QueryService/CommunityPoolAssetBalances",
190            );
191            let mut req = request.into_request();
192            req.extensions_mut()
193                .insert(
194                    GrpcMethod::new(
195                        "penumbra.core.component.community_pool.v1.QueryService",
196                        "CommunityPoolAssetBalances",
197                    ),
198                );
199            self.inner.server_streaming(req, path, codec).await
200        }
201    }
202}
203/// Generated server implementations.
204#[cfg(feature = "rpc")]
205pub mod query_service_server {
206    #![allow(
207        unused_variables,
208        dead_code,
209        missing_docs,
210        clippy::wildcard_imports,
211        clippy::let_unit_value,
212    )]
213    use tonic::codegen::*;
214    /// Generated trait containing gRPC methods that should be implemented for use with QueryServiceServer.
215    #[async_trait]
216    pub trait QueryService: std::marker::Send + std::marker::Sync + 'static {
217        /// Server streaming response type for the CommunityPoolAssetBalances method.
218        type CommunityPoolAssetBalancesStream: tonic::codegen::tokio_stream::Stream<
219                Item = std::result::Result<
220                    super::CommunityPoolAssetBalancesResponse,
221                    tonic::Status,
222                >,
223            >
224            + std::marker::Send
225            + 'static;
226        async fn community_pool_asset_balances(
227            &self,
228            request: tonic::Request<super::CommunityPoolAssetBalancesRequest>,
229        ) -> std::result::Result<
230            tonic::Response<Self::CommunityPoolAssetBalancesStream>,
231            tonic::Status,
232        >;
233    }
234    /// Query operations for the community_pool component.
235    #[derive(Debug)]
236    pub struct QueryServiceServer<T> {
237        inner: Arc<T>,
238        accept_compression_encodings: EnabledCompressionEncodings,
239        send_compression_encodings: EnabledCompressionEncodings,
240        max_decoding_message_size: Option<usize>,
241        max_encoding_message_size: Option<usize>,
242    }
243    impl<T> QueryServiceServer<T> {
244        pub fn new(inner: T) -> Self {
245            Self::from_arc(Arc::new(inner))
246        }
247        pub fn from_arc(inner: Arc<T>) -> Self {
248            Self {
249                inner,
250                accept_compression_encodings: Default::default(),
251                send_compression_encodings: Default::default(),
252                max_decoding_message_size: None,
253                max_encoding_message_size: None,
254            }
255        }
256        pub fn with_interceptor<F>(
257            inner: T,
258            interceptor: F,
259        ) -> InterceptedService<Self, F>
260        where
261            F: tonic::service::Interceptor,
262        {
263            InterceptedService::new(Self::new(inner), interceptor)
264        }
265        /// Enable decompressing requests with the given encoding.
266        #[must_use]
267        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
268            self.accept_compression_encodings.enable(encoding);
269            self
270        }
271        /// Compress responses with the given encoding, if the client supports it.
272        #[must_use]
273        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
274            self.send_compression_encodings.enable(encoding);
275            self
276        }
277        /// Limits the maximum size of a decoded message.
278        ///
279        /// Default: `4MB`
280        #[must_use]
281        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
282            self.max_decoding_message_size = Some(limit);
283            self
284        }
285        /// Limits the maximum size of an encoded message.
286        ///
287        /// Default: `usize::MAX`
288        #[must_use]
289        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
290            self.max_encoding_message_size = Some(limit);
291            self
292        }
293    }
294    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServiceServer<T>
295    where
296        T: QueryService,
297        B: Body + std::marker::Send + 'static,
298        B::Error: Into<StdError> + std::marker::Send + 'static,
299    {
300        type Response = http::Response<tonic::body::BoxBody>;
301        type Error = std::convert::Infallible;
302        type Future = BoxFuture<Self::Response, Self::Error>;
303        fn poll_ready(
304            &mut self,
305            _cx: &mut Context<'_>,
306        ) -> Poll<std::result::Result<(), Self::Error>> {
307            Poll::Ready(Ok(()))
308        }
309        fn call(&mut self, req: http::Request<B>) -> Self::Future {
310            match req.uri().path() {
311                "/penumbra.core.component.community_pool.v1.QueryService/CommunityPoolAssetBalances" => {
312                    #[allow(non_camel_case_types)]
313                    struct CommunityPoolAssetBalancesSvc<T: QueryService>(pub Arc<T>);
314                    impl<
315                        T: QueryService,
316                    > tonic::server::ServerStreamingService<
317                        super::CommunityPoolAssetBalancesRequest,
318                    > for CommunityPoolAssetBalancesSvc<T> {
319                        type Response = super::CommunityPoolAssetBalancesResponse;
320                        type ResponseStream = T::CommunityPoolAssetBalancesStream;
321                        type Future = BoxFuture<
322                            tonic::Response<Self::ResponseStream>,
323                            tonic::Status,
324                        >;
325                        fn call(
326                            &mut self,
327                            request: tonic::Request<
328                                super::CommunityPoolAssetBalancesRequest,
329                            >,
330                        ) -> Self::Future {
331                            let inner = Arc::clone(&self.0);
332                            let fut = async move {
333                                <T as QueryService>::community_pool_asset_balances(
334                                        &inner,
335                                        request,
336                                    )
337                                    .await
338                            };
339                            Box::pin(fut)
340                        }
341                    }
342                    let accept_compression_encodings = self.accept_compression_encodings;
343                    let send_compression_encodings = self.send_compression_encodings;
344                    let max_decoding_message_size = self.max_decoding_message_size;
345                    let max_encoding_message_size = self.max_encoding_message_size;
346                    let inner = self.inner.clone();
347                    let fut = async move {
348                        let method = CommunityPoolAssetBalancesSvc(inner);
349                        let codec = tonic::codec::ProstCodec::default();
350                        let mut grpc = tonic::server::Grpc::new(codec)
351                            .apply_compression_config(
352                                accept_compression_encodings,
353                                send_compression_encodings,
354                            )
355                            .apply_max_message_size_config(
356                                max_decoding_message_size,
357                                max_encoding_message_size,
358                            );
359                        let res = grpc.server_streaming(method, req).await;
360                        Ok(res)
361                    };
362                    Box::pin(fut)
363                }
364                _ => {
365                    Box::pin(async move {
366                        let mut response = http::Response::new(empty_body());
367                        let headers = response.headers_mut();
368                        headers
369                            .insert(
370                                tonic::Status::GRPC_STATUS,
371                                (tonic::Code::Unimplemented as i32).into(),
372                            );
373                        headers
374                            .insert(
375                                http::header::CONTENT_TYPE,
376                                tonic::metadata::GRPC_CONTENT_TYPE,
377                            );
378                        Ok(response)
379                    })
380                }
381            }
382        }
383    }
384    impl<T> Clone for QueryServiceServer<T> {
385        fn clone(&self) -> Self {
386            let inner = self.inner.clone();
387            Self {
388                inner,
389                accept_compression_encodings: self.accept_compression_encodings,
390                send_compression_encodings: self.send_compression_encodings,
391                max_decoding_message_size: self.max_decoding_message_size,
392                max_encoding_message_size: self.max_encoding_message_size,
393            }
394        }
395    }
396    /// Generated gRPC service name
397    pub const SERVICE_NAME: &str = "penumbra.core.component.community_pool.v1.QueryService";
398    impl<T> tonic::server::NamedService for QueryServiceServer<T> {
399        const NAME: &'static str = SERVICE_NAME;
400    }
401}