Skip to main content

sui_rpc/proto/generated/
sui.rpc.v2alpha.rs

1// This file is @generated by prost-build.
2/// DNF filter for transactions: any term may match, and each term is an AND
3/// of signed literals.
4/// An absent filter matches everything. A present filter must have at least one
5/// term, and every term must have at least one included literal.
6#[non_exhaustive]
7#[derive(Clone, PartialEq, ::prost::Message)]
8pub struct TransactionFilter {
9    /// Terms are ORed together.
10    #[prost(message, repeated, tag = "1")]
11    pub terms: ::prost::alloc::vec::Vec<TransactionTerm>,
12}
13/// One conjunction in a transaction DNF filter.
14#[non_exhaustive]
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct TransactionTerm {
17    /// Literals are ANDed together.
18    #[prost(message, repeated, tag = "1")]
19    pub literals: ::prost::alloc::vec::Vec<TransactionLiteral>,
20}
21/// One signed transaction predicate literal.
22#[non_exhaustive]
23#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
24pub struct TransactionLiteral {
25    #[prost(oneof = "transaction_literal::Polarity", tags = "1, 2")]
26    pub polarity: ::core::option::Option<transaction_literal::Polarity>,
27}
28/// Nested message and enum types in `TransactionLiteral`.
29pub mod transaction_literal {
30    #[non_exhaustive]
31    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
32    pub enum Polarity {
33        /// The predicate must match.
34        #[prost(message, tag = "1")]
35        Include(super::TransactionPredicate),
36        /// The predicate must not match.
37        #[prost(message, tag = "2")]
38        Exclude(super::TransactionPredicate),
39    }
40}
41/// One transaction-index predicate.
42#[non_exhaustive]
43#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
44pub struct TransactionPredicate {
45    #[prost(oneof = "transaction_predicate::Predicate", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
46    pub predicate: ::core::option::Option<transaction_predicate::Predicate>,
47}
48/// Nested message and enum types in `TransactionPredicate`.
49pub mod transaction_predicate {
50    #[non_exhaustive]
51    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
52    pub enum Predicate {
53        /// Match transactions sent by the specified address.
54        #[prost(message, tag = "1")]
55        Sender(super::SenderFilter),
56        /// Match transactions where the specified address's state moved as a side
57        /// effect: it owns an object after the txn, owned an object before the
58        /// txn that was mutated/transferred away/deleted/wrapped, or its
59        /// address-balance changed via an accumulator event.
60        #[prost(message, tag = "2")]
61        AffectedAddress(super::AffectedAddressFilter),
62        /// Match transactions whose effects include a change for the specified
63        /// object.
64        #[prost(message, tag = "3")]
65        AffectedObject(super::AffectedObjectFilter),
66        /// Match transactions that made a Move call matching the specified filter.
67        #[prost(message, tag = "4")]
68        MoveCall(super::MoveCallFilter),
69        /// Match transactions that emitted an event whose package/module fields
70        /// match the specified filter.
71        #[prost(message, tag = "5")]
72        EmitModule(super::EmitModuleFilter),
73        /// Match transactions that emitted an event with a type matching the
74        /// specified filter.
75        #[prost(message, tag = "6")]
76        EventType(super::EventTypeFilter),
77        /// Match transactions that wrote to the specified authenticated event
78        /// stream head.
79        #[prost(message, tag = "7")]
80        EventStreamHead(super::EventStreamHeadFilter),
81        /// Match transactions that wrote a Move package — a first publish or an
82        /// upgrade, of any package.
83        #[prost(message, tag = "8")]
84        PackageWrite(super::PackageWriteFilter),
85    }
86}
87/// DNF filter for events: any term may match, and each term is an AND of
88/// signed literals. Sender predicates match all events from matching
89/// transactions; emit-module, event-type, and event-stream-head predicates match
90/// individual event-space dimensions. An absent filter matches everything. A
91/// present filter must have at least one term, and every term must have at least
92/// one included literal.
93#[non_exhaustive]
94#[derive(Clone, PartialEq, ::prost::Message)]
95pub struct EventFilter {
96    /// Terms are ORed together.
97    #[prost(message, repeated, tag = "1")]
98    pub terms: ::prost::alloc::vec::Vec<EventTerm>,
99}
100/// One conjunction in an event DNF filter.
101#[non_exhaustive]
102#[derive(Clone, PartialEq, ::prost::Message)]
103pub struct EventTerm {
104    /// Literals are ANDed together.
105    #[prost(message, repeated, tag = "1")]
106    pub literals: ::prost::alloc::vec::Vec<EventLiteral>,
107}
108/// One signed event predicate literal.
109#[non_exhaustive]
110#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
111pub struct EventLiteral {
112    #[prost(oneof = "event_literal::Polarity", tags = "1, 2")]
113    pub polarity: ::core::option::Option<event_literal::Polarity>,
114}
115/// Nested message and enum types in `EventLiteral`.
116pub mod event_literal {
117    #[non_exhaustive]
118    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
119    pub enum Polarity {
120        /// The predicate must match.
121        #[prost(message, tag = "1")]
122        Include(super::EventPredicate),
123        /// The predicate must not match.
124        #[prost(message, tag = "2")]
125        Exclude(super::EventPredicate),
126    }
127}
128/// One event-index predicate.
129#[non_exhaustive]
130#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
131pub struct EventPredicate {
132    #[prost(oneof = "event_predicate::Predicate", tags = "1, 2, 3, 4")]
133    pub predicate: ::core::option::Option<event_predicate::Predicate>,
134}
135/// Nested message and enum types in `EventPredicate`.
136pub mod event_predicate {
137    #[non_exhaustive]
138    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
139    pub enum Predicate {
140        /// Match events from transactions sent by the specified address.
141        #[prost(message, tag = "1")]
142        Sender(super::SenderFilter),
143        /// Match events whose package/module fields match the specified filter.
144        #[prost(message, tag = "2")]
145        EmitModule(super::EmitModuleFilter),
146        /// Match events whose type matches the specified filter.
147        #[prost(message, tag = "3")]
148        EventType(super::EventTypeFilter),
149        /// Match events committed to the specified authenticated event stream head.
150        #[prost(message, tag = "4")]
151        EventStreamHead(super::EventStreamHeadFilter),
152    }
153}
154/// Match by transaction sender address.
155#[non_exhaustive]
156#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
157pub struct SenderFilter {
158    /// The sender address (hex-encoded).
159    #[prost(string, optional, tag = "1")]
160    pub address: ::core::option::Option<::prost::alloc::string::String>,
161}
162/// Match by any address whose state moved as a side effect of the
163/// transaction: object ownership changes (in either direction), prior
164/// owners of removed/wrapped objects, and address-balance changes via
165/// accumulator events.
166#[non_exhaustive]
167#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
168pub struct AffectedAddressFilter {
169    /// The affected address (hex-encoded).
170    #[prost(string, optional, tag = "1")]
171    pub address: ::core::option::Option<::prost::alloc::string::String>,
172}
173/// Match by changed object ID.
174#[non_exhaustive]
175#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
176pub struct AffectedObjectFilter {
177    /// The changed object ID (hex-encoded).
178    #[prost(string, optional, tag = "1")]
179    pub object_id: ::core::option::Option<::prost::alloc::string::String>,
180}
181/// Match by Move function call, specified as a `::`-delimited Move path.
182///
183/// Specificity levels:
184/// "0xpkg"                        -> matches any call in the package
185/// "0xpkg::module"                -> matches any call in the module
186/// "0xpkg::module::function"      -> matches calls to the exact function
187#[non_exhaustive]
188#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
189pub struct MoveCallFilter {
190    /// Required. Move path of the form `package\[::module[::function]\]`.
191    #[prost(string, optional, tag = "1")]
192    pub function: ::core::option::Option<::prost::alloc::string::String>,
193}
194/// Match by an event's package/module fields, specified as a `::`-delimited
195/// Move path. These identify the top-level Move call that triggered the event.
196///
197/// Specificity levels:
198/// "0xpkg"               -> matches events with this package_id
199/// "0xpkg::module"       -> matches events with this package_id and module
200#[non_exhaustive]
201#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
202pub struct EmitModuleFilter {
203    /// Required. Move path of the form `package\[::module\]`.
204    #[prost(string, optional, tag = "1")]
205    pub module: ::core::option::Option<::prost::alloc::string::String>,
206}
207/// Match by event struct type, specified as a Move type string.
208///
209/// Specificity levels:
210/// "0xaddr"                              -> matches events whose type is defined at this address
211/// "0xaddr::module"                      -> matches events whose type is in this module
212/// "0xaddr::module::Name"                -> matches events with this type name (any instantiation)
213/// "0xaddr::module::Name\<T1, T2>"        -> matches events with this exact generic instantiation
214#[non_exhaustive]
215#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
216pub struct EventTypeFilter {
217    /// Required. Move type string of the form
218    /// `address\[::module[::Name[<type_params>]\]]`.
219    #[prost(string, optional, tag = "1")]
220    pub r#type: ::core::option::Option<::prost::alloc::string::String>,
221}
222/// Match by authenticated event stream head.
223#[non_exhaustive]
224#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
225pub struct EventStreamHeadFilter {
226    /// The stream id address (hex-encoded).
227    #[prost(string, optional, tag = "1")]
228    pub stream_id: ::core::option::Option<::prost::alloc::string::String>,
229}
230/// Match transactions that wrote a Move package.
231#[non_exhaustive]
232#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
233pub struct PackageWriteFilter {}
234/// Request message for LedgerService.ListCheckpoints.
235#[non_exhaustive]
236#[derive(Clone, PartialEq, ::prost::Message)]
237pub struct ListCheckpointsRequest {
238    /// Optional. Mask for specifying which parts of the Checkpoint should be
239    /// returned (e.g. summary, contents, signatures).
240    #[prost(message, optional, tag = "1")]
241    pub read_mask: ::core::option::Option<::prost_types::FieldMask>,
242    /// Optional. Start of the checkpoint range to query (inclusive). Defaults to
243    /// genesis.
244    #[prost(uint64, optional, tag = "2")]
245    pub start_checkpoint: ::core::option::Option<u64>,
246    /// Optional. End of the checkpoint range to query (exclusive). Defaults to the
247    /// current indexed ledger tip.
248    #[prost(uint64, optional, tag = "3")]
249    pub end_checkpoint: ::core::option::Option<u64>,
250    /// Optional. DNF filter over indexed transaction dimensions. A checkpoint
251    /// matches if any transaction it contains satisfies the filter. If absent,
252    /// all checkpoints in the range are returned.
253    #[prost(message, optional, tag = "4")]
254    pub filter: ::core::option::Option<TransactionFilter>,
255    /// Optional cursor-bounded query options. If unspecified, reads in ascending
256    /// order with the default item limit. The server enforces a maximum item
257    /// limit and silently coerces larger values down to it. To paginate, track
258    /// the latest `Watermark.cursor` received — from either a standalone
259    /// `Watermark` frame or the `watermark` field on an item — and pass it as
260    /// `options.after` (ascending) or `options.before` (descending) on the
261    /// next request.
262    #[prost(message, optional, tag = "5")]
263    pub options: ::core::option::Option<QueryOptions>,
264}
265/// One checkpoint item.
266#[non_exhaustive]
267#[derive(Clone, PartialEq, ::prost::Message)]
268pub struct CheckpointItem {
269    /// One matching checkpoint.
270    #[prost(message, optional, tag = "1")]
271    pub checkpoint: ::core::option::Option<super::v2::Checkpoint>,
272    /// Progress watermark as of when this item was emitted: its `cursor`
273    /// is the resume point past this item, and `checkpoint_hi` /
274    /// `checkpoint_lo` (whichever matches the request ordering) is the
275    /// inclusive boundary checkpoint that the scan has fully covered.
276    #[prost(message, optional, tag = "2")]
277    pub watermark: ::core::option::Option<Watermark>,
278}
279/// Response message for LedgerService.ListCheckpoints.
280#[non_exhaustive]
281#[derive(Clone, PartialEq, ::prost::Message)]
282pub struct ListCheckpointsResponse {
283    #[prost(oneof = "list_checkpoints_response::Response", tags = "1, 2, 3")]
284    pub response: ::core::option::Option<list_checkpoints_response::Response>,
285}
286/// Nested message and enum types in `ListCheckpointsResponse`.
287pub mod list_checkpoints_response {
288    #[non_exhaustive]
289    #[derive(Clone, PartialEq, ::prost::Oneof)]
290    pub enum Response {
291        /// One matching checkpoint.
292        #[prost(message, tag = "1")]
293        Item(super::CheckpointItem),
294        /// Standalone scan-progress watermark emitted between items when the
295        /// underlying scan advances without producing a matching item.
296        #[prost(message, tag = "2")]
297        Watermark(super::Watermark),
298        /// Final frame for this successful query stream.
299        #[prost(message, tag = "3")]
300        End(super::QueryEnd),
301    }
302}
303/// Request message for LedgerService.ListTransactions.
304#[non_exhaustive]
305#[derive(Clone, PartialEq, ::prost::Message)]
306pub struct ListTransactionsRequest {
307    /// Optional. Mask for specifying which parts of the ExecutedTransaction
308    /// should be returned.
309    #[prost(message, optional, tag = "1")]
310    pub read_mask: ::core::option::Option<::prost_types::FieldMask>,
311    /// Optional. Start of the checkpoint range to query (inclusive). Defaults to
312    /// genesis.
313    #[prost(uint64, optional, tag = "2")]
314    pub start_checkpoint: ::core::option::Option<u64>,
315    /// Optional. End of the checkpoint range to query (exclusive). Defaults to the
316    /// current indexed ledger tip.
317    #[prost(uint64, optional, tag = "3")]
318    pub end_checkpoint: ::core::option::Option<u64>,
319    /// Optional. DNF filter over indexed dimensions.
320    /// If absent, all transactions in the range are returned.
321    #[prost(message, optional, tag = "4")]
322    pub filter: ::core::option::Option<TransactionFilter>,
323    /// Optional cursor-bounded query options. If unspecified, reads in ascending
324    /// order with the default item limit. The server enforces a maximum item
325    /// limit and silently coerces larger values down to it. To paginate, track
326    /// the latest `Watermark.cursor` received — from either a standalone
327    /// `Watermark` frame or the `watermark` field on an item — and pass it as
328    /// `options.after` (ascending) or `options.before` (descending) on the
329    /// next request.
330    #[prost(message, optional, tag = "5")]
331    pub options: ::core::option::Option<QueryOptions>,
332}
333/// One transaction item.
334#[non_exhaustive]
335#[derive(Clone, PartialEq, ::prost::Message)]
336pub struct TransactionItem {
337    /// One matching transaction.
338    #[prost(message, optional, tag = "1")]
339    pub transaction: ::core::option::Option<super::v2::ExecutedTransaction>,
340    /// Progress watermark as of when this item was emitted: its `cursor`
341    /// is the resume point past this item, and `checkpoint_hi` /
342    /// `checkpoint_lo` (whichever matches the request ordering) is the
343    /// inclusive boundary checkpoint that the scan has fully covered.
344    #[prost(message, optional, tag = "2")]
345    pub watermark: ::core::option::Option<Watermark>,
346    /// Zero-based position of this transaction within the checkpoint that
347    /// includes it (the checkpoint reported on the embedded
348    /// `ExecutedTransaction`).
349    #[prost(uint64, optional, tag = "3")]
350    pub transaction_offset: ::core::option::Option<u64>,
351}
352/// Response message for LedgerService.ListTransactions.
353#[non_exhaustive]
354#[derive(Clone, PartialEq, ::prost::Message)]
355pub struct ListTransactionsResponse {
356    #[prost(oneof = "list_transactions_response::Response", tags = "1, 2, 3")]
357    pub response: ::core::option::Option<list_transactions_response::Response>,
358}
359/// Nested message and enum types in `ListTransactionsResponse`.
360pub mod list_transactions_response {
361    #[non_exhaustive]
362    #[derive(Clone, PartialEq, ::prost::Oneof)]
363    pub enum Response {
364        /// One matching transaction.
365        #[prost(message, tag = "1")]
366        Item(super::TransactionItem),
367        /// Standalone scan-progress watermark emitted between items when the
368        /// underlying scan advances without producing a matching item.
369        #[prost(message, tag = "2")]
370        Watermark(super::Watermark),
371        /// Final frame for this successful query stream.
372        #[prost(message, tag = "3")]
373        End(super::QueryEnd),
374    }
375}
376/// Request message for LedgerService.ListEvents.
377#[non_exhaustive]
378#[derive(Clone, PartialEq, ::prost::Message)]
379pub struct ListEventsRequest {
380    /// Optional. Mask for specifying which parts of the Event should be returned.
381    #[prost(message, optional, tag = "1")]
382    pub read_mask: ::core::option::Option<::prost_types::FieldMask>,
383    /// Optional. Start of the checkpoint range to query (inclusive). Defaults to
384    /// genesis.
385    #[prost(uint64, optional, tag = "2")]
386    pub start_checkpoint: ::core::option::Option<u64>,
387    /// Optional. End of the checkpoint range to query (exclusive). Defaults to the
388    /// current indexed ledger tip.
389    #[prost(uint64, optional, tag = "3")]
390    pub end_checkpoint: ::core::option::Option<u64>,
391    /// Optional. DNF filter over indexed dimensions.
392    /// If absent, all events in the range are returned.
393    #[prost(message, optional, tag = "4")]
394    pub filter: ::core::option::Option<EventFilter>,
395    /// Optional cursor-bounded query options. If unspecified, reads in ascending
396    /// order with the default item limit. The server enforces a maximum item
397    /// limit and silently coerces larger values down to it. To paginate, track
398    /// the latest `Watermark.cursor` received — from either a standalone
399    /// `Watermark` frame or the `watermark` field on an item — and pass it as
400    /// `options.after` (ascending) or `options.before` (descending) on the
401    /// next request.
402    #[prost(message, optional, tag = "5")]
403    pub options: ::core::option::Option<QueryOptions>,
404}
405/// One event item.
406#[non_exhaustive]
407#[derive(Clone, PartialEq, ::prost::Message)]
408pub struct EventItem {
409    /// Progress watermark as of when this item was emitted: its `cursor`
410    /// is the resume point past this item, and `checkpoint_hi` /
411    /// `checkpoint_lo` (whichever matches the request ordering) is the
412    /// inclusive boundary checkpoint that the scan has fully covered.
413    #[prost(message, optional, tag = "1")]
414    pub watermark: ::core::option::Option<Watermark>,
415    /// The checkpoint containing the transaction that emitted this event.
416    #[prost(uint64, optional, tag = "2")]
417    pub checkpoint: ::core::option::Option<u64>,
418    /// The index of this event within the transaction's event list (0-based).
419    #[prost(uint32, optional, tag = "3")]
420    pub event_index: ::core::option::Option<u32>,
421    /// The digest of the transaction that emitted this event.
422    #[prost(string, optional, tag = "4")]
423    pub transaction_digest: ::core::option::Option<::prost::alloc::string::String>,
424    /// The event data.
425    #[prost(message, optional, tag = "5")]
426    pub event: ::core::option::Option<super::v2::Event>,
427    /// 0-based index of the emitting transaction within its containing
428    /// checkpoint. Required for clients verifying authenticated event
429    /// streams: this index is part of the BCS-encoded `EventCommitment`
430    /// leaf used to construct the per-checkpoint merkle root.
431    #[prost(uint64, optional, tag = "6")]
432    pub transaction_offset: ::core::option::Option<u64>,
433}
434/// Response message for LedgerService.ListEvents.
435#[non_exhaustive]
436#[derive(Clone, PartialEq, ::prost::Message)]
437pub struct ListEventsResponse {
438    #[prost(oneof = "list_events_response::Response", tags = "1, 2, 3")]
439    pub response: ::core::option::Option<list_events_response::Response>,
440}
441/// Nested message and enum types in `ListEventsResponse`.
442pub mod list_events_response {
443    #[non_exhaustive]
444    #[derive(Clone, PartialEq, ::prost::Oneof)]
445    pub enum Response {
446        /// One matching event.
447        #[prost(message, tag = "1")]
448        Item(super::EventItem),
449        /// Standalone scan-progress watermark emitted between items when the
450        /// underlying scan advances without producing a matching item.
451        #[prost(message, tag = "2")]
452        Watermark(super::Watermark),
453        /// Final frame for this successful query stream.
454        #[prost(message, tag = "3")]
455        End(super::QueryEnd),
456    }
457}
458/// Generated client implementations.
459pub mod ledger_service_client {
460    #![allow(
461        unused_variables,
462        dead_code,
463        missing_docs,
464        clippy::wildcard_imports,
465        clippy::let_unit_value,
466    )]
467    use tonic::codegen::*;
468    use tonic::codegen::http::Uri;
469    /// LedgerService provides bounded, filtered access to checkpoints, transactions, and events.
470    #[derive(Debug, Clone)]
471    pub struct LedgerServiceClient<T> {
472        inner: tonic::client::Grpc<T>,
473    }
474    impl LedgerServiceClient<tonic::transport::Channel> {
475        /// Attempt to create a new client by connecting to a given endpoint.
476        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
477        where
478            D: TryInto<tonic::transport::Endpoint>,
479            D::Error: Into<StdError>,
480        {
481            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
482            Ok(Self::new(conn))
483        }
484    }
485    impl<T> LedgerServiceClient<T>
486    where
487        T: tonic::client::GrpcService<tonic::body::Body>,
488        T::Error: Into<StdError>,
489        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
490        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
491    {
492        pub fn new(inner: T) -> Self {
493            let inner = tonic::client::Grpc::new(inner);
494            Self { inner }
495        }
496        pub fn with_origin(inner: T, origin: Uri) -> Self {
497            let inner = tonic::client::Grpc::with_origin(inner, origin);
498            Self { inner }
499        }
500        pub fn with_interceptor<F>(
501            inner: T,
502            interceptor: F,
503        ) -> LedgerServiceClient<InterceptedService<T, F>>
504        where
505            F: tonic::service::Interceptor,
506            T::ResponseBody: Default,
507            T: tonic::codegen::Service<
508                http::Request<tonic::body::Body>,
509                Response = http::Response<
510                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
511                >,
512            >,
513            <T as tonic::codegen::Service<
514                http::Request<tonic::body::Body>,
515            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
516        {
517            LedgerServiceClient::new(InterceptedService::new(inner, interceptor))
518        }
519        /// Compress requests with the given encoding.
520        ///
521        /// This requires the server to support it otherwise it might respond with an
522        /// error.
523        #[must_use]
524        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
525            self.inner = self.inner.send_compressed(encoding);
526            self
527        }
528        /// Enable decompressing responses.
529        #[must_use]
530        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
531            self.inner = self.inner.accept_compressed(encoding);
532            self
533        }
534        /// Limits the maximum size of a decoded message.
535        ///
536        /// Default: `4MB`
537        #[must_use]
538        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
539            self.inner = self.inner.max_decoding_message_size(limit);
540            self
541        }
542        /// Limits the maximum size of an encoded message.
543        ///
544        /// Default: `usize::MAX`
545        #[must_use]
546        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
547            self.inner = self.inner.max_encoding_message_size(limit);
548            self
549        }
550        /// List checkpoints matching the provided filters.
551        ///
552        /// Checkpoints are returned in ascending or descending checkpoint sequence
553        /// number order according to the query options ordering.
554        /// A checkpoint matches if any transaction it contains satisfies the filter.
555        pub async fn list_checkpoints(
556            &mut self,
557            request: impl tonic::IntoRequest<super::ListCheckpointsRequest>,
558        ) -> std::result::Result<
559            tonic::Response<tonic::codec::Streaming<super::ListCheckpointsResponse>>,
560            tonic::Status,
561        > {
562            self.inner
563                .ready()
564                .await
565                .map_err(|e| {
566                    tonic::Status::unknown(
567                        format!("Service was not ready: {}", e.into()),
568                    )
569                })?;
570            let codec = tonic_prost::ProstCodec::default();
571            let path = http::uri::PathAndQuery::from_static(
572                "/sui.rpc.v2alpha.LedgerService/ListCheckpoints",
573            );
574            let mut req = request.into_request();
575            req.extensions_mut()
576                .insert(
577                    GrpcMethod::new("sui.rpc.v2alpha.LedgerService", "ListCheckpoints"),
578                );
579            self.inner.server_streaming(req, path, codec).await
580        }
581        /// List transactions matching the provided filters.
582        ///
583        /// Transactions are returned in ascending or descending transaction sequence
584        /// order according to the query options ordering.
585        pub async fn list_transactions(
586            &mut self,
587            request: impl tonic::IntoRequest<super::ListTransactionsRequest>,
588        ) -> std::result::Result<
589            tonic::Response<tonic::codec::Streaming<super::ListTransactionsResponse>>,
590            tonic::Status,
591        > {
592            self.inner
593                .ready()
594                .await
595                .map_err(|e| {
596                    tonic::Status::unknown(
597                        format!("Service was not ready: {}", e.into()),
598                    )
599                })?;
600            let codec = tonic_prost::ProstCodec::default();
601            let path = http::uri::PathAndQuery::from_static(
602                "/sui.rpc.v2alpha.LedgerService/ListTransactions",
603            );
604            let mut req = request.into_request();
605            req.extensions_mut()
606                .insert(
607                    GrpcMethod::new("sui.rpc.v2alpha.LedgerService", "ListTransactions"),
608                );
609            self.inner.server_streaming(req, path, codec).await
610        }
611        /// List events matching the provided filters.
612        ///
613        /// Events are returned in ascending or descending packed event sequence order
614        /// according to the query options ordering.
615        pub async fn list_events(
616            &mut self,
617            request: impl tonic::IntoRequest<super::ListEventsRequest>,
618        ) -> std::result::Result<
619            tonic::Response<tonic::codec::Streaming<super::ListEventsResponse>>,
620            tonic::Status,
621        > {
622            self.inner
623                .ready()
624                .await
625                .map_err(|e| {
626                    tonic::Status::unknown(
627                        format!("Service was not ready: {}", e.into()),
628                    )
629                })?;
630            let codec = tonic_prost::ProstCodec::default();
631            let path = http::uri::PathAndQuery::from_static(
632                "/sui.rpc.v2alpha.LedgerService/ListEvents",
633            );
634            let mut req = request.into_request();
635            req.extensions_mut()
636                .insert(GrpcMethod::new("sui.rpc.v2alpha.LedgerService", "ListEvents"));
637            self.inner.server_streaming(req, path, codec).await
638        }
639    }
640}
641/// Generated server implementations.
642pub mod ledger_service_server {
643    #![allow(
644        unused_variables,
645        dead_code,
646        missing_docs,
647        clippy::wildcard_imports,
648        clippy::let_unit_value,
649    )]
650    use tonic::codegen::*;
651    /// Generated trait containing gRPC methods that should be implemented for use with LedgerServiceServer.
652    #[async_trait]
653    pub trait LedgerService: std::marker::Send + std::marker::Sync + 'static {
654        /// List checkpoints matching the provided filters.
655        ///
656        /// Checkpoints are returned in ascending or descending checkpoint sequence
657        /// number order according to the query options ordering.
658        /// A checkpoint matches if any transaction it contains satisfies the filter.
659        async fn list_checkpoints(
660            &self,
661            request: tonic::Request<super::ListCheckpointsRequest>,
662        ) -> std::result::Result<
663            tonic::Response<BoxStream<super::ListCheckpointsResponse>>,
664            tonic::Status,
665        > {
666            Err(tonic::Status::unimplemented("Not yet implemented"))
667        }
668        /// List transactions matching the provided filters.
669        ///
670        /// Transactions are returned in ascending or descending transaction sequence
671        /// order according to the query options ordering.
672        async fn list_transactions(
673            &self,
674            request: tonic::Request<super::ListTransactionsRequest>,
675        ) -> std::result::Result<
676            tonic::Response<BoxStream<super::ListTransactionsResponse>>,
677            tonic::Status,
678        > {
679            Err(tonic::Status::unimplemented("Not yet implemented"))
680        }
681        /// List events matching the provided filters.
682        ///
683        /// Events are returned in ascending or descending packed event sequence order
684        /// according to the query options ordering.
685        async fn list_events(
686            &self,
687            request: tonic::Request<super::ListEventsRequest>,
688        ) -> std::result::Result<
689            tonic::Response<BoxStream<super::ListEventsResponse>>,
690            tonic::Status,
691        > {
692            Err(tonic::Status::unimplemented("Not yet implemented"))
693        }
694    }
695    /// LedgerService provides bounded, filtered access to checkpoints, transactions, and events.
696    #[derive(Debug)]
697    pub struct LedgerServiceServer<T> {
698        inner: Arc<T>,
699        accept_compression_encodings: EnabledCompressionEncodings,
700        send_compression_encodings: EnabledCompressionEncodings,
701        max_decoding_message_size: Option<usize>,
702        max_encoding_message_size: Option<usize>,
703    }
704    impl<T> LedgerServiceServer<T> {
705        pub fn new(inner: T) -> Self {
706            Self::from_arc(Arc::new(inner))
707        }
708        pub fn from_arc(inner: Arc<T>) -> Self {
709            Self {
710                inner,
711                accept_compression_encodings: Default::default(),
712                send_compression_encodings: Default::default(),
713                max_decoding_message_size: None,
714                max_encoding_message_size: None,
715            }
716        }
717        pub fn with_interceptor<F>(
718            inner: T,
719            interceptor: F,
720        ) -> InterceptedService<Self, F>
721        where
722            F: tonic::service::Interceptor,
723        {
724            InterceptedService::new(Self::new(inner), interceptor)
725        }
726        /// Enable decompressing requests with the given encoding.
727        #[must_use]
728        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
729            self.accept_compression_encodings.enable(encoding);
730            self
731        }
732        /// Compress responses with the given encoding, if the client supports it.
733        #[must_use]
734        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
735            self.send_compression_encodings.enable(encoding);
736            self
737        }
738        /// Limits the maximum size of a decoded message.
739        ///
740        /// Default: `4MB`
741        #[must_use]
742        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
743            self.max_decoding_message_size = Some(limit);
744            self
745        }
746        /// Limits the maximum size of an encoded message.
747        ///
748        /// Default: `usize::MAX`
749        #[must_use]
750        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
751            self.max_encoding_message_size = Some(limit);
752            self
753        }
754    }
755    impl<T, B> tonic::codegen::Service<http::Request<B>> for LedgerServiceServer<T>
756    where
757        T: LedgerService,
758        B: Body + std::marker::Send + 'static,
759        B::Error: Into<StdError> + std::marker::Send + 'static,
760    {
761        type Response = http::Response<tonic::body::Body>;
762        type Error = std::convert::Infallible;
763        type Future = BoxFuture<Self::Response, Self::Error>;
764        fn poll_ready(
765            &mut self,
766            _cx: &mut Context<'_>,
767        ) -> Poll<std::result::Result<(), Self::Error>> {
768            Poll::Ready(Ok(()))
769        }
770        fn call(&mut self, req: http::Request<B>) -> Self::Future {
771            match req.uri().path() {
772                "/sui.rpc.v2alpha.LedgerService/ListCheckpoints" => {
773                    #[allow(non_camel_case_types)]
774                    struct ListCheckpointsSvc<T: LedgerService>(pub Arc<T>);
775                    impl<
776                        T: LedgerService,
777                    > tonic::server::ServerStreamingService<
778                        super::ListCheckpointsRequest,
779                    > for ListCheckpointsSvc<T> {
780                        type Response = super::ListCheckpointsResponse;
781                        type ResponseStream = BoxStream<super::ListCheckpointsResponse>;
782                        type Future = BoxFuture<
783                            tonic::Response<Self::ResponseStream>,
784                            tonic::Status,
785                        >;
786                        fn call(
787                            &mut self,
788                            request: tonic::Request<super::ListCheckpointsRequest>,
789                        ) -> Self::Future {
790                            let inner = Arc::clone(&self.0);
791                            let fut = async move {
792                                <T as LedgerService>::list_checkpoints(&inner, request)
793                                    .await
794                            };
795                            Box::pin(fut)
796                        }
797                    }
798                    let accept_compression_encodings = self.accept_compression_encodings;
799                    let send_compression_encodings = self.send_compression_encodings;
800                    let max_decoding_message_size = self.max_decoding_message_size;
801                    let max_encoding_message_size = self.max_encoding_message_size;
802                    let inner = self.inner.clone();
803                    let fut = async move {
804                        let method = ListCheckpointsSvc(inner);
805                        let codec = tonic_prost::ProstCodec::default();
806                        let mut grpc = tonic::server::Grpc::new(codec)
807                            .apply_compression_config(
808                                accept_compression_encodings,
809                                send_compression_encodings,
810                            )
811                            .apply_max_message_size_config(
812                                max_decoding_message_size,
813                                max_encoding_message_size,
814                            );
815                        let res = grpc.server_streaming(method, req).await;
816                        Ok(res)
817                    };
818                    Box::pin(fut)
819                }
820                "/sui.rpc.v2alpha.LedgerService/ListTransactions" => {
821                    #[allow(non_camel_case_types)]
822                    struct ListTransactionsSvc<T: LedgerService>(pub Arc<T>);
823                    impl<
824                        T: LedgerService,
825                    > tonic::server::ServerStreamingService<
826                        super::ListTransactionsRequest,
827                    > for ListTransactionsSvc<T> {
828                        type Response = super::ListTransactionsResponse;
829                        type ResponseStream = BoxStream<super::ListTransactionsResponse>;
830                        type Future = BoxFuture<
831                            tonic::Response<Self::ResponseStream>,
832                            tonic::Status,
833                        >;
834                        fn call(
835                            &mut self,
836                            request: tonic::Request<super::ListTransactionsRequest>,
837                        ) -> Self::Future {
838                            let inner = Arc::clone(&self.0);
839                            let fut = async move {
840                                <T as LedgerService>::list_transactions(&inner, request)
841                                    .await
842                            };
843                            Box::pin(fut)
844                        }
845                    }
846                    let accept_compression_encodings = self.accept_compression_encodings;
847                    let send_compression_encodings = self.send_compression_encodings;
848                    let max_decoding_message_size = self.max_decoding_message_size;
849                    let max_encoding_message_size = self.max_encoding_message_size;
850                    let inner = self.inner.clone();
851                    let fut = async move {
852                        let method = ListTransactionsSvc(inner);
853                        let codec = tonic_prost::ProstCodec::default();
854                        let mut grpc = tonic::server::Grpc::new(codec)
855                            .apply_compression_config(
856                                accept_compression_encodings,
857                                send_compression_encodings,
858                            )
859                            .apply_max_message_size_config(
860                                max_decoding_message_size,
861                                max_encoding_message_size,
862                            );
863                        let res = grpc.server_streaming(method, req).await;
864                        Ok(res)
865                    };
866                    Box::pin(fut)
867                }
868                "/sui.rpc.v2alpha.LedgerService/ListEvents" => {
869                    #[allow(non_camel_case_types)]
870                    struct ListEventsSvc<T: LedgerService>(pub Arc<T>);
871                    impl<
872                        T: LedgerService,
873                    > tonic::server::ServerStreamingService<super::ListEventsRequest>
874                    for ListEventsSvc<T> {
875                        type Response = super::ListEventsResponse;
876                        type ResponseStream = BoxStream<super::ListEventsResponse>;
877                        type Future = BoxFuture<
878                            tonic::Response<Self::ResponseStream>,
879                            tonic::Status,
880                        >;
881                        fn call(
882                            &mut self,
883                            request: tonic::Request<super::ListEventsRequest>,
884                        ) -> Self::Future {
885                            let inner = Arc::clone(&self.0);
886                            let fut = async move {
887                                <T as LedgerService>::list_events(&inner, request).await
888                            };
889                            Box::pin(fut)
890                        }
891                    }
892                    let accept_compression_encodings = self.accept_compression_encodings;
893                    let send_compression_encodings = self.send_compression_encodings;
894                    let max_decoding_message_size = self.max_decoding_message_size;
895                    let max_encoding_message_size = self.max_encoding_message_size;
896                    let inner = self.inner.clone();
897                    let fut = async move {
898                        let method = ListEventsSvc(inner);
899                        let codec = tonic_prost::ProstCodec::default();
900                        let mut grpc = tonic::server::Grpc::new(codec)
901                            .apply_compression_config(
902                                accept_compression_encodings,
903                                send_compression_encodings,
904                            )
905                            .apply_max_message_size_config(
906                                max_decoding_message_size,
907                                max_encoding_message_size,
908                            );
909                        let res = grpc.server_streaming(method, req).await;
910                        Ok(res)
911                    };
912                    Box::pin(fut)
913                }
914                _ => {
915                    Box::pin(async move {
916                        let mut response = http::Response::new(
917                            tonic::body::Body::default(),
918                        );
919                        let headers = response.headers_mut();
920                        headers
921                            .insert(
922                                tonic::Status::GRPC_STATUS,
923                                (tonic::Code::Unimplemented as i32).into(),
924                            );
925                        headers
926                            .insert(
927                                http::header::CONTENT_TYPE,
928                                tonic::metadata::GRPC_CONTENT_TYPE,
929                            );
930                        Ok(response)
931                    })
932                }
933            }
934        }
935    }
936    impl<T> Clone for LedgerServiceServer<T> {
937        fn clone(&self) -> Self {
938            let inner = self.inner.clone();
939            Self {
940                inner,
941                accept_compression_encodings: self.accept_compression_encodings,
942                send_compression_encodings: self.send_compression_encodings,
943                max_decoding_message_size: self.max_decoding_message_size,
944                max_encoding_message_size: self.max_encoding_message_size,
945            }
946        }
947    }
948    /// Generated gRPC service name
949    pub const SERVICE_NAME: &str = "sui.rpc.v2alpha.LedgerService";
950    impl<T> tonic::server::NamedService for LedgerServiceServer<T> {
951        const NAME: &'static str = SERVICE_NAME;
952    }
953}
954/// A node in a Blake2b256 Merkle tree.
955///
956/// An empty node represents an empty subtree (used as padding for odd-sized
957/// levels and as the root of a tree built from zero leaves). A digest node
958/// carries a 32-byte Blake2b256 hash of either a leaf or an inner node.
959#[non_exhaustive]
960#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
961pub struct MerkleNode {
962    #[prost(oneof = "merkle_node::Node", tags = "1, 2")]
963    pub node: ::core::option::Option<merkle_node::Node>,
964}
965/// Nested message and enum types in `MerkleNode`.
966pub mod merkle_node {
967    #[non_exhaustive]
968    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
969    pub enum Node {
970        /// Marker for an empty subtree.
971        #[prost(message, tag = "1")]
972        Empty(()),
973        /// 32-byte Blake2b256 hash.
974        #[prost(bytes, tag = "2")]
975        Digest(::prost::bytes::Bytes),
976    }
977}
978/// An inclusion proof for a leaf in a Blake2b256 Merkle tree.
979///
980/// The proof carries the sibling node hashes on the path from the leaf up
981/// to the root, leaf-side first. To verify, hash the leaf bytes with the
982/// `0x00` leaf prefix, then walk `path` upward and compute each parent as
983/// `BLAKE2b-256(0x01 || left || right)`. The final computed hash must equal
984/// the tree root.
985#[non_exhaustive]
986#[derive(Clone, PartialEq, ::prost::Message)]
987pub struct MerkleProof {
988    /// Sibling node hashes, leaf-side first.
989    #[prost(message, repeated, tag = "1")]
990    pub path: ::prost::alloc::vec::Vec<MerkleNode>,
991}
992/// A non-inclusion proof for a Blake2b256 Merkle tree built over leaves
993/// in sorted order.
994///
995/// The proof carries the absent leaf's would-be position in sort order
996/// plus inclusion proofs for the leaves immediately before and after it.
997/// A verifier checks that the two neighbours strictly bracket the
998/// target's sort key and that they sit at adjacent indices in the tree.
999#[non_exhaustive]
1000#[derive(Clone, PartialEq, ::prost::Message)]
1001pub struct MerkleNonInclusionProof {
1002    /// The 0-based index the target would occupy in sort order if it
1003    /// were present. `left_leaf` is unset iff `index == 0` (the target
1004    /// would be the very first leaf); `right_leaf` is unset iff the
1005    /// target would be appended past the last leaf, in which case
1006    /// `left_leaf.merkle_proof` must identify the tree's right-most leaf.
1007    #[prost(uint64, optional, tag = "1")]
1008    pub index: ::core::option::Option<u64>,
1009    /// Sort-order neighbour with sort key strictly less than the target,
1010    /// accompanied by its inclusion proof at position `index - 1`.
1011    #[prost(message, optional, tag = "2")]
1012    pub left_leaf: ::core::option::Option<MerkleNeighbourLeaf>,
1013    /// Sort-order neighbour with sort key strictly greater than the
1014    /// target, accompanied by its inclusion proof at position `index`.
1015    #[prost(message, optional, tag = "3")]
1016    pub right_leaf: ::core::option::Option<MerkleNeighbourLeaf>,
1017}
1018/// A neighbour leaf in a `MerkleNonInclusionProof`: an object reference
1019/// at a specific sorted position in the OCS tree, plus the inclusion
1020/// proof that authenticates it against the tree root.
1021#[non_exhaustive]
1022#[derive(Clone, PartialEq, ::prost::Message)]
1023pub struct MerkleNeighbourLeaf {
1024    /// The object reference stored at this leaf.
1025    #[prost(message, optional, tag = "1")]
1026    pub leaf: ::core::option::Option<super::v2::ObjectReference>,
1027    /// Inclusion proof for `leaf` at its position in the tree.
1028    #[prost(message, optional, tag = "2")]
1029    pub merkle_proof: ::core::option::Option<MerkleProof>,
1030}
1031/// An Object Checkpoint State (OCS) inclusion proof.
1032///
1033/// The OCS is a Blake2b256 Merkle tree built by each checkpoint over the
1034/// set of object references it modified (created, mutated, unwrapped, or
1035/// otherwise written). Each leaf is a BCS-encoded
1036/// `(ObjectID, SequenceNumber, ObjectDigest)` tuple, with leaves arranged
1037/// in ascending `ObjectID` order. The tree's root is committed to by the
1038/// containing `CheckpointSummary` via the `CheckpointArtifacts` variant of
1039/// its `checkpoint_commitments`.
1040///
1041/// An `OcsInclusionProof` proves that a particular leaf appears in this
1042/// tree. Combined with a verified `CheckpointSummary` it cryptographically
1043/// authenticates that a specific object reference was written in a specific
1044/// checkpoint.
1045#[non_exhaustive]
1046#[derive(Clone, PartialEq, ::prost::Message)]
1047pub struct OcsInclusionProof {
1048    /// Object reference being proven: (object_id, version, digest).
1049    /// For a deletion or wrap, `digest` is a framework sentinel value
1050    /// and `object_data` is absent. Consumers that only care whether
1051    /// the object is live after the change can check `object_data`
1052    /// presence instead of inspecting the digest.
1053    #[prost(message, optional, tag = "1")]
1054    pub object_ref: ::core::option::Option<super::v2::ObjectReference>,
1055    /// Merkle inclusion proof for the leaf.
1056    #[prost(message, optional, tag = "2")]
1057    pub merkle_proof: ::core::option::Option<MerkleProof>,
1058    /// Position of the leaf in the modified-objects tree.
1059    #[prost(uint64, optional, tag = "3")]
1060    pub leaf_index: ::core::option::Option<u64>,
1061    /// 32-byte Merkle root of the modified-objects tree.
1062    #[prost(bytes = "bytes", optional, tag = "4")]
1063    pub tree_root: ::core::option::Option<::prost::bytes::Bytes>,
1064    /// BCS-encoded `Object` data at the version committed by this
1065    /// checkpoint. Present iff the modification left the object live
1066    /// (created, mutated, or unwrapped). Absent if the modification was
1067    /// a deletion or wrap.
1068    #[prost(bytes = "bytes", optional, tag = "5")]
1069    pub object_data: ::core::option::Option<::prost::bytes::Bytes>,
1070}
1071/// An Object Checkpoint State (OCS) non-inclusion proof.
1072///
1073/// Proves that no leaf with a given object id appears in the OCS Merkle
1074/// tree -- i.e. that the checkpoint did not modify the object id at all.
1075/// The proof's bracketing neighbours must have object ids strictly
1076/// flanking the target id, which combined with the neighbours being at
1077/// adjacent indices in the sorted tree proves that no leaf with any
1078/// version or digest under the target id can be in the tree.
1079///
1080/// As with `OcsInclusionProof`, this is anchored at the containing
1081/// `CheckpointSummary`'s `CheckpointArtifacts` commitment.
1082#[non_exhaustive]
1083#[derive(Clone, PartialEq, ::prost::Message)]
1084pub struct OcsNonInclusionProof {
1085    /// Merkle non-inclusion proof over the OCS tree.
1086    #[prost(message, optional, tag = "1")]
1087    pub non_inclusion_proof: ::core::option::Option<MerkleNonInclusionProof>,
1088    /// 32-byte Merkle root of the modified-objects tree.
1089    #[prost(bytes = "bytes", optional, tag = "2")]
1090    pub tree_root: ::core::option::Option<::prost::bytes::Bytes>,
1091}
1092/// Request for a `GetCheckpointObjectProof` call.
1093#[non_exhaustive]
1094#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1095pub struct GetCheckpointObjectProofRequest {
1096    /// Required. The object id to prove a checkpoint outcome for
1097    /// (hex-encoded address).
1098    #[prost(string, optional, tag = "1")]
1099    pub object_id: ::core::option::Option<::prost::alloc::string::String>,
1100    /// Required. The checkpoint sequence number to query.
1101    #[prost(uint64, optional, tag = "2")]
1102    pub checkpoint: ::core::option::Option<u64>,
1103}
1104/// Response containing a checkpoint-object proof and the materials needed
1105/// to verify it end-to-end.
1106#[non_exhaustive]
1107#[derive(Clone, PartialEq, ::prost::Message)]
1108pub struct GetCheckpointObjectProofResponse {
1109    /// BCS-encoded `CertifiedCheckpointSummary` for the requested
1110    /// checkpoint, carrying the `checkpoint_artifacts_digest` that the
1111    /// proof's `tree_root` must reconstruct, plus the BLS aggregate
1112    /// signature attesting to it.
1113    #[prost(bytes = "bytes", optional, tag = "1")]
1114    pub checkpoint_summary: ::core::option::Option<::prost::bytes::Bytes>,
1115    /// The proof itself: either an inclusion or a non-inclusion proof.
1116    #[prost(oneof = "get_checkpoint_object_proof_response::Proof", tags = "2, 3")]
1117    pub proof: ::core::option::Option<get_checkpoint_object_proof_response::Proof>,
1118}
1119/// Nested message and enum types in `GetCheckpointObjectProofResponse`.
1120pub mod get_checkpoint_object_proof_response {
1121    /// The proof itself: either an inclusion or a non-inclusion proof.
1122    #[non_exhaustive]
1123    #[derive(Clone, PartialEq, ::prost::Oneof)]
1124    pub enum Proof {
1125        /// The object id was modified in this checkpoint.
1126        #[prost(message, tag = "2")]
1127        Inclusion(super::OcsInclusionProof),
1128        /// The object id was not modified in this checkpoint.
1129        #[prost(message, tag = "3")]
1130        NonInclusion(super::OcsNonInclusionProof),
1131    }
1132}
1133/// Generated client implementations.
1134pub mod proof_service_client {
1135    #![allow(
1136        unused_variables,
1137        dead_code,
1138        missing_docs,
1139        clippy::wildcard_imports,
1140        clippy::let_unit_value,
1141    )]
1142    use tonic::codegen::*;
1143    use tonic::codegen::http::Uri;
1144    /// ProofService provides cryptographic proofs of blockchain state.
1145    ///
1146    /// Proofs in this service are anchored at a checkpoint summary's
1147    /// `checkpoint_artifacts_digest`, which commits to the Object Checkpoint
1148    /// State (OCS) -- the per-checkpoint Merkle tree of object references
1149    /// written in that checkpoint. "OCS" appears throughout this file to refer
1150    /// to that commitment scheme; see the doc on `OcsInclusionProof` below for
1151    /// the full definition.
1152    #[derive(Debug, Clone)]
1153    pub struct ProofServiceClient<T> {
1154        inner: tonic::client::Grpc<T>,
1155    }
1156    impl ProofServiceClient<tonic::transport::Channel> {
1157        /// Attempt to create a new client by connecting to a given endpoint.
1158        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1159        where
1160            D: TryInto<tonic::transport::Endpoint>,
1161            D::Error: Into<StdError>,
1162        {
1163            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1164            Ok(Self::new(conn))
1165        }
1166    }
1167    impl<T> ProofServiceClient<T>
1168    where
1169        T: tonic::client::GrpcService<tonic::body::Body>,
1170        T::Error: Into<StdError>,
1171        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1172        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1173    {
1174        pub fn new(inner: T) -> Self {
1175            let inner = tonic::client::Grpc::new(inner);
1176            Self { inner }
1177        }
1178        pub fn with_origin(inner: T, origin: Uri) -> Self {
1179            let inner = tonic::client::Grpc::with_origin(inner, origin);
1180            Self { inner }
1181        }
1182        pub fn with_interceptor<F>(
1183            inner: T,
1184            interceptor: F,
1185        ) -> ProofServiceClient<InterceptedService<T, F>>
1186        where
1187            F: tonic::service::Interceptor,
1188            T::ResponseBody: Default,
1189            T: tonic::codegen::Service<
1190                http::Request<tonic::body::Body>,
1191                Response = http::Response<
1192                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1193                >,
1194            >,
1195            <T as tonic::codegen::Service<
1196                http::Request<tonic::body::Body>,
1197            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1198        {
1199            ProofServiceClient::new(InterceptedService::new(inner, interceptor))
1200        }
1201        /// Compress requests with the given encoding.
1202        ///
1203        /// This requires the server to support it otherwise it might respond with an
1204        /// error.
1205        #[must_use]
1206        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1207            self.inner = self.inner.send_compressed(encoding);
1208            self
1209        }
1210        /// Enable decompressing responses.
1211        #[must_use]
1212        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1213            self.inner = self.inner.accept_compressed(encoding);
1214            self
1215        }
1216        /// Limits the maximum size of a decoded message.
1217        ///
1218        /// Default: `4MB`
1219        #[must_use]
1220        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1221            self.inner = self.inner.max_decoding_message_size(limit);
1222            self
1223        }
1224        /// Limits the maximum size of an encoded message.
1225        ///
1226        /// Default: `usize::MAX`
1227        #[must_use]
1228        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1229            self.inner = self.inner.max_encoding_message_size(limit);
1230            self
1231        }
1232        /// Returns a cryptographic proof attesting to what (if anything) a
1233        /// specific checkpoint did to a specific object id.
1234        ///
1235        /// If the object id appears in the checkpoint's set of modified
1236        /// objects (the OCS Merkle tree's leaves), the response carries an
1237        /// `OcsInclusionProof` and -- when the modification left the object
1238        /// live -- the BCS-encoded object data. If the object id does not
1239        /// appear in the modified set, the response carries an
1240        /// `OcsNonInclusionProof`.
1241        ///
1242        /// IMPORTANT: a non-inclusion proof attests only that this checkpoint
1243        /// did NOT modify the requested object id. It does NOT attest that the
1244        /// object doesn't exist on chain: an object that was last modified in
1245        /// some earlier checkpoint and remained unchanged here will produce a
1246        /// non-inclusion proof. Clients that need the object's state at this
1247        /// checkpoint when it wasn't modified here must use a separate query
1248        /// (e.g. ratchet back to the most recent modification).
1249        pub async fn get_checkpoint_object_proof(
1250            &mut self,
1251            request: impl tonic::IntoRequest<super::GetCheckpointObjectProofRequest>,
1252        ) -> std::result::Result<
1253            tonic::Response<super::GetCheckpointObjectProofResponse>,
1254            tonic::Status,
1255        > {
1256            self.inner
1257                .ready()
1258                .await
1259                .map_err(|e| {
1260                    tonic::Status::unknown(
1261                        format!("Service was not ready: {}", e.into()),
1262                    )
1263                })?;
1264            let codec = tonic_prost::ProstCodec::default();
1265            let path = http::uri::PathAndQuery::from_static(
1266                "/sui.rpc.v2alpha.ProofService/GetCheckpointObjectProof",
1267            );
1268            let mut req = request.into_request();
1269            req.extensions_mut()
1270                .insert(
1271                    GrpcMethod::new(
1272                        "sui.rpc.v2alpha.ProofService",
1273                        "GetCheckpointObjectProof",
1274                    ),
1275                );
1276            self.inner.unary(req, path, codec).await
1277        }
1278    }
1279}
1280/// Generated server implementations.
1281pub mod proof_service_server {
1282    #![allow(
1283        unused_variables,
1284        dead_code,
1285        missing_docs,
1286        clippy::wildcard_imports,
1287        clippy::let_unit_value,
1288    )]
1289    use tonic::codegen::*;
1290    /// Generated trait containing gRPC methods that should be implemented for use with ProofServiceServer.
1291    #[async_trait]
1292    pub trait ProofService: std::marker::Send + std::marker::Sync + 'static {
1293        /// Returns a cryptographic proof attesting to what (if anything) a
1294        /// specific checkpoint did to a specific object id.
1295        ///
1296        /// If the object id appears in the checkpoint's set of modified
1297        /// objects (the OCS Merkle tree's leaves), the response carries an
1298        /// `OcsInclusionProof` and -- when the modification left the object
1299        /// live -- the BCS-encoded object data. If the object id does not
1300        /// appear in the modified set, the response carries an
1301        /// `OcsNonInclusionProof`.
1302        ///
1303        /// IMPORTANT: a non-inclusion proof attests only that this checkpoint
1304        /// did NOT modify the requested object id. It does NOT attest that the
1305        /// object doesn't exist on chain: an object that was last modified in
1306        /// some earlier checkpoint and remained unchanged here will produce a
1307        /// non-inclusion proof. Clients that need the object's state at this
1308        /// checkpoint when it wasn't modified here must use a separate query
1309        /// (e.g. ratchet back to the most recent modification).
1310        async fn get_checkpoint_object_proof(
1311            &self,
1312            request: tonic::Request<super::GetCheckpointObjectProofRequest>,
1313        ) -> std::result::Result<
1314            tonic::Response<super::GetCheckpointObjectProofResponse>,
1315            tonic::Status,
1316        > {
1317            Err(tonic::Status::unimplemented("Not yet implemented"))
1318        }
1319    }
1320    /// ProofService provides cryptographic proofs of blockchain state.
1321    ///
1322    /// Proofs in this service are anchored at a checkpoint summary's
1323    /// `checkpoint_artifacts_digest`, which commits to the Object Checkpoint
1324    /// State (OCS) -- the per-checkpoint Merkle tree of object references
1325    /// written in that checkpoint. "OCS" appears throughout this file to refer
1326    /// to that commitment scheme; see the doc on `OcsInclusionProof` below for
1327    /// the full definition.
1328    #[derive(Debug)]
1329    pub struct ProofServiceServer<T> {
1330        inner: Arc<T>,
1331        accept_compression_encodings: EnabledCompressionEncodings,
1332        send_compression_encodings: EnabledCompressionEncodings,
1333        max_decoding_message_size: Option<usize>,
1334        max_encoding_message_size: Option<usize>,
1335    }
1336    impl<T> ProofServiceServer<T> {
1337        pub fn new(inner: T) -> Self {
1338            Self::from_arc(Arc::new(inner))
1339        }
1340        pub fn from_arc(inner: Arc<T>) -> Self {
1341            Self {
1342                inner,
1343                accept_compression_encodings: Default::default(),
1344                send_compression_encodings: Default::default(),
1345                max_decoding_message_size: None,
1346                max_encoding_message_size: None,
1347            }
1348        }
1349        pub fn with_interceptor<F>(
1350            inner: T,
1351            interceptor: F,
1352        ) -> InterceptedService<Self, F>
1353        where
1354            F: tonic::service::Interceptor,
1355        {
1356            InterceptedService::new(Self::new(inner), interceptor)
1357        }
1358        /// Enable decompressing requests with the given encoding.
1359        #[must_use]
1360        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1361            self.accept_compression_encodings.enable(encoding);
1362            self
1363        }
1364        /// Compress responses with the given encoding, if the client supports it.
1365        #[must_use]
1366        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1367            self.send_compression_encodings.enable(encoding);
1368            self
1369        }
1370        /// Limits the maximum size of a decoded message.
1371        ///
1372        /// Default: `4MB`
1373        #[must_use]
1374        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1375            self.max_decoding_message_size = Some(limit);
1376            self
1377        }
1378        /// Limits the maximum size of an encoded message.
1379        ///
1380        /// Default: `usize::MAX`
1381        #[must_use]
1382        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1383            self.max_encoding_message_size = Some(limit);
1384            self
1385        }
1386    }
1387    impl<T, B> tonic::codegen::Service<http::Request<B>> for ProofServiceServer<T>
1388    where
1389        T: ProofService,
1390        B: Body + std::marker::Send + 'static,
1391        B::Error: Into<StdError> + std::marker::Send + 'static,
1392    {
1393        type Response = http::Response<tonic::body::Body>;
1394        type Error = std::convert::Infallible;
1395        type Future = BoxFuture<Self::Response, Self::Error>;
1396        fn poll_ready(
1397            &mut self,
1398            _cx: &mut Context<'_>,
1399        ) -> Poll<std::result::Result<(), Self::Error>> {
1400            Poll::Ready(Ok(()))
1401        }
1402        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1403            match req.uri().path() {
1404                "/sui.rpc.v2alpha.ProofService/GetCheckpointObjectProof" => {
1405                    #[allow(non_camel_case_types)]
1406                    struct GetCheckpointObjectProofSvc<T: ProofService>(pub Arc<T>);
1407                    impl<
1408                        T: ProofService,
1409                    > tonic::server::UnaryService<super::GetCheckpointObjectProofRequest>
1410                    for GetCheckpointObjectProofSvc<T> {
1411                        type Response = super::GetCheckpointObjectProofResponse;
1412                        type Future = BoxFuture<
1413                            tonic::Response<Self::Response>,
1414                            tonic::Status,
1415                        >;
1416                        fn call(
1417                            &mut self,
1418                            request: tonic::Request<
1419                                super::GetCheckpointObjectProofRequest,
1420                            >,
1421                        ) -> Self::Future {
1422                            let inner = Arc::clone(&self.0);
1423                            let fut = async move {
1424                                <T as ProofService>::get_checkpoint_object_proof(
1425                                        &inner,
1426                                        request,
1427                                    )
1428                                    .await
1429                            };
1430                            Box::pin(fut)
1431                        }
1432                    }
1433                    let accept_compression_encodings = self.accept_compression_encodings;
1434                    let send_compression_encodings = self.send_compression_encodings;
1435                    let max_decoding_message_size = self.max_decoding_message_size;
1436                    let max_encoding_message_size = self.max_encoding_message_size;
1437                    let inner = self.inner.clone();
1438                    let fut = async move {
1439                        let method = GetCheckpointObjectProofSvc(inner);
1440                        let codec = tonic_prost::ProstCodec::default();
1441                        let mut grpc = tonic::server::Grpc::new(codec)
1442                            .apply_compression_config(
1443                                accept_compression_encodings,
1444                                send_compression_encodings,
1445                            )
1446                            .apply_max_message_size_config(
1447                                max_decoding_message_size,
1448                                max_encoding_message_size,
1449                            );
1450                        let res = grpc.unary(method, req).await;
1451                        Ok(res)
1452                    };
1453                    Box::pin(fut)
1454                }
1455                _ => {
1456                    Box::pin(async move {
1457                        let mut response = http::Response::new(
1458                            tonic::body::Body::default(),
1459                        );
1460                        let headers = response.headers_mut();
1461                        headers
1462                            .insert(
1463                                tonic::Status::GRPC_STATUS,
1464                                (tonic::Code::Unimplemented as i32).into(),
1465                            );
1466                        headers
1467                            .insert(
1468                                http::header::CONTENT_TYPE,
1469                                tonic::metadata::GRPC_CONTENT_TYPE,
1470                            );
1471                        Ok(response)
1472                    })
1473                }
1474            }
1475        }
1476    }
1477    impl<T> Clone for ProofServiceServer<T> {
1478        fn clone(&self) -> Self {
1479            let inner = self.inner.clone();
1480            Self {
1481                inner,
1482                accept_compression_encodings: self.accept_compression_encodings,
1483                send_compression_encodings: self.send_compression_encodings,
1484                max_decoding_message_size: self.max_decoding_message_size,
1485                max_encoding_message_size: self.max_encoding_message_size,
1486            }
1487        }
1488    }
1489    /// Generated gRPC service name
1490    pub const SERVICE_NAME: &str = "sui.rpc.v2alpha.ProofService";
1491    impl<T> tonic::server::NamedService for ProofServiceServer<T> {
1492        const NAME: &'static str = SERVICE_NAME;
1493    }
1494}
1495/// Cursor-bounded query options.
1496///
1497/// `after` and `before` are canonical ledger-position bounds, not
1498/// ordering-relative cursors. `after` always excludes items at or below that
1499/// cursor, and `before` always excludes items at or above that cursor. Ordering
1500/// only controls the order of returned items within the resulting open interval.
1501///
1502/// For example, with `after = A`, `before = B`, `ordering = DESCENDING`, and
1503/// `limit_items = N`, the response contains up to N matching items in descending
1504/// order from the interval `(A, B)`. If the response ends with
1505/// `QUERY_END_REASON_ITEM_LIMIT`, resume by keeping `after = A` and setting
1506/// `before` to the last `Watermark.cursor` (or last item cursor) received. That
1507/// cursor is the lowest position reached in ledger order, so it becomes the
1508/// next exclusive upper bound.
1509#[non_exhaustive]
1510#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1511pub struct QueryOptions {
1512    /// The maximum number of items to return. Each method applies its own default
1513    /// and maximum. QueryEnd does not count against this limit.
1514    #[prost(uint32, optional, tag = "1")]
1515    pub limit_items: ::core::option::Option<u32>,
1516    /// Opaque exclusive lower bound. Results must be strictly after this cursor in
1517    /// canonical ledger order.
1518    #[prost(bytes = "bytes", optional, tag = "2")]
1519    pub after: ::core::option::Option<::prost::bytes::Bytes>,
1520    /// Opaque exclusive upper bound. Results must be strictly before this cursor
1521    /// in canonical ledger order.
1522    #[prost(bytes = "bytes", optional, tag = "3")]
1523    pub before: ::core::option::Option<::prost::bytes::Bytes>,
1524    /// Ordering for returned results. Defaults to ASCENDING.
1525    ///
1526    /// Ordering only controls the order of results within the bounded interval;
1527    /// cursor bounds keep the same meaning for ascending and descending reads.
1528    #[prost(enumeration = "Ordering", tag = "4")]
1529    pub ordering: i32,
1530}
1531/// Progress markers for a query scan. Carried both on every item and as
1532/// standalone wire frames between items when the underlying scan advances
1533/// without producing a matching item.
1534///
1535/// Exactly one of `checkpoint_hi` / `checkpoint_lo` is set per response
1536/// stream — whichever matches the request ordering. The unscanned side is
1537/// always unset.
1538#[non_exhaustive]
1539#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1540pub struct Watermark {
1541    /// Opaque cursor at this scan position. Use as `options.after`
1542    /// (ascending) or `options.before` (descending) on the next request to
1543    /// resume from here. Clients should track the most recently received
1544    /// cursor across both standalone and item-embedded watermarks as the
1545    /// safe resume point.
1546    #[prost(bytes = "bytes", optional, tag = "1")]
1547    pub cursor: ::core::option::Option<::prost::bytes::Bytes>,
1548    /// Ascending scans only. Every matching item in checkpoints
1549    /// `<= checkpoint_hi` has been emitted; checkpoints strictly greater
1550    /// may still hold unscanned matches. Non-decreasing across the stream.
1551    ///
1552    /// Unset only on frames whose scan position is still at the genesis
1553    /// checkpoint (cp 0). Set on every subsequent frame.
1554    #[prost(uint64, optional, tag = "2")]
1555    pub checkpoint_hi: ::core::option::Option<u64>,
1556    /// Descending scans only. Every matching item in checkpoints
1557    /// `>= checkpoint_lo` has been emitted; checkpoints strictly less may
1558    /// still hold unscanned matches. Non-increasing across the stream.
1559    #[prost(uint64, optional, tag = "3")]
1560    pub checkpoint_lo: ::core::option::Option<u64>,
1561}
1562/// Final response frame for a successful query stream. Every successful stream
1563/// returns exactly one QueryEnd after all item and watermark frames.
1564///
1565/// The resume cursor is the last `Watermark.cursor` received during the
1566/// stream — either standalone or embedded on the last item. Clients have
1567/// to track the latest watermark themselves anyway (to survive mid-stream
1568/// disconnects and pre-QueryEnd errors), so QueryEnd carries no cursor of
1569/// its own: `reason` is the only thing it adds on top of what the stream
1570/// already delivered.
1571#[non_exhaustive]
1572#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1573pub struct QueryEnd {
1574    /// Reason this response stopped.
1575    #[prost(enumeration = "QueryEndReason", tag = "1")]
1576    pub reason: i32,
1577}
1578/// Ordering for the returned result set.
1579#[non_exhaustive]
1580#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1581#[repr(i32)]
1582pub enum Ordering {
1583    /// Return results in increasing cursor order.
1584    Ascending = 0,
1585    /// Return results in decreasing cursor order.
1586    Descending = 1,
1587}
1588impl Ordering {
1589    /// String value of the enum field names used in the ProtoBuf definition.
1590    ///
1591    /// The values are not transformed in any way and thus are considered stable
1592    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1593    pub fn as_str_name(&self) -> &'static str {
1594        match self {
1595            Self::Ascending => "ORDERING_ASCENDING",
1596            Self::Descending => "ORDERING_DESCENDING",
1597        }
1598    }
1599    /// Creates an enum from field names used in the ProtoBuf definition.
1600    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1601        match value {
1602            "ORDERING_ASCENDING" => Some(Self::Ascending),
1603            "ORDERING_DESCENDING" => Some(Self::Descending),
1604            _ => None,
1605        }
1606    }
1607}
1608/// Reason the server stopped this query response.
1609#[non_exhaustive]
1610#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1611#[repr(i32)]
1612pub enum QueryEndReason {
1613    /// The stop reason was not specified.
1614    Unspecified = 0,
1615    /// The response reached the requested item limit. Resume from the last
1616    /// `Watermark.cursor` received to continue reading the same effective
1617    /// interval.
1618    ItemLimit = 1,
1619    /// The response reached the server's per-request bucket-fetch budget for
1620    /// filtered scans before reaching the effective interval bound. Resume from
1621    /// the last `Watermark.cursor` received.
1622    ScanLimit = 2,
1623    /// The scan reached a requested checkpoint range bound.
1624    CheckpointBound = 3,
1625    /// The scan reached an exclusive cursor bound.
1626    CursorBound = 4,
1627    /// The scan reached the currently indexed ledger tip.
1628    LedgerTip = 5,
1629}
1630impl QueryEndReason {
1631    /// String value of the enum field names used in the ProtoBuf definition.
1632    ///
1633    /// The values are not transformed in any way and thus are considered stable
1634    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1635    pub fn as_str_name(&self) -> &'static str {
1636        match self {
1637            Self::Unspecified => "QUERY_END_REASON_UNSPECIFIED",
1638            Self::ItemLimit => "QUERY_END_REASON_ITEM_LIMIT",
1639            Self::ScanLimit => "QUERY_END_REASON_SCAN_LIMIT",
1640            Self::CheckpointBound => "QUERY_END_REASON_CHECKPOINT_BOUND",
1641            Self::CursorBound => "QUERY_END_REASON_CURSOR_BOUND",
1642            Self::LedgerTip => "QUERY_END_REASON_LEDGER_TIP",
1643        }
1644    }
1645    /// Creates an enum from field names used in the ProtoBuf definition.
1646    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1647        match value {
1648            "QUERY_END_REASON_UNSPECIFIED" => Some(Self::Unspecified),
1649            "QUERY_END_REASON_ITEM_LIMIT" => Some(Self::ItemLimit),
1650            "QUERY_END_REASON_SCAN_LIMIT" => Some(Self::ScanLimit),
1651            "QUERY_END_REASON_CHECKPOINT_BOUND" => Some(Self::CheckpointBound),
1652            "QUERY_END_REASON_CURSOR_BOUND" => Some(Self::CursorBound),
1653            "QUERY_END_REASON_LEDGER_TIP" => Some(Self::LedgerTip),
1654            _ => None,
1655        }
1656    }
1657}