Skip to main content

polyester/gen/connect/
ledger.read.v1.rs

1// @generated by connectrpc-codegen. DO NOT EDIT.
2
3///Shorthand for `OwnedView<GetBalanceHistoryRequestView<'static>>`.
4pub type OwnedGetBalanceHistoryRequestView = ::buffa::view::OwnedView<
5    crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryRequestView<'static>,
6>;
7///Shorthand for `OwnedView<GetBalanceHistoryResponseView<'static>>`.
8pub type OwnedGetBalanceHistoryResponseView = ::buffa::view::OwnedView<
9    crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryResponseView<'static>,
10>;
11///Shorthand for `OwnedView<GetEquityHistorySeriesRequestView<'static>>`.
12pub type OwnedGetEquityHistorySeriesRequestView = ::buffa::view::OwnedView<
13    crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesRequestView<
14        'static,
15    >,
16>;
17///Shorthand for `OwnedView<GetEquityHistorySeriesResponseView<'static>>`.
18pub type OwnedGetEquityHistorySeriesResponseView = ::buffa::view::OwnedView<
19    crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesResponseView<
20        'static,
21    >,
22>;
23///Shorthand for `OwnedView<ListTransfersRequestView<'static>>`.
24pub type OwnedListTransfersRequestView = ::buffa::view::OwnedView<
25    crate::proto::ledger::read::v1::__buffa::view::ListTransfersRequestView<'static>,
26>;
27///Shorthand for `OwnedView<ListTransfersResponseView<'static>>`.
28pub type OwnedListTransfersResponseView = ::buffa::view::OwnedView<
29    crate::proto::ledger::read::v1::__buffa::view::ListTransfersResponseView<'static>,
30>;
31///Shorthand for `OwnedView<ListHoldsRequestView<'static>>`.
32pub type OwnedListHoldsRequestView = ::buffa::view::OwnedView<
33    crate::proto::ledger::read::v1::__buffa::view::ListHoldsRequestView<'static>,
34>;
35///Shorthand for `OwnedView<ListHoldsResponseView<'static>>`.
36pub type OwnedListHoldsResponseView = ::buffa::view::OwnedView<
37    crate::proto::ledger::read::v1::__buffa::view::ListHoldsResponseView<'static>,
38>;
39///Shorthand for `OwnedView<GetBalancesRequestView<'static>>`.
40pub type OwnedGetBalancesRequestView = ::buffa::view::OwnedView<
41    crate::proto::ledger::read::v1::__buffa::view::GetBalancesRequestView<'static>,
42>;
43///Shorthand for `OwnedView<GetBalancesResponseView<'static>>`.
44pub type OwnedGetBalancesResponseView = ::buffa::view::OwnedView<
45    crate::proto::ledger::read::v1::__buffa::view::GetBalancesResponseView<'static>,
46>;
47impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::GetBalanceHistoryResponse>
48for crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryResponseView<'_> {
49    fn encode(
50        &self,
51        codec: ::connectrpc::CodecFormat,
52    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
53        ::connectrpc::__codegen::encode_view_body(self, codec)
54    }
55}
56impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::GetBalanceHistoryResponse>
57for ::buffa::view::OwnedView<
58    crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryResponseView<'static>,
59> {
60    fn encode(
61        &self,
62        codec: ::connectrpc::CodecFormat,
63    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
64        ::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
65    }
66}
67impl ::connectrpc::Encodable<
68    crate::proto::ledger::read::v1::GetEquityHistorySeriesResponse,
69>
70for crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesResponseView<
71    '_,
72> {
73    fn encode(
74        &self,
75        codec: ::connectrpc::CodecFormat,
76    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
77        ::connectrpc::__codegen::encode_view_body(self, codec)
78    }
79}
80impl ::connectrpc::Encodable<
81    crate::proto::ledger::read::v1::GetEquityHistorySeriesResponse,
82>
83for ::buffa::view::OwnedView<
84    crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesResponseView<
85        'static,
86    >,
87> {
88    fn encode(
89        &self,
90        codec: ::connectrpc::CodecFormat,
91    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
92        ::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
93    }
94}
95impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::ListTransfersResponse>
96for crate::proto::ledger::read::v1::__buffa::view::ListTransfersResponseView<'_> {
97    fn encode(
98        &self,
99        codec: ::connectrpc::CodecFormat,
100    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
101        ::connectrpc::__codegen::encode_view_body(self, codec)
102    }
103}
104impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::ListTransfersResponse>
105for ::buffa::view::OwnedView<
106    crate::proto::ledger::read::v1::__buffa::view::ListTransfersResponseView<'static>,
107> {
108    fn encode(
109        &self,
110        codec: ::connectrpc::CodecFormat,
111    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
112        ::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
113    }
114}
115impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::ListHoldsResponse>
116for crate::proto::ledger::read::v1::__buffa::view::ListHoldsResponseView<'_> {
117    fn encode(
118        &self,
119        codec: ::connectrpc::CodecFormat,
120    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
121        ::connectrpc::__codegen::encode_view_body(self, codec)
122    }
123}
124impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::ListHoldsResponse>
125for ::buffa::view::OwnedView<
126    crate::proto::ledger::read::v1::__buffa::view::ListHoldsResponseView<'static>,
127> {
128    fn encode(
129        &self,
130        codec: ::connectrpc::CodecFormat,
131    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
132        ::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
133    }
134}
135impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::GetBalancesResponse>
136for crate::proto::ledger::read::v1::__buffa::view::GetBalancesResponseView<'_> {
137    fn encode(
138        &self,
139        codec: ::connectrpc::CodecFormat,
140    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
141        ::connectrpc::__codegen::encode_view_body(self, codec)
142    }
143}
144impl ::connectrpc::Encodable<crate::proto::ledger::read::v1::GetBalancesResponse>
145for ::buffa::view::OwnedView<
146    crate::proto::ledger::read::v1::__buffa::view::GetBalancesResponseView<'static>,
147> {
148    fn encode(
149        &self,
150        codec: ::connectrpc::CodecFormat,
151    ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
152        ::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
153    }
154}
155/// Full service name for this service.
156pub const LEDGER_READ_SERVICE_SERVICE_NAME: &str = "ledger.read.v1.LedgerReadService";
157/// Static [`Spec`](::connectrpc::Spec) for the server-side `GetBalanceHistory` RPC.
158///
159/// The dispatcher surfaces this on
160/// [`RequestContext::spec`](::connectrpc::RequestContext::spec).
161pub const LEDGER_READ_SERVICE_GET_BALANCE_HISTORY_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
162        "/ledger.read.v1.LedgerReadService/GetBalanceHistory",
163        ::connectrpc::StreamType::Unary,
164    )
165    .with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
166/// Static [`Spec`](::connectrpc::Spec) for the server-side `GetEquityHistorySeries` RPC.
167///
168/// The dispatcher surfaces this on
169/// [`RequestContext::spec`](::connectrpc::RequestContext::spec).
170pub const LEDGER_READ_SERVICE_GET_EQUITY_HISTORY_SERIES_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
171        "/ledger.read.v1.LedgerReadService/GetEquityHistorySeries",
172        ::connectrpc::StreamType::Unary,
173    )
174    .with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
175/// Static [`Spec`](::connectrpc::Spec) for the server-side `ListTransfers` RPC.
176///
177/// The dispatcher surfaces this on
178/// [`RequestContext::spec`](::connectrpc::RequestContext::spec).
179pub const LEDGER_READ_SERVICE_LIST_TRANSFERS_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
180        "/ledger.read.v1.LedgerReadService/ListTransfers",
181        ::connectrpc::StreamType::Unary,
182    )
183    .with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
184/// Static [`Spec`](::connectrpc::Spec) for the server-side `ListHolds` RPC.
185///
186/// The dispatcher surfaces this on
187/// [`RequestContext::spec`](::connectrpc::RequestContext::spec).
188pub const LEDGER_READ_SERVICE_LIST_HOLDS_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
189        "/ledger.read.v1.LedgerReadService/ListHolds",
190        ::connectrpc::StreamType::Unary,
191    )
192    .with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
193/// Static [`Spec`](::connectrpc::Spec) for the server-side `GetBalances` RPC.
194///
195/// The dispatcher surfaces this on
196/// [`RequestContext::spec`](::connectrpc::RequestContext::spec).
197pub const LEDGER_READ_SERVICE_GET_BALANCES_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
198        "/ledger.read.v1.LedgerReadService/GetBalances",
199        ::connectrpc::StreamType::Unary,
200    )
201    .with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
202/// LedgerReadService exposes read-only ledger endpoints (balances, history, transfers, holds).
203///
204/// # Implementing handlers
205///
206/// Implement methods with plain `async fn`; the returned future satisfies
207/// the `Send` bound automatically.
208///
209/// **Unary and server-streaming requests** arrive as
210/// [`ServiceRequest<'_, Req>`](::connectrpc::ServiceRequest): a zero-copy
211/// view of the request plus its body, valid for the duration of the call.
212/// Fields are read directly (`request.name` is a `&str` into the decoded
213/// buffer) and the borrow may be held across `.await` points. Anything
214/// that must outlive the call — `tokio::spawn`, channels, server state,
215/// or data captured by a returned response stream — takes owned data:
216/// call `request.to_owned_message()` (or copy the specific fields)
217/// first.
218///
219/// **Client-streaming and bidi requests** arrive as
220/// [`InboundStream<Req>`](::connectrpc::InboundStream) — a
221/// `ServiceStream` of [`StreamMessage`](::connectrpc::StreamMessage)s.
222/// Each item owns its decoded buffer and is `Send + 'static`, so items
223/// can be buffered or moved into spawned tasks; read fields zero-copy
224/// through the generated accessor methods (`item.name()`) or `.view()`,
225/// convert with `.to_owned_message()`, or yield an item back unchanged —
226/// `StreamMessage<M>` implements `Encodable<M>`.
227///
228/// Request types resolved through `extern_path` (e.g. well-known types
229/// from another crate) use the same wrappers; the crate that owns the
230/// type must be generated with buffa ≥ 0.8.0 and views enabled so the
231/// backing `HasMessageView` impl exists.
232///
233/// The `impl Encodable<Out>` return bound accepts the owned `Out`, the
234/// generated `OutView<'_>` / `OwnedOutView`,
235/// [`MaybeBorrowed`](::connectrpc::MaybeBorrowed), or
236/// [`PreEncoded`](::connectrpc::PreEncoded) for handlers that encode a
237/// non-`'static` view internally and pass the bytes across the handler
238/// boundary. View bodies are not emitted for output types mapped via
239/// `extern_path` (the impl would be an orphan); return owned for
240/// WKT/extern outputs.
241///
242/// Server-streaming and bidi-streaming methods return
243/// `ServiceStream<impl Encodable<Out> + Send + use<Self>>`. The
244/// `use<Self>` precise-capturing clause excludes `&self`'s lifetime and
245/// the request's lifetime (unary methods use `use<'a, Self>` and may
246/// borrow from `&self`), so stream items must be `'static` and cannot
247/// borrow from the request. To stream view-encoded data, encode each
248/// item inside the stream body and yield
249/// [`PreEncoded`](::connectrpc::PreEncoded) — see its `# Streaming
250/// example` doc.
251#[allow(clippy::type_complexity)]
252pub trait LedgerReadService: Send + Sync + 'static {
253    /// Retrieve balance history buckets for an account.
254    /// Supports optional subaccount, range, asset, and account-code filters.
255    ///
256    /// `'a` lets the response body borrow from `&self` (e.g. server-resident state).
257    ///
258    /// `request` is borrowed from the request body and is valid for the
259    /// duration of the call; message fields are read directly on it
260    /// (zero-copy). The response cannot borrow from `request` — use
261    /// `.to_owned_message()` (or copy the specific fields) for anything
262    /// returned, stored, or moved into `tokio::spawn`.
263    fn get_balance_history<'a>(
264        &'a self,
265        ctx: ::connectrpc::RequestContext,
266        request: ::connectrpc::ServiceRequest<
267            '_,
268            crate::proto::ledger::read::v1::GetBalanceHistoryRequest,
269        >,
270    ) -> impl ::std::future::Future<
271        Output = ::connectrpc::ServiceResult<
272            impl ::connectrpc::Encodable<
273                crate::proto::ledger::read::v1::GetBalanceHistoryResponse,
274            > + Send + use<'a, Self>,
275        >,
276    > + Send;
277    /// Retrieve equity history as columnar series data.
278    /// Supports optional subaccount, range, account-code filtering, and grouping by account or asset.
279    ///
280    /// `'a` lets the response body borrow from `&self` (e.g. server-resident state).
281    ///
282    /// `request` is borrowed from the request body and is valid for the
283    /// duration of the call; message fields are read directly on it
284    /// (zero-copy). The response cannot borrow from `request` — use
285    /// `.to_owned_message()` (or copy the specific fields) for anything
286    /// returned, stored, or moved into `tokio::spawn`.
287    fn get_equity_history_series<'a>(
288        &'a self,
289        ctx: ::connectrpc::RequestContext,
290        request: ::connectrpc::ServiceRequest<
291            '_,
292            crate::proto::ledger::read::v1::GetEquityHistorySeriesRequest,
293        >,
294    ) -> impl ::std::future::Future<
295        Output = ::connectrpc::ServiceResult<
296            impl ::connectrpc::Encodable<
297                crate::proto::ledger::read::v1::GetEquityHistorySeriesResponse,
298            > + Send + use<'a, Self>,
299        >,
300    > + Send;
301    /// List finalized transfer history for an account.
302    /// Supports optional subaccount, asset, ordering, and cursor filters.
303    ///
304    /// `'a` lets the response body borrow from `&self` (e.g. server-resident state).
305    ///
306    /// `request` is borrowed from the request body and is valid for the
307    /// duration of the call; message fields are read directly on it
308    /// (zero-copy). The response cannot borrow from `request` — use
309    /// `.to_owned_message()` (or copy the specific fields) for anything
310    /// returned, stored, or moved into `tokio::spawn`.
311    fn list_transfers<'a>(
312        &'a self,
313        ctx: ::connectrpc::RequestContext,
314        request: ::connectrpc::ServiceRequest<
315            '_,
316            crate::proto::ledger::read::v1::ListTransfersRequest,
317        >,
318    ) -> impl ::std::future::Future<
319        Output = ::connectrpc::ServiceResult<
320            impl ::connectrpc::Encodable<
321                crate::proto::ledger::read::v1::ListTransfersResponse,
322            > + Send + use<'a, Self>,
323        >,
324    > + Send;
325    /// ListHolds returns pending holds with integer amounts (u128) and asset ids.
326    ///
327    /// `'a` lets the response body borrow from `&self` (e.g. server-resident state).
328    ///
329    /// `request` is borrowed from the request body and is valid for the
330    /// duration of the call; message fields are read directly on it
331    /// (zero-copy). The response cannot borrow from `request` — use
332    /// `.to_owned_message()` (or copy the specific fields) for anything
333    /// returned, stored, or moved into `tokio::spawn`.
334    fn list_holds<'a>(
335        &'a self,
336        ctx: ::connectrpc::RequestContext,
337        request: ::connectrpc::ServiceRequest<
338            '_,
339            crate::proto::ledger::read::v1::ListHoldsRequest,
340        >,
341    ) -> impl ::std::future::Future<
342        Output = ::connectrpc::ServiceResult<
343            impl ::connectrpc::Encodable<
344                crate::proto::ledger::read::v1::ListHoldsResponse,
345            > + Send + use<'a, Self>,
346        >,
347    > + Send;
348    /// Retrieve the latest balances for an account.
349    /// Supports optional subaccount scoping and returns asset symbols with decimal amounts on REST.
350    ///
351    /// `'a` lets the response body borrow from `&self` (e.g. server-resident state).
352    ///
353    /// `request` is borrowed from the request body and is valid for the
354    /// duration of the call; message fields are read directly on it
355    /// (zero-copy). The response cannot borrow from `request` — use
356    /// `.to_owned_message()` (or copy the specific fields) for anything
357    /// returned, stored, or moved into `tokio::spawn`.
358    fn get_balances<'a>(
359        &'a self,
360        ctx: ::connectrpc::RequestContext,
361        request: ::connectrpc::ServiceRequest<
362            '_,
363            crate::proto::ledger::read::v1::GetBalancesRequest,
364        >,
365    ) -> impl ::std::future::Future<
366        Output = ::connectrpc::ServiceResult<
367            impl ::connectrpc::Encodable<
368                crate::proto::ledger::read::v1::GetBalancesResponse,
369            > + Send + use<'a, Self>,
370        >,
371    > + Send;
372}
373/// Extension trait for registering a service implementation with a Router.
374///
375/// This trait is automatically implemented for all types that implement the service trait.
376/// Prefer [`Router::add_service`](::connectrpc::Router::add_service) for
377/// top-down registration; `register` remains available for compatibility
378/// and cases where the service-first call shape is more convenient.
379///
380/// # Example
381///
382/// ```rust,ignore
383/// use std::sync::Arc;
384///
385/// let service = Arc::new(MyServiceImpl);
386/// let router = service.register(Router::new());
387/// ```
388pub trait LedgerReadServiceExt: LedgerReadService {
389    /// Register this service implementation with a Router.
390    ///
391    /// Takes ownership of the `Arc<Self>` and returns a new Router with
392    /// this service's methods registered.
393    fn register(
394        self: ::std::sync::Arc<Self>,
395        router: ::connectrpc::Router,
396    ) -> ::connectrpc::Router;
397}
398impl<S: LedgerReadService> LedgerReadServiceExt for S {
399    fn register(
400        self: ::std::sync::Arc<Self>,
401        router: ::connectrpc::Router,
402    ) -> ::connectrpc::Router {
403        router
404            .route_view(
405                LEDGER_READ_SERVICE_SERVICE_NAME,
406                "GetBalanceHistory",
407                {
408                    let svc = ::std::sync::Arc::clone(&self);
409                    ::connectrpc::view_handler_fn(move |
410                        ctx,
411                        req: ::buffa::view::OwnedView<
412                            crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryRequestView<
413                                'static,
414                            >,
415                        >,
416                        format|
417                    {
418                        let svc = ::std::sync::Arc::clone(&svc);
419                        async move {
420                            let sreq = ::connectrpc::ServiceRequest::<
421                                crate::proto::ledger::read::v1::GetBalanceHistoryRequest,
422                            >::from_parts(req.reborrow(), req.bytes());
423                            svc.get_balance_history(ctx, sreq)
424                                .await?
425                                .encode::<
426                                    crate::proto::ledger::read::v1::GetBalanceHistoryResponse,
427                                >(format)
428                        }
429                    })
430                },
431            )
432            .with_spec(LEDGER_READ_SERVICE_GET_BALANCE_HISTORY_SPEC)
433            .route_view(
434                LEDGER_READ_SERVICE_SERVICE_NAME,
435                "GetEquityHistorySeries",
436                {
437                    let svc = ::std::sync::Arc::clone(&self);
438                    ::connectrpc::view_handler_fn(move |
439                        ctx,
440                        req: ::buffa::view::OwnedView<
441                            crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesRequestView<
442                                'static,
443                            >,
444                        >,
445                        format|
446                    {
447                        let svc = ::std::sync::Arc::clone(&svc);
448                        async move {
449                            let sreq = ::connectrpc::ServiceRequest::<
450                                crate::proto::ledger::read::v1::GetEquityHistorySeriesRequest,
451                            >::from_parts(req.reborrow(), req.bytes());
452                            svc.get_equity_history_series(ctx, sreq)
453                                .await?
454                                .encode::<
455                                    crate::proto::ledger::read::v1::GetEquityHistorySeriesResponse,
456                                >(format)
457                        }
458                    })
459                },
460            )
461            .with_spec(LEDGER_READ_SERVICE_GET_EQUITY_HISTORY_SERIES_SPEC)
462            .route_view(
463                LEDGER_READ_SERVICE_SERVICE_NAME,
464                "ListTransfers",
465                {
466                    let svc = ::std::sync::Arc::clone(&self);
467                    ::connectrpc::view_handler_fn(move |
468                        ctx,
469                        req: ::buffa::view::OwnedView<
470                            crate::proto::ledger::read::v1::__buffa::view::ListTransfersRequestView<
471                                'static,
472                            >,
473                        >,
474                        format|
475                    {
476                        let svc = ::std::sync::Arc::clone(&svc);
477                        async move {
478                            let sreq = ::connectrpc::ServiceRequest::<
479                                crate::proto::ledger::read::v1::ListTransfersRequest,
480                            >::from_parts(req.reborrow(), req.bytes());
481                            svc.list_transfers(ctx, sreq)
482                                .await?
483                                .encode::<
484                                    crate::proto::ledger::read::v1::ListTransfersResponse,
485                                >(format)
486                        }
487                    })
488                },
489            )
490            .with_spec(LEDGER_READ_SERVICE_LIST_TRANSFERS_SPEC)
491            .route_view(
492                LEDGER_READ_SERVICE_SERVICE_NAME,
493                "ListHolds",
494                {
495                    let svc = ::std::sync::Arc::clone(&self);
496                    ::connectrpc::view_handler_fn(move |
497                        ctx,
498                        req: ::buffa::view::OwnedView<
499                            crate::proto::ledger::read::v1::__buffa::view::ListHoldsRequestView<
500                                'static,
501                            >,
502                        >,
503                        format|
504                    {
505                        let svc = ::std::sync::Arc::clone(&svc);
506                        async move {
507                            let sreq = ::connectrpc::ServiceRequest::<
508                                crate::proto::ledger::read::v1::ListHoldsRequest,
509                            >::from_parts(req.reborrow(), req.bytes());
510                            svc.list_holds(ctx, sreq)
511                                .await?
512                                .encode::<
513                                    crate::proto::ledger::read::v1::ListHoldsResponse,
514                                >(format)
515                        }
516                    })
517                },
518            )
519            .with_spec(LEDGER_READ_SERVICE_LIST_HOLDS_SPEC)
520            .route_view(
521                LEDGER_READ_SERVICE_SERVICE_NAME,
522                "GetBalances",
523                {
524                    let svc = ::std::sync::Arc::clone(&self);
525                    ::connectrpc::view_handler_fn(move |
526                        ctx,
527                        req: ::buffa::view::OwnedView<
528                            crate::proto::ledger::read::v1::__buffa::view::GetBalancesRequestView<
529                                'static,
530                            >,
531                        >,
532                        format|
533                    {
534                        let svc = ::std::sync::Arc::clone(&svc);
535                        async move {
536                            let sreq = ::connectrpc::ServiceRequest::<
537                                crate::proto::ledger::read::v1::GetBalancesRequest,
538                            >::from_parts(req.reborrow(), req.bytes());
539                            svc.get_balances(ctx, sreq)
540                                .await?
541                                .encode::<
542                                    crate::proto::ledger::read::v1::GetBalancesResponse,
543                                >(format)
544                        }
545                    })
546                },
547            )
548            .with_spec(LEDGER_READ_SERVICE_GET_BALANCES_SPEC)
549    }
550}
551/// Type-inference marker used by [`Router::add_service`](::connectrpc::Router::add_service).
552#[doc(hidden)]
553pub struct LedgerReadServiceRegisterMarker;
554impl<S: LedgerReadService> ::connectrpc::ServiceRegister<LedgerReadServiceRegisterMarker>
555for ::std::sync::Arc<S> {
556    fn register_service(self, router: ::connectrpc::Router) -> ::connectrpc::Router {
557        <S as LedgerReadServiceExt>::register(self, router)
558    }
559}
560/// Monomorphic dispatcher for `LedgerReadService`.
561///
562/// Unlike `.register(Router)` which type-erases each method into an `Arc<dyn ErasedHandler>` stored in a `HashMap`, this struct dispatches via a compile-time `match` on method name: no vtable, no hash lookup.
563///
564/// # Example
565///
566/// ```rust,ignore
567/// use connectrpc::ConnectRpcService;
568///
569/// let server = LedgerReadServiceServer::new(MyImpl);
570/// let service = ConnectRpcService::new(server);
571/// // hand `service` to axum/hyper as a fallback_service
572/// ```
573pub struct LedgerReadServiceServer<T> {
574    inner: ::std::sync::Arc<T>,
575}
576impl<T: LedgerReadService> LedgerReadServiceServer<T> {
577    /// Wrap a service implementation in a monomorphic dispatcher.
578    pub fn new(service: T) -> Self {
579        Self {
580            inner: ::std::sync::Arc::new(service),
581        }
582    }
583    /// Wrap an already-`Arc`'d service implementation.
584    pub fn from_arc(inner: ::std::sync::Arc<T>) -> Self {
585        Self { inner }
586    }
587}
588impl<T> Clone for LedgerReadServiceServer<T> {
589    fn clone(&self) -> Self {
590        Self {
591            inner: ::std::sync::Arc::clone(&self.inner),
592        }
593    }
594}
595impl<T: LedgerReadService> ::connectrpc::Dispatcher for LedgerReadServiceServer<T> {
596    #[inline]
597    fn lookup(
598        &self,
599        path: &str,
600    ) -> Option<::connectrpc::dispatcher::codegen::MethodDescriptor> {
601        let method = path.strip_prefix("ledger.read.v1.LedgerReadService/")?;
602        match method {
603            "GetBalanceHistory" => {
604                Some(
605                    ::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
606                        .with_spec(LEDGER_READ_SERVICE_GET_BALANCE_HISTORY_SPEC),
607                )
608            }
609            "GetEquityHistorySeries" => {
610                Some(
611                    ::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
612                        .with_spec(LEDGER_READ_SERVICE_GET_EQUITY_HISTORY_SERIES_SPEC),
613                )
614            }
615            "ListTransfers" => {
616                Some(
617                    ::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
618                        .with_spec(LEDGER_READ_SERVICE_LIST_TRANSFERS_SPEC),
619                )
620            }
621            "ListHolds" => {
622                Some(
623                    ::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
624                        .with_spec(LEDGER_READ_SERVICE_LIST_HOLDS_SPEC),
625                )
626            }
627            "GetBalances" => {
628                Some(
629                    ::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
630                        .with_spec(LEDGER_READ_SERVICE_GET_BALANCES_SPEC),
631                )
632            }
633            _ => None,
634        }
635    }
636    fn call_unary(
637        &self,
638        path: &str,
639        ctx: ::connectrpc::RequestContext,
640        request: ::connectrpc::Payload,
641        format: ::connectrpc::CodecFormat,
642    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
643        let Some(method) = path.strip_prefix("ledger.read.v1.LedgerReadService/") else {
644            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
645        };
646        let _ = (&ctx, &request, &format);
647        match method {
648            "GetBalanceHistory" => {
649                let svc = ::std::sync::Arc::clone(&self.inner);
650                Box::pin(async move {
651                    let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
652                        crate::proto::ledger::read::v1::GetBalanceHistoryRequest,
653                    >(request.encoded()?, format)?;
654                    let req: crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryRequestView<
655                        '_,
656                    > = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
657                        &body,
658                    )?;
659                    let req = ::connectrpc::ServiceRequest::<
660                        crate::proto::ledger::read::v1::GetBalanceHistoryRequest,
661                    >::from_parts(&req, &body);
662                    svc.get_balance_history(ctx, req)
663                        .await?
664                        .encode::<
665                            crate::proto::ledger::read::v1::GetBalanceHistoryResponse,
666                        >(format)
667                })
668            }
669            "GetEquityHistorySeries" => {
670                let svc = ::std::sync::Arc::clone(&self.inner);
671                Box::pin(async move {
672                    let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
673                        crate::proto::ledger::read::v1::GetEquityHistorySeriesRequest,
674                    >(request.encoded()?, format)?;
675                    let req: crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesRequestView<
676                        '_,
677                    > = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
678                        &body,
679                    )?;
680                    let req = ::connectrpc::ServiceRequest::<
681                        crate::proto::ledger::read::v1::GetEquityHistorySeriesRequest,
682                    >::from_parts(&req, &body);
683                    svc.get_equity_history_series(ctx, req)
684                        .await?
685                        .encode::<
686                            crate::proto::ledger::read::v1::GetEquityHistorySeriesResponse,
687                        >(format)
688                })
689            }
690            "ListTransfers" => {
691                let svc = ::std::sync::Arc::clone(&self.inner);
692                Box::pin(async move {
693                    let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
694                        crate::proto::ledger::read::v1::ListTransfersRequest,
695                    >(request.encoded()?, format)?;
696                    let req: crate::proto::ledger::read::v1::__buffa::view::ListTransfersRequestView<
697                        '_,
698                    > = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
699                        &body,
700                    )?;
701                    let req = ::connectrpc::ServiceRequest::<
702                        crate::proto::ledger::read::v1::ListTransfersRequest,
703                    >::from_parts(&req, &body);
704                    svc.list_transfers(ctx, req)
705                        .await?
706                        .encode::<
707                            crate::proto::ledger::read::v1::ListTransfersResponse,
708                        >(format)
709                })
710            }
711            "ListHolds" => {
712                let svc = ::std::sync::Arc::clone(&self.inner);
713                Box::pin(async move {
714                    let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
715                        crate::proto::ledger::read::v1::ListHoldsRequest,
716                    >(request.encoded()?, format)?;
717                    let req: crate::proto::ledger::read::v1::__buffa::view::ListHoldsRequestView<
718                        '_,
719                    > = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
720                        &body,
721                    )?;
722                    let req = ::connectrpc::ServiceRequest::<
723                        crate::proto::ledger::read::v1::ListHoldsRequest,
724                    >::from_parts(&req, &body);
725                    svc.list_holds(ctx, req)
726                        .await?
727                        .encode::<
728                            crate::proto::ledger::read::v1::ListHoldsResponse,
729                        >(format)
730                })
731            }
732            "GetBalances" => {
733                let svc = ::std::sync::Arc::clone(&self.inner);
734                Box::pin(async move {
735                    let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
736                        crate::proto::ledger::read::v1::GetBalancesRequest,
737                    >(request.encoded()?, format)?;
738                    let req: crate::proto::ledger::read::v1::__buffa::view::GetBalancesRequestView<
739                        '_,
740                    > = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
741                        &body,
742                    )?;
743                    let req = ::connectrpc::ServiceRequest::<
744                        crate::proto::ledger::read::v1::GetBalancesRequest,
745                    >::from_parts(&req, &body);
746                    svc.get_balances(ctx, req)
747                        .await?
748                        .encode::<
749                            crate::proto::ledger::read::v1::GetBalancesResponse,
750                        >(format)
751                })
752            }
753            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
754        }
755    }
756    fn call_server_streaming(
757        &self,
758        path: &str,
759        ctx: ::connectrpc::RequestContext,
760        request: ::buffa::bytes::Bytes,
761        format: ::connectrpc::CodecFormat,
762    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
763        let Some(method) = path.strip_prefix("ledger.read.v1.LedgerReadService/") else {
764            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
765        };
766        let _ = (&ctx, &request, &format);
767        match method {
768            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
769        }
770    }
771    fn call_client_streaming(
772        &self,
773        path: &str,
774        ctx: ::connectrpc::RequestContext,
775        requests: ::connectrpc::dispatcher::codegen::RequestStream,
776        format: ::connectrpc::CodecFormat,
777    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
778        let Some(method) = path.strip_prefix("ledger.read.v1.LedgerReadService/") else {
779            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
780        };
781        let _ = (&ctx, &requests, &format);
782        match method {
783            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
784        }
785    }
786    fn call_bidi_streaming(
787        &self,
788        path: &str,
789        ctx: ::connectrpc::RequestContext,
790        requests: ::connectrpc::dispatcher::codegen::RequestStream,
791        format: ::connectrpc::CodecFormat,
792    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
793        let Some(method) = path.strip_prefix("ledger.read.v1.LedgerReadService/") else {
794            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
795        };
796        let _ = (&ctx, &requests, &format);
797        match method {
798            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
799        }
800    }
801}
802/// Client for this service.
803///
804/// Generic over `T: ClientTransport`. For **gRPC** (HTTP/2), use
805/// `Http2Connection` — it has honest `poll_ready` and composes with
806/// `tower::balance` for multi-connection load balancing. For **Connect
807/// over HTTP/1.1** (or unknown protocol), use `HttpClient`.
808///
809/// # Working with the response
810///
811/// Unary calls return [`UnaryResponse<OwnedView<FooView>>`](::connectrpc::client::UnaryResponse).
812/// [`view()`](::connectrpc::client::UnaryResponse::view) borrows the response
813/// message, so field access is zero-copy:
814///
815/// ```rust,ignore
816/// let resp = client.get_balance_history(request).await?;
817/// let name: &str = resp.view().name;  // borrow into the response buffer
818/// ```
819///
820/// If you need the owned struct (e.g. to store or pass by value), use
821/// [`into_owned()`](::connectrpc::client::UnaryResponse::into_owned):
822///
823/// ```rust,ignore
824/// let owned = client.get_balance_history(request).await?.into_owned();
825/// ```
826///
827/// [`into_view()`](::connectrpc::client::UnaryResponse::into_view) keeps the
828/// zero-copy decoded body (an `OwnedView`) without copying; field access on it
829/// goes through `.reborrow()`. Streaming responses yield one
830/// [`StreamMessage`](::connectrpc::StreamMessage) per received message from
831/// `.message().await` — read fields zero-copy through the generated accessor
832/// methods (`msg.name()`) or `.view()`, or convert with `.to_owned_message()`.
833#[derive(Clone)]
834pub struct LedgerReadServiceClient<T> {
835    transport: T,
836    config: ::connectrpc::client::ClientConfig,
837}
838impl<T> LedgerReadServiceClient<T>
839where
840    T: ::connectrpc::client::ClientTransport,
841    <T::ResponseBody as ::connectrpc::http_body::Body>::Error: ::std::fmt::Display,
842{
843    /// Create a new client with the given transport and configuration.
844    pub fn new(transport: T, config: ::connectrpc::client::ClientConfig) -> Self {
845        Self { transport, config }
846    }
847    /// Get the client configuration.
848    pub fn config(&self) -> &::connectrpc::client::ClientConfig {
849        &self.config
850    }
851    /// Get a mutable reference to the client configuration.
852    pub fn config_mut(&mut self) -> &mut ::connectrpc::client::ClientConfig {
853        &mut self.config
854    }
855    /// Call the GetBalanceHistory RPC. Sends a request to /ledger.read.v1.LedgerReadService/GetBalanceHistory.
856    pub async fn get_balance_history(
857        &self,
858        request: crate::proto::ledger::read::v1::GetBalanceHistoryRequest,
859    ) -> Result<
860        ::connectrpc::client::UnaryResponse<
861            ::buffa::view::OwnedView<
862                crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryResponseView<
863                    'static,
864                >,
865            >,
866        >,
867        ::connectrpc::ConnectError,
868    > {
869        self.get_balance_history_with_options(
870                request,
871                ::connectrpc::client::CallOptions::default(),
872            )
873            .await
874    }
875    /// Call the GetBalanceHistory RPC with explicit per-call options. Options override [`ClientConfig`](::connectrpc::client::ClientConfig) defaults.
876    pub async fn get_balance_history_with_options(
877        &self,
878        request: crate::proto::ledger::read::v1::GetBalanceHistoryRequest,
879        options: ::connectrpc::client::CallOptions,
880    ) -> Result<
881        ::connectrpc::client::UnaryResponse<
882            ::buffa::view::OwnedView<
883                crate::proto::ledger::read::v1::__buffa::view::GetBalanceHistoryResponseView<
884                    'static,
885                >,
886            >,
887        >,
888        ::connectrpc::ConnectError,
889    > {
890        ::connectrpc::client::call_unary(
891                &self.transport,
892                &self.config,
893                LEDGER_READ_SERVICE_SERVICE_NAME,
894                "GetBalanceHistory",
895                request,
896                options,
897            )
898            .await
899    }
900    /// Call the GetEquityHistorySeries RPC. Sends a request to /ledger.read.v1.LedgerReadService/GetEquityHistorySeries.
901    pub async fn get_equity_history_series(
902        &self,
903        request: crate::proto::ledger::read::v1::GetEquityHistorySeriesRequest,
904    ) -> Result<
905        ::connectrpc::client::UnaryResponse<
906            ::buffa::view::OwnedView<
907                crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesResponseView<
908                    'static,
909                >,
910            >,
911        >,
912        ::connectrpc::ConnectError,
913    > {
914        self.get_equity_history_series_with_options(
915                request,
916                ::connectrpc::client::CallOptions::default(),
917            )
918            .await
919    }
920    /// Call the GetEquityHistorySeries RPC with explicit per-call options. Options override [`ClientConfig`](::connectrpc::client::ClientConfig) defaults.
921    pub async fn get_equity_history_series_with_options(
922        &self,
923        request: crate::proto::ledger::read::v1::GetEquityHistorySeriesRequest,
924        options: ::connectrpc::client::CallOptions,
925    ) -> Result<
926        ::connectrpc::client::UnaryResponse<
927            ::buffa::view::OwnedView<
928                crate::proto::ledger::read::v1::__buffa::view::GetEquityHistorySeriesResponseView<
929                    'static,
930                >,
931            >,
932        >,
933        ::connectrpc::ConnectError,
934    > {
935        ::connectrpc::client::call_unary(
936                &self.transport,
937                &self.config,
938                LEDGER_READ_SERVICE_SERVICE_NAME,
939                "GetEquityHistorySeries",
940                request,
941                options,
942            )
943            .await
944    }
945    /// Call the ListTransfers RPC. Sends a request to /ledger.read.v1.LedgerReadService/ListTransfers.
946    pub async fn list_transfers(
947        &self,
948        request: crate::proto::ledger::read::v1::ListTransfersRequest,
949    ) -> Result<
950        ::connectrpc::client::UnaryResponse<
951            ::buffa::view::OwnedView<
952                crate::proto::ledger::read::v1::__buffa::view::ListTransfersResponseView<
953                    'static,
954                >,
955            >,
956        >,
957        ::connectrpc::ConnectError,
958    > {
959        self.list_transfers_with_options(
960                request,
961                ::connectrpc::client::CallOptions::default(),
962            )
963            .await
964    }
965    /// Call the ListTransfers RPC with explicit per-call options. Options override [`ClientConfig`](::connectrpc::client::ClientConfig) defaults.
966    pub async fn list_transfers_with_options(
967        &self,
968        request: crate::proto::ledger::read::v1::ListTransfersRequest,
969        options: ::connectrpc::client::CallOptions,
970    ) -> Result<
971        ::connectrpc::client::UnaryResponse<
972            ::buffa::view::OwnedView<
973                crate::proto::ledger::read::v1::__buffa::view::ListTransfersResponseView<
974                    'static,
975                >,
976            >,
977        >,
978        ::connectrpc::ConnectError,
979    > {
980        ::connectrpc::client::call_unary(
981                &self.transport,
982                &self.config,
983                LEDGER_READ_SERVICE_SERVICE_NAME,
984                "ListTransfers",
985                request,
986                options,
987            )
988            .await
989    }
990    /// Call the ListHolds RPC. Sends a request to /ledger.read.v1.LedgerReadService/ListHolds.
991    pub async fn list_holds(
992        &self,
993        request: crate::proto::ledger::read::v1::ListHoldsRequest,
994    ) -> Result<
995        ::connectrpc::client::UnaryResponse<
996            ::buffa::view::OwnedView<
997                crate::proto::ledger::read::v1::__buffa::view::ListHoldsResponseView<
998                    'static,
999                >,
1000            >,
1001        >,
1002        ::connectrpc::ConnectError,
1003    > {
1004        self.list_holds_with_options(
1005                request,
1006                ::connectrpc::client::CallOptions::default(),
1007            )
1008            .await
1009    }
1010    /// Call the ListHolds RPC with explicit per-call options. Options override [`ClientConfig`](::connectrpc::client::ClientConfig) defaults.
1011    pub async fn list_holds_with_options(
1012        &self,
1013        request: crate::proto::ledger::read::v1::ListHoldsRequest,
1014        options: ::connectrpc::client::CallOptions,
1015    ) -> Result<
1016        ::connectrpc::client::UnaryResponse<
1017            ::buffa::view::OwnedView<
1018                crate::proto::ledger::read::v1::__buffa::view::ListHoldsResponseView<
1019                    'static,
1020                >,
1021            >,
1022        >,
1023        ::connectrpc::ConnectError,
1024    > {
1025        ::connectrpc::client::call_unary(
1026                &self.transport,
1027                &self.config,
1028                LEDGER_READ_SERVICE_SERVICE_NAME,
1029                "ListHolds",
1030                request,
1031                options,
1032            )
1033            .await
1034    }
1035    /// Call the GetBalances RPC. Sends a request to /ledger.read.v1.LedgerReadService/GetBalances.
1036    pub async fn get_balances(
1037        &self,
1038        request: crate::proto::ledger::read::v1::GetBalancesRequest,
1039    ) -> Result<
1040        ::connectrpc::client::UnaryResponse<
1041            ::buffa::view::OwnedView<
1042                crate::proto::ledger::read::v1::__buffa::view::GetBalancesResponseView<
1043                    'static,
1044                >,
1045            >,
1046        >,
1047        ::connectrpc::ConnectError,
1048    > {
1049        self.get_balances_with_options(
1050                request,
1051                ::connectrpc::client::CallOptions::default(),
1052            )
1053            .await
1054    }
1055    /// Call the GetBalances RPC with explicit per-call options. Options override [`ClientConfig`](::connectrpc::client::ClientConfig) defaults.
1056    pub async fn get_balances_with_options(
1057        &self,
1058        request: crate::proto::ledger::read::v1::GetBalancesRequest,
1059        options: ::connectrpc::client::CallOptions,
1060    ) -> Result<
1061        ::connectrpc::client::UnaryResponse<
1062            ::buffa::view::OwnedView<
1063                crate::proto::ledger::read::v1::__buffa::view::GetBalancesResponseView<
1064                    'static,
1065                >,
1066            >,
1067        >,
1068        ::connectrpc::ConnectError,
1069    > {
1070        ::connectrpc::client::call_unary(
1071                &self.transport,
1072                &self.config,
1073                LEDGER_READ_SERVICE_SERVICE_NAME,
1074                "GetBalances",
1075                request,
1076                options,
1077            )
1078            .await
1079    }
1080}