sui_rpc_api/proto/generated/
sui.rpc.alpha.rs1#[non_exhaustive]
4#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct ListAuthenticatedEventsRequest {
6 #[prost(string, optional, tag = "1")]
8 pub stream_id: ::core::option::Option<::prost::alloc::string::String>,
9 #[prost(uint64, optional, tag = "2")]
11 pub start_checkpoint: ::core::option::Option<u64>,
12 #[prost(uint32, optional, tag = "3")]
14 pub page_size: ::core::option::Option<u32>,
15 #[prost(bytes = "vec", optional, tag = "4")]
17 pub page_token: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
18}
19#[non_exhaustive]
21#[derive(Clone, PartialEq, ::prost::Message)]
22pub struct ListAuthenticatedEventsResponse {
23 #[prost(message, repeated, tag = "1")]
24 pub events: ::prost::alloc::vec::Vec<AuthenticatedEvent>,
25 #[prost(uint64, optional, tag = "2")]
27 pub highest_indexed_checkpoint: ::core::option::Option<u64>,
28 #[prost(bytes = "vec", optional, tag = "3")]
30 pub next_page_token: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
31}
32#[non_exhaustive]
34#[derive(Clone, PartialEq, ::prost::Message)]
35pub struct AuthenticatedEvent {
36 #[prost(uint64, optional, tag = "1")]
38 pub checkpoint: ::core::option::Option<u64>,
39 #[prost(uint32, optional, tag = "2")]
41 pub transaction_idx: ::core::option::Option<u32>,
42 #[prost(uint32, optional, tag = "3")]
44 pub event_idx: ::core::option::Option<u32>,
45 #[prost(message, optional, tag = "4")]
47 pub event: ::core::option::Option<::sui_rpc::proto::sui::rpc::v2::Event>,
48 #[prost(string, optional, tag = "5")]
50 pub stream_id: ::core::option::Option<::prost::alloc::string::String>,
51}
52pub mod event_service_client {
54 #![allow(
55 unused_variables,
56 dead_code,
57 missing_docs,
58 clippy::wildcard_imports,
59 clippy::let_unit_value,
60 )]
61 use tonic::codegen::*;
62 use tonic::codegen::http::Uri;
63 #[derive(Debug, Clone)]
65 pub struct EventServiceClient<T> {
66 inner: tonic::client::Grpc<T>,
67 }
68 impl EventServiceClient<tonic::transport::Channel> {
69 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
71 where
72 D: TryInto<tonic::transport::Endpoint>,
73 D::Error: Into<StdError>,
74 {
75 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
76 Ok(Self::new(conn))
77 }
78 }
79 impl<T> EventServiceClient<T>
80 where
81 T: tonic::client::GrpcService<tonic::body::Body>,
82 T::Error: Into<StdError>,
83 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
84 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
85 {
86 pub fn new(inner: T) -> Self {
87 let inner = tonic::client::Grpc::new(inner);
88 Self { inner }
89 }
90 pub fn with_origin(inner: T, origin: Uri) -> Self {
91 let inner = tonic::client::Grpc::with_origin(inner, origin);
92 Self { inner }
93 }
94 pub fn with_interceptor<F>(
95 inner: T,
96 interceptor: F,
97 ) -> EventServiceClient<InterceptedService<T, F>>
98 where
99 F: tonic::service::Interceptor,
100 T::ResponseBody: Default,
101 T: tonic::codegen::Service<
102 http::Request<tonic::body::Body>,
103 Response = http::Response<
104 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
105 >,
106 >,
107 <T as tonic::codegen::Service<
108 http::Request<tonic::body::Body>,
109 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
110 {
111 EventServiceClient::new(InterceptedService::new(inner, interceptor))
112 }
113 #[must_use]
118 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
119 self.inner = self.inner.send_compressed(encoding);
120 self
121 }
122 #[must_use]
124 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
125 self.inner = self.inner.accept_compressed(encoding);
126 self
127 }
128 #[must_use]
132 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
133 self.inner = self.inner.max_decoding_message_size(limit);
134 self
135 }
136 #[must_use]
140 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
141 self.inner = self.inner.max_encoding_message_size(limit);
142 self
143 }
144 pub async fn list_authenticated_events(
146 &mut self,
147 request: impl tonic::IntoRequest<super::ListAuthenticatedEventsRequest>,
148 ) -> std::result::Result<
149 tonic::Response<super::ListAuthenticatedEventsResponse>,
150 tonic::Status,
151 > {
152 self.inner
153 .ready()
154 .await
155 .map_err(|e| {
156 tonic::Status::unknown(
157 format!("Service was not ready: {}", e.into()),
158 )
159 })?;
160 let codec = tonic_prost::ProstCodec::default();
161 let path = http::uri::PathAndQuery::from_static(
162 "/sui.rpc.alpha.EventService/ListAuthenticatedEvents",
163 );
164 let mut req = request.into_request();
165 req.extensions_mut()
166 .insert(
167 GrpcMethod::new(
168 "sui.rpc.alpha.EventService",
169 "ListAuthenticatedEvents",
170 ),
171 );
172 self.inner.unary(req, path, codec).await
173 }
174 }
175}
176pub mod event_service_server {
178 #![allow(
179 unused_variables,
180 dead_code,
181 missing_docs,
182 clippy::wildcard_imports,
183 clippy::let_unit_value,
184 )]
185 use tonic::codegen::*;
186 #[async_trait]
188 pub trait EventService: std::marker::Send + std::marker::Sync + 'static {
189 async fn list_authenticated_events(
191 &self,
192 request: tonic::Request<super::ListAuthenticatedEventsRequest>,
193 ) -> std::result::Result<
194 tonic::Response<super::ListAuthenticatedEventsResponse>,
195 tonic::Status,
196 >;
197 }
198 #[derive(Debug)]
200 pub struct EventServiceServer<T> {
201 inner: Arc<T>,
202 accept_compression_encodings: EnabledCompressionEncodings,
203 send_compression_encodings: EnabledCompressionEncodings,
204 max_decoding_message_size: Option<usize>,
205 max_encoding_message_size: Option<usize>,
206 }
207 impl<T> EventServiceServer<T> {
208 pub fn new(inner: T) -> Self {
209 Self::from_arc(Arc::new(inner))
210 }
211 pub fn from_arc(inner: Arc<T>) -> Self {
212 Self {
213 inner,
214 accept_compression_encodings: Default::default(),
215 send_compression_encodings: Default::default(),
216 max_decoding_message_size: None,
217 max_encoding_message_size: None,
218 }
219 }
220 pub fn with_interceptor<F>(
221 inner: T,
222 interceptor: F,
223 ) -> InterceptedService<Self, F>
224 where
225 F: tonic::service::Interceptor,
226 {
227 InterceptedService::new(Self::new(inner), interceptor)
228 }
229 #[must_use]
231 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
232 self.accept_compression_encodings.enable(encoding);
233 self
234 }
235 #[must_use]
237 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
238 self.send_compression_encodings.enable(encoding);
239 self
240 }
241 #[must_use]
245 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
246 self.max_decoding_message_size = Some(limit);
247 self
248 }
249 #[must_use]
253 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
254 self.max_encoding_message_size = Some(limit);
255 self
256 }
257 }
258 impl<T, B> tonic::codegen::Service<http::Request<B>> for EventServiceServer<T>
259 where
260 T: EventService,
261 B: Body + std::marker::Send + 'static,
262 B::Error: Into<StdError> + std::marker::Send + 'static,
263 {
264 type Response = http::Response<tonic::body::Body>;
265 type Error = std::convert::Infallible;
266 type Future = BoxFuture<Self::Response, Self::Error>;
267 fn poll_ready(
268 &mut self,
269 _cx: &mut Context<'_>,
270 ) -> Poll<std::result::Result<(), Self::Error>> {
271 Poll::Ready(Ok(()))
272 }
273 fn call(&mut self, req: http::Request<B>) -> Self::Future {
274 match req.uri().path() {
275 "/sui.rpc.alpha.EventService/ListAuthenticatedEvents" => {
276 #[allow(non_camel_case_types)]
277 struct ListAuthenticatedEventsSvc<T: EventService>(pub Arc<T>);
278 impl<
279 T: EventService,
280 > tonic::server::UnaryService<super::ListAuthenticatedEventsRequest>
281 for ListAuthenticatedEventsSvc<T> {
282 type Response = super::ListAuthenticatedEventsResponse;
283 type Future = BoxFuture<
284 tonic::Response<Self::Response>,
285 tonic::Status,
286 >;
287 fn call(
288 &mut self,
289 request: tonic::Request<
290 super::ListAuthenticatedEventsRequest,
291 >,
292 ) -> Self::Future {
293 let inner = Arc::clone(&self.0);
294 let fut = async move {
295 <T as EventService>::list_authenticated_events(
296 &inner,
297 request,
298 )
299 .await
300 };
301 Box::pin(fut)
302 }
303 }
304 let accept_compression_encodings = self.accept_compression_encodings;
305 let send_compression_encodings = self.send_compression_encodings;
306 let max_decoding_message_size = self.max_decoding_message_size;
307 let max_encoding_message_size = self.max_encoding_message_size;
308 let inner = self.inner.clone();
309 let fut = async move {
310 let method = ListAuthenticatedEventsSvc(inner);
311 let codec = tonic_prost::ProstCodec::default();
312 let mut grpc = tonic::server::Grpc::new(codec)
313 .apply_compression_config(
314 accept_compression_encodings,
315 send_compression_encodings,
316 )
317 .apply_max_message_size_config(
318 max_decoding_message_size,
319 max_encoding_message_size,
320 );
321 let res = grpc.unary(method, req).await;
322 Ok(res)
323 };
324 Box::pin(fut)
325 }
326 _ => {
327 Box::pin(async move {
328 let mut response = http::Response::new(
329 tonic::body::Body::default(),
330 );
331 let headers = response.headers_mut();
332 headers
333 .insert(
334 tonic::Status::GRPC_STATUS,
335 (tonic::Code::Unimplemented as i32).into(),
336 );
337 headers
338 .insert(
339 http::header::CONTENT_TYPE,
340 tonic::metadata::GRPC_CONTENT_TYPE,
341 );
342 Ok(response)
343 })
344 }
345 }
346 }
347 }
348 impl<T> Clone for EventServiceServer<T> {
349 fn clone(&self) -> Self {
350 let inner = self.inner.clone();
351 Self {
352 inner,
353 accept_compression_encodings: self.accept_compression_encodings,
354 send_compression_encodings: self.send_compression_encodings,
355 max_decoding_message_size: self.max_decoding_message_size,
356 max_encoding_message_size: self.max_encoding_message_size,
357 }
358 }
359 }
360 pub const SERVICE_NAME: &str = "sui.rpc.alpha.EventService";
362 impl<T> tonic::server::NamedService for EventServiceServer<T> {
363 const NAME: &'static str = SERVICE_NAME;
364 }
365}