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