Skip to main content

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

1// @generated by buffa-codegen. DO NOT EDIT.
2
3/// Supported history windows for balance charts.
4#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5#[repr(i32)]
6pub enum BalanceRange {
7    RANGE_UNSPECIFIED = 0i32,
8    /// 1 day
9    DAY_1 = 1i32,
10    /// 7 days
11    DAY_7 = 2i32,
12    /// 30 days
13    DAY_30 = 3i32,
14    /// 90 days
15    DAY_90 = 4i32,
16    /// 180 days
17    DAY_180 = 5i32,
18    /// 365 days
19    DAY_365 = 6i32,
20}
21impl BalanceRange {
22    ///Idiomatic alias for [`Self::RANGE_UNSPECIFIED`]; `Debug` prints the variant name.
23    #[allow(non_upper_case_globals)]
24    pub const RangeUnspecified: Self = Self::RANGE_UNSPECIFIED;
25    ///Idiomatic alias for [`Self::DAY_1`]; `Debug` prints the variant name.
26    #[allow(non_upper_case_globals)]
27    pub const Day1: Self = Self::DAY_1;
28    ///Idiomatic alias for [`Self::DAY_7`]; `Debug` prints the variant name.
29    #[allow(non_upper_case_globals)]
30    pub const Day7: Self = Self::DAY_7;
31    ///Idiomatic alias for [`Self::DAY_30`]; `Debug` prints the variant name.
32    #[allow(non_upper_case_globals)]
33    pub const Day30: Self = Self::DAY_30;
34    ///Idiomatic alias for [`Self::DAY_90`]; `Debug` prints the variant name.
35    #[allow(non_upper_case_globals)]
36    pub const Day90: Self = Self::DAY_90;
37    ///Idiomatic alias for [`Self::DAY_180`]; `Debug` prints the variant name.
38    #[allow(non_upper_case_globals)]
39    pub const Day180: Self = Self::DAY_180;
40    ///Idiomatic alias for [`Self::DAY_365`]; `Debug` prints the variant name.
41    #[allow(non_upper_case_globals)]
42    pub const Day365: Self = Self::DAY_365;
43}
44impl ::core::default::Default for BalanceRange {
45    fn default() -> Self {
46        Self::RANGE_UNSPECIFIED
47    }
48}
49impl ::serde::Serialize for BalanceRange {
50    fn serialize<S: ::serde::Serializer>(
51        &self,
52        s: S,
53    ) -> ::core::result::Result<S::Ok, S::Error> {
54        s.serialize_str(::buffa::Enumeration::proto_name(self))
55    }
56}
57impl<'de> ::serde::Deserialize<'de> for BalanceRange {
58    fn deserialize<D: ::serde::Deserializer<'de>>(
59        d: D,
60    ) -> ::core::result::Result<Self, D::Error> {
61        struct _V;
62        impl ::serde::de::Visitor<'_> for _V {
63            type Value = BalanceRange;
64            fn expecting(
65                &self,
66                f: &mut ::core::fmt::Formatter<'_>,
67            ) -> ::core::fmt::Result {
68                f.write_str(
69                    concat!("a string, integer, or null for ", stringify!(BalanceRange)),
70                )
71            }
72            fn visit_str<E: ::serde::de::Error>(
73                self,
74                v: &str,
75            ) -> ::core::result::Result<BalanceRange, E> {
76                <BalanceRange as ::buffa::Enumeration>::from_proto_name(v)
77                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
78            }
79            fn visit_i64<E: ::serde::de::Error>(
80                self,
81                v: i64,
82            ) -> ::core::result::Result<BalanceRange, E> {
83                let v32 = i32::try_from(v)
84                    .map_err(|_| {
85                        ::serde::de::Error::custom(
86                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
87                        )
88                    })?;
89                <BalanceRange as ::buffa::Enumeration>::from_i32(v32)
90                    .ok_or_else(|| {
91                        ::serde::de::Error::custom(
92                            ::buffa::alloc::format!("unknown enum value {v32}"),
93                        )
94                    })
95            }
96            fn visit_u64<E: ::serde::de::Error>(
97                self,
98                v: u64,
99            ) -> ::core::result::Result<BalanceRange, E> {
100                let v32 = i32::try_from(v)
101                    .map_err(|_| {
102                        ::serde::de::Error::custom(
103                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
104                        )
105                    })?;
106                <BalanceRange as ::buffa::Enumeration>::from_i32(v32)
107                    .ok_or_else(|| {
108                        ::serde::de::Error::custom(
109                            ::buffa::alloc::format!("unknown enum value {v32}"),
110                        )
111                    })
112            }
113            fn visit_unit<E: ::serde::de::Error>(
114                self,
115            ) -> ::core::result::Result<BalanceRange, E> {
116                ::core::result::Result::Ok(::core::default::Default::default())
117            }
118        }
119        d.deserialize_any(_V)
120    }
121}
122impl ::buffa::json_helpers::ProtoElemJson for BalanceRange {
123    fn serialize_proto_json<S: ::serde::Serializer>(
124        v: &Self,
125        s: S,
126    ) -> ::core::result::Result<S::Ok, S::Error> {
127        ::serde::Serialize::serialize(v, s)
128    }
129    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
130        d: D,
131    ) -> ::core::result::Result<Self, D::Error> {
132        <Self as ::serde::Deserialize>::deserialize(d)
133    }
134}
135impl ::buffa::Enumeration for BalanceRange {
136    fn from_i32(value: i32) -> ::core::option::Option<Self> {
137        match value {
138            0i32 => ::core::option::Option::Some(Self::RANGE_UNSPECIFIED),
139            1i32 => ::core::option::Option::Some(Self::DAY_1),
140            2i32 => ::core::option::Option::Some(Self::DAY_7),
141            3i32 => ::core::option::Option::Some(Self::DAY_30),
142            4i32 => ::core::option::Option::Some(Self::DAY_90),
143            5i32 => ::core::option::Option::Some(Self::DAY_180),
144            6i32 => ::core::option::Option::Some(Self::DAY_365),
145            _ => ::core::option::Option::None,
146        }
147    }
148    fn to_i32(&self) -> i32 {
149        *self as i32
150    }
151    fn proto_name(&self) -> &'static str {
152        match self {
153            Self::RANGE_UNSPECIFIED => "RANGE_UNSPECIFIED",
154            Self::DAY_1 => "DAY_1",
155            Self::DAY_7 => "DAY_7",
156            Self::DAY_30 => "DAY_30",
157            Self::DAY_90 => "DAY_90",
158            Self::DAY_180 => "DAY_180",
159            Self::DAY_365 => "DAY_365",
160        }
161    }
162    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
163        match name {
164            "RANGE_UNSPECIFIED" => ::core::option::Option::Some(Self::RANGE_UNSPECIFIED),
165            "DAY_1" => ::core::option::Option::Some(Self::DAY_1),
166            "DAY_7" => ::core::option::Option::Some(Self::DAY_7),
167            "DAY_30" => ::core::option::Option::Some(Self::DAY_30),
168            "DAY_90" => ::core::option::Option::Some(Self::DAY_90),
169            "DAY_180" => ::core::option::Option::Some(Self::DAY_180),
170            "DAY_365" => ::core::option::Option::Some(Self::DAY_365),
171            _ => ::core::option::Option::None,
172        }
173    }
174    fn values() -> &'static [Self] {
175        &[
176            Self::RANGE_UNSPECIFIED,
177            Self::DAY_1,
178            Self::DAY_7,
179            Self::DAY_30,
180            Self::DAY_90,
181            Self::DAY_180,
182            Self::DAY_365,
183        ]
184    }
185}
186/// How to group equity series data.
187#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
188#[repr(i32)]
189pub enum EquityGroupBy {
190    /// defaults to ACCOUNT
191    GROUP_BY_UNSPECIFIED = 0i32,
192    /// group by account bucket
193    GROUP_BY_ACCOUNT = 1i32,
194    /// group by asset (BTC, ETH, etc.)
195    GROUP_BY_ASSET = 2i32,
196}
197impl EquityGroupBy {
198    ///Idiomatic alias for [`Self::GROUP_BY_UNSPECIFIED`]; `Debug` prints the variant name.
199    #[allow(non_upper_case_globals)]
200    pub const GroupByUnspecified: Self = Self::GROUP_BY_UNSPECIFIED;
201    ///Idiomatic alias for [`Self::GROUP_BY_ACCOUNT`]; `Debug` prints the variant name.
202    #[allow(non_upper_case_globals)]
203    pub const GroupByAccount: Self = Self::GROUP_BY_ACCOUNT;
204    ///Idiomatic alias for [`Self::GROUP_BY_ASSET`]; `Debug` prints the variant name.
205    #[allow(non_upper_case_globals)]
206    pub const GroupByAsset: Self = Self::GROUP_BY_ASSET;
207}
208impl ::core::default::Default for EquityGroupBy {
209    fn default() -> Self {
210        Self::GROUP_BY_UNSPECIFIED
211    }
212}
213impl ::serde::Serialize for EquityGroupBy {
214    fn serialize<S: ::serde::Serializer>(
215        &self,
216        s: S,
217    ) -> ::core::result::Result<S::Ok, S::Error> {
218        s.serialize_str(::buffa::Enumeration::proto_name(self))
219    }
220}
221impl<'de> ::serde::Deserialize<'de> for EquityGroupBy {
222    fn deserialize<D: ::serde::Deserializer<'de>>(
223        d: D,
224    ) -> ::core::result::Result<Self, D::Error> {
225        struct _V;
226        impl ::serde::de::Visitor<'_> for _V {
227            type Value = EquityGroupBy;
228            fn expecting(
229                &self,
230                f: &mut ::core::fmt::Formatter<'_>,
231            ) -> ::core::fmt::Result {
232                f.write_str(
233                    concat!("a string, integer, or null for ", stringify!(EquityGroupBy)),
234                )
235            }
236            fn visit_str<E: ::serde::de::Error>(
237                self,
238                v: &str,
239            ) -> ::core::result::Result<EquityGroupBy, E> {
240                <EquityGroupBy as ::buffa::Enumeration>::from_proto_name(v)
241                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
242            }
243            fn visit_i64<E: ::serde::de::Error>(
244                self,
245                v: i64,
246            ) -> ::core::result::Result<EquityGroupBy, E> {
247                let v32 = i32::try_from(v)
248                    .map_err(|_| {
249                        ::serde::de::Error::custom(
250                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
251                        )
252                    })?;
253                <EquityGroupBy as ::buffa::Enumeration>::from_i32(v32)
254                    .ok_or_else(|| {
255                        ::serde::de::Error::custom(
256                            ::buffa::alloc::format!("unknown enum value {v32}"),
257                        )
258                    })
259            }
260            fn visit_u64<E: ::serde::de::Error>(
261                self,
262                v: u64,
263            ) -> ::core::result::Result<EquityGroupBy, E> {
264                let v32 = i32::try_from(v)
265                    .map_err(|_| {
266                        ::serde::de::Error::custom(
267                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
268                        )
269                    })?;
270                <EquityGroupBy as ::buffa::Enumeration>::from_i32(v32)
271                    .ok_or_else(|| {
272                        ::serde::de::Error::custom(
273                            ::buffa::alloc::format!("unknown enum value {v32}"),
274                        )
275                    })
276            }
277            fn visit_unit<E: ::serde::de::Error>(
278                self,
279            ) -> ::core::result::Result<EquityGroupBy, E> {
280                ::core::result::Result::Ok(::core::default::Default::default())
281            }
282        }
283        d.deserialize_any(_V)
284    }
285}
286impl ::buffa::json_helpers::ProtoElemJson for EquityGroupBy {
287    fn serialize_proto_json<S: ::serde::Serializer>(
288        v: &Self,
289        s: S,
290    ) -> ::core::result::Result<S::Ok, S::Error> {
291        ::serde::Serialize::serialize(v, s)
292    }
293    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
294        d: D,
295    ) -> ::core::result::Result<Self, D::Error> {
296        <Self as ::serde::Deserialize>::deserialize(d)
297    }
298}
299impl ::buffa::Enumeration for EquityGroupBy {
300    fn from_i32(value: i32) -> ::core::option::Option<Self> {
301        match value {
302            0i32 => ::core::option::Option::Some(Self::GROUP_BY_UNSPECIFIED),
303            1i32 => ::core::option::Option::Some(Self::GROUP_BY_ACCOUNT),
304            2i32 => ::core::option::Option::Some(Self::GROUP_BY_ASSET),
305            _ => ::core::option::Option::None,
306        }
307    }
308    fn to_i32(&self) -> i32 {
309        *self as i32
310    }
311    fn proto_name(&self) -> &'static str {
312        match self {
313            Self::GROUP_BY_UNSPECIFIED => "GROUP_BY_UNSPECIFIED",
314            Self::GROUP_BY_ACCOUNT => "GROUP_BY_ACCOUNT",
315            Self::GROUP_BY_ASSET => "GROUP_BY_ASSET",
316        }
317    }
318    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
319        match name {
320            "GROUP_BY_UNSPECIFIED" => {
321                ::core::option::Option::Some(Self::GROUP_BY_UNSPECIFIED)
322            }
323            "GROUP_BY_ACCOUNT" => ::core::option::Option::Some(Self::GROUP_BY_ACCOUNT),
324            "GROUP_BY_ASSET" => ::core::option::Option::Some(Self::GROUP_BY_ASSET),
325            _ => ::core::option::Option::None,
326        }
327    }
328    fn values() -> &'static [Self] {
329        &[Self::GROUP_BY_UNSPECIFIED, Self::GROUP_BY_ACCOUNT, Self::GROUP_BY_ASSET]
330    }
331}
332/// TransferSideKind identifies the display class for one side of a transfer.
333#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
334#[repr(i32)]
335pub enum TransferSideKind {
336    /// Transfer side type was not specified.
337    TRANSFER_SIDE_KIND_UNSPECIFIED = 0i32,
338    /// Polyester funding account.
339    FUNDING_ACCOUNT = 1i32,
340    /// Polyester trading account.
341    TRADING_ACCOUNT = 2i32,
342    /// External wallet or chain address. The address is lifecycle-derived and may
343    /// be empty until ledger-to-lifecycle correlation is projected.
344    EXTERNAL_ADDRESS = 3i32,
345    /// Private off-chain counterparty that must not be identified to the caller.
346    /// account_id and address are intentionally omitted.
347    PRIVATE_COUNTERPARTY = 4i32,
348    /// Fee ledger side, for example spot or perp trading fees.
349    FEE_ACCOUNT = 5i32,
350    /// System, operator, clearing, or other non-user side.
351    SYSTEM_ACCOUNT = 6i32,
352}
353impl TransferSideKind {
354    ///Idiomatic alias for [`Self::TRANSFER_SIDE_KIND_UNSPECIFIED`]; `Debug` prints the variant name.
355    #[allow(non_upper_case_globals)]
356    pub const TransferSideKindUnspecified: Self = Self::TRANSFER_SIDE_KIND_UNSPECIFIED;
357    ///Idiomatic alias for [`Self::FUNDING_ACCOUNT`]; `Debug` prints the variant name.
358    #[allow(non_upper_case_globals)]
359    pub const FundingAccount: Self = Self::FUNDING_ACCOUNT;
360    ///Idiomatic alias for [`Self::TRADING_ACCOUNT`]; `Debug` prints the variant name.
361    #[allow(non_upper_case_globals)]
362    pub const TradingAccount: Self = Self::TRADING_ACCOUNT;
363    ///Idiomatic alias for [`Self::EXTERNAL_ADDRESS`]; `Debug` prints the variant name.
364    #[allow(non_upper_case_globals)]
365    pub const ExternalAddress: Self = Self::EXTERNAL_ADDRESS;
366    ///Idiomatic alias for [`Self::PRIVATE_COUNTERPARTY`]; `Debug` prints the variant name.
367    #[allow(non_upper_case_globals)]
368    pub const PrivateCounterparty: Self = Self::PRIVATE_COUNTERPARTY;
369    ///Idiomatic alias for [`Self::FEE_ACCOUNT`]; `Debug` prints the variant name.
370    #[allow(non_upper_case_globals)]
371    pub const FeeAccount: Self = Self::FEE_ACCOUNT;
372    ///Idiomatic alias for [`Self::SYSTEM_ACCOUNT`]; `Debug` prints the variant name.
373    #[allow(non_upper_case_globals)]
374    pub const SystemAccount: Self = Self::SYSTEM_ACCOUNT;
375}
376impl ::core::default::Default for TransferSideKind {
377    fn default() -> Self {
378        Self::TRANSFER_SIDE_KIND_UNSPECIFIED
379    }
380}
381impl ::serde::Serialize for TransferSideKind {
382    fn serialize<S: ::serde::Serializer>(
383        &self,
384        s: S,
385    ) -> ::core::result::Result<S::Ok, S::Error> {
386        s.serialize_str(::buffa::Enumeration::proto_name(self))
387    }
388}
389impl<'de> ::serde::Deserialize<'de> for TransferSideKind {
390    fn deserialize<D: ::serde::Deserializer<'de>>(
391        d: D,
392    ) -> ::core::result::Result<Self, D::Error> {
393        struct _V;
394        impl ::serde::de::Visitor<'_> for _V {
395            type Value = TransferSideKind;
396            fn expecting(
397                &self,
398                f: &mut ::core::fmt::Formatter<'_>,
399            ) -> ::core::fmt::Result {
400                f.write_str(
401                    concat!(
402                        "a string, integer, or null for ", stringify!(TransferSideKind)
403                    ),
404                )
405            }
406            fn visit_str<E: ::serde::de::Error>(
407                self,
408                v: &str,
409            ) -> ::core::result::Result<TransferSideKind, E> {
410                <TransferSideKind as ::buffa::Enumeration>::from_proto_name(v)
411                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
412            }
413            fn visit_i64<E: ::serde::de::Error>(
414                self,
415                v: i64,
416            ) -> ::core::result::Result<TransferSideKind, E> {
417                let v32 = i32::try_from(v)
418                    .map_err(|_| {
419                        ::serde::de::Error::custom(
420                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
421                        )
422                    })?;
423                <TransferSideKind as ::buffa::Enumeration>::from_i32(v32)
424                    .ok_or_else(|| {
425                        ::serde::de::Error::custom(
426                            ::buffa::alloc::format!("unknown enum value {v32}"),
427                        )
428                    })
429            }
430            fn visit_u64<E: ::serde::de::Error>(
431                self,
432                v: u64,
433            ) -> ::core::result::Result<TransferSideKind, E> {
434                let v32 = i32::try_from(v)
435                    .map_err(|_| {
436                        ::serde::de::Error::custom(
437                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
438                        )
439                    })?;
440                <TransferSideKind as ::buffa::Enumeration>::from_i32(v32)
441                    .ok_or_else(|| {
442                        ::serde::de::Error::custom(
443                            ::buffa::alloc::format!("unknown enum value {v32}"),
444                        )
445                    })
446            }
447            fn visit_unit<E: ::serde::de::Error>(
448                self,
449            ) -> ::core::result::Result<TransferSideKind, E> {
450                ::core::result::Result::Ok(::core::default::Default::default())
451            }
452        }
453        d.deserialize_any(_V)
454    }
455}
456impl ::buffa::json_helpers::ProtoElemJson for TransferSideKind {
457    fn serialize_proto_json<S: ::serde::Serializer>(
458        v: &Self,
459        s: S,
460    ) -> ::core::result::Result<S::Ok, S::Error> {
461        ::serde::Serialize::serialize(v, s)
462    }
463    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
464        d: D,
465    ) -> ::core::result::Result<Self, D::Error> {
466        <Self as ::serde::Deserialize>::deserialize(d)
467    }
468}
469impl ::buffa::Enumeration for TransferSideKind {
470    fn from_i32(value: i32) -> ::core::option::Option<Self> {
471        match value {
472            0i32 => ::core::option::Option::Some(Self::TRANSFER_SIDE_KIND_UNSPECIFIED),
473            1i32 => ::core::option::Option::Some(Self::FUNDING_ACCOUNT),
474            2i32 => ::core::option::Option::Some(Self::TRADING_ACCOUNT),
475            3i32 => ::core::option::Option::Some(Self::EXTERNAL_ADDRESS),
476            4i32 => ::core::option::Option::Some(Self::PRIVATE_COUNTERPARTY),
477            5i32 => ::core::option::Option::Some(Self::FEE_ACCOUNT),
478            6i32 => ::core::option::Option::Some(Self::SYSTEM_ACCOUNT),
479            _ => ::core::option::Option::None,
480        }
481    }
482    fn to_i32(&self) -> i32 {
483        *self as i32
484    }
485    fn proto_name(&self) -> &'static str {
486        match self {
487            Self::TRANSFER_SIDE_KIND_UNSPECIFIED => "TRANSFER_SIDE_KIND_UNSPECIFIED",
488            Self::FUNDING_ACCOUNT => "FUNDING_ACCOUNT",
489            Self::TRADING_ACCOUNT => "TRADING_ACCOUNT",
490            Self::EXTERNAL_ADDRESS => "EXTERNAL_ADDRESS",
491            Self::PRIVATE_COUNTERPARTY => "PRIVATE_COUNTERPARTY",
492            Self::FEE_ACCOUNT => "FEE_ACCOUNT",
493            Self::SYSTEM_ACCOUNT => "SYSTEM_ACCOUNT",
494        }
495    }
496    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
497        match name {
498            "TRANSFER_SIDE_KIND_UNSPECIFIED" => {
499                ::core::option::Option::Some(Self::TRANSFER_SIDE_KIND_UNSPECIFIED)
500            }
501            "FUNDING_ACCOUNT" => ::core::option::Option::Some(Self::FUNDING_ACCOUNT),
502            "TRADING_ACCOUNT" => ::core::option::Option::Some(Self::TRADING_ACCOUNT),
503            "EXTERNAL_ADDRESS" => ::core::option::Option::Some(Self::EXTERNAL_ADDRESS),
504            "PRIVATE_COUNTERPARTY" => {
505                ::core::option::Option::Some(Self::PRIVATE_COUNTERPARTY)
506            }
507            "FEE_ACCOUNT" => ::core::option::Option::Some(Self::FEE_ACCOUNT),
508            "SYSTEM_ACCOUNT" => ::core::option::Option::Some(Self::SYSTEM_ACCOUNT),
509            _ => ::core::option::Option::None,
510        }
511    }
512    fn values() -> &'static [Self] {
513        &[
514            Self::TRANSFER_SIDE_KIND_UNSPECIFIED,
515            Self::FUNDING_ACCOUNT,
516            Self::TRADING_ACCOUNT,
517            Self::EXTERNAL_ADDRESS,
518            Self::PRIVATE_COUNTERPARTY,
519            Self::FEE_ACCOUNT,
520            Self::SYSTEM_ACCOUNT,
521        ]
522    }
523}
524/// ErrorCode enumerates stable machine-readable error codes for the Ledger Read
525/// API. These mirror the REST problem+json "code" field for parity between REST
526/// and ConnectRPC clients.
527#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
528#[repr(i32)]
529pub enum ErrorCode {
530    ERROR_CODE_UNSPECIFIED = 0i32,
531    ERROR_CODE_BAD_REQUEST = 1i32,
532    ERROR_CODE_UNAUTHENTICATED = 2i32,
533    ERROR_CODE_PERMISSION_DENIED = 3i32,
534    ERROR_CODE_NOT_FOUND = 4i32,
535    /// Missing or invalid account identifier (legacy; used by older endpoints).
536    ERROR_CODE_MISSING_ACCOUNT_ID = 5i32,
537    ERROR_CODE_INVALID_ACCOUNT_ID = 6i32,
538    /// Wallet-specific errors for balance lookups by wallet.
539    ERROR_CODE_MISSING_WALLET = 7i32,
540    ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE = 8i32,
541    ERROR_CODE_WALLET_NOT_FOUND = 9i32,
542    /// Upstream dependency error (e.g., transfers store, wallet resolver).
543    ERROR_CODE_UPSTREAM_ERROR = 10i32,
544}
545impl ErrorCode {
546    ///Idiomatic alias for [`Self::ERROR_CODE_UNSPECIFIED`]; `Debug` prints the variant name.
547    #[allow(non_upper_case_globals)]
548    pub const Unspecified: Self = Self::ERROR_CODE_UNSPECIFIED;
549    ///Idiomatic alias for [`Self::ERROR_CODE_BAD_REQUEST`]; `Debug` prints the variant name.
550    #[allow(non_upper_case_globals)]
551    pub const BadRequest: Self = Self::ERROR_CODE_BAD_REQUEST;
552    ///Idiomatic alias for [`Self::ERROR_CODE_UNAUTHENTICATED`]; `Debug` prints the variant name.
553    #[allow(non_upper_case_globals)]
554    pub const Unauthenticated: Self = Self::ERROR_CODE_UNAUTHENTICATED;
555    ///Idiomatic alias for [`Self::ERROR_CODE_PERMISSION_DENIED`]; `Debug` prints the variant name.
556    #[allow(non_upper_case_globals)]
557    pub const PermissionDenied: Self = Self::ERROR_CODE_PERMISSION_DENIED;
558    ///Idiomatic alias for [`Self::ERROR_CODE_NOT_FOUND`]; `Debug` prints the variant name.
559    #[allow(non_upper_case_globals)]
560    pub const NotFound: Self = Self::ERROR_CODE_NOT_FOUND;
561    ///Idiomatic alias for [`Self::ERROR_CODE_MISSING_ACCOUNT_ID`]; `Debug` prints the variant name.
562    #[allow(non_upper_case_globals)]
563    pub const MissingAccountId: Self = Self::ERROR_CODE_MISSING_ACCOUNT_ID;
564    ///Idiomatic alias for [`Self::ERROR_CODE_INVALID_ACCOUNT_ID`]; `Debug` prints the variant name.
565    #[allow(non_upper_case_globals)]
566    pub const InvalidAccountId: Self = Self::ERROR_CODE_INVALID_ACCOUNT_ID;
567    ///Idiomatic alias for [`Self::ERROR_CODE_MISSING_WALLET`]; `Debug` prints the variant name.
568    #[allow(non_upper_case_globals)]
569    pub const MissingWallet: Self = Self::ERROR_CODE_MISSING_WALLET;
570    ///Idiomatic alias for [`Self::ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE`]; `Debug` prints the variant name.
571    #[allow(non_upper_case_globals)]
572    pub const WalletResolutionUnavailable: Self = Self::ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE;
573    ///Idiomatic alias for [`Self::ERROR_CODE_WALLET_NOT_FOUND`]; `Debug` prints the variant name.
574    #[allow(non_upper_case_globals)]
575    pub const WalletNotFound: Self = Self::ERROR_CODE_WALLET_NOT_FOUND;
576    ///Idiomatic alias for [`Self::ERROR_CODE_UPSTREAM_ERROR`]; `Debug` prints the variant name.
577    #[allow(non_upper_case_globals)]
578    pub const UpstreamError: Self = Self::ERROR_CODE_UPSTREAM_ERROR;
579}
580impl ::core::default::Default for ErrorCode {
581    fn default() -> Self {
582        Self::ERROR_CODE_UNSPECIFIED
583    }
584}
585impl ::serde::Serialize for ErrorCode {
586    fn serialize<S: ::serde::Serializer>(
587        &self,
588        s: S,
589    ) -> ::core::result::Result<S::Ok, S::Error> {
590        s.serialize_str(::buffa::Enumeration::proto_name(self))
591    }
592}
593impl<'de> ::serde::Deserialize<'de> for ErrorCode {
594    fn deserialize<D: ::serde::Deserializer<'de>>(
595        d: D,
596    ) -> ::core::result::Result<Self, D::Error> {
597        struct _V;
598        impl ::serde::de::Visitor<'_> for _V {
599            type Value = ErrorCode;
600            fn expecting(
601                &self,
602                f: &mut ::core::fmt::Formatter<'_>,
603            ) -> ::core::fmt::Result {
604                f.write_str(
605                    concat!("a string, integer, or null for ", stringify!(ErrorCode)),
606                )
607            }
608            fn visit_str<E: ::serde::de::Error>(
609                self,
610                v: &str,
611            ) -> ::core::result::Result<ErrorCode, E> {
612                <ErrorCode as ::buffa::Enumeration>::from_proto_name(v)
613                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
614            }
615            fn visit_i64<E: ::serde::de::Error>(
616                self,
617                v: i64,
618            ) -> ::core::result::Result<ErrorCode, E> {
619                let v32 = i32::try_from(v)
620                    .map_err(|_| {
621                        ::serde::de::Error::custom(
622                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
623                        )
624                    })?;
625                <ErrorCode as ::buffa::Enumeration>::from_i32(v32)
626                    .ok_or_else(|| {
627                        ::serde::de::Error::custom(
628                            ::buffa::alloc::format!("unknown enum value {v32}"),
629                        )
630                    })
631            }
632            fn visit_u64<E: ::serde::de::Error>(
633                self,
634                v: u64,
635            ) -> ::core::result::Result<ErrorCode, E> {
636                let v32 = i32::try_from(v)
637                    .map_err(|_| {
638                        ::serde::de::Error::custom(
639                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
640                        )
641                    })?;
642                <ErrorCode as ::buffa::Enumeration>::from_i32(v32)
643                    .ok_or_else(|| {
644                        ::serde::de::Error::custom(
645                            ::buffa::alloc::format!("unknown enum value {v32}"),
646                        )
647                    })
648            }
649            fn visit_unit<E: ::serde::de::Error>(
650                self,
651            ) -> ::core::result::Result<ErrorCode, E> {
652                ::core::result::Result::Ok(::core::default::Default::default())
653            }
654        }
655        d.deserialize_any(_V)
656    }
657}
658impl ::buffa::json_helpers::ProtoElemJson for ErrorCode {
659    fn serialize_proto_json<S: ::serde::Serializer>(
660        v: &Self,
661        s: S,
662    ) -> ::core::result::Result<S::Ok, S::Error> {
663        ::serde::Serialize::serialize(v, s)
664    }
665    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
666        d: D,
667    ) -> ::core::result::Result<Self, D::Error> {
668        <Self as ::serde::Deserialize>::deserialize(d)
669    }
670}
671impl ::buffa::Enumeration for ErrorCode {
672    fn from_i32(value: i32) -> ::core::option::Option<Self> {
673        match value {
674            0i32 => ::core::option::Option::Some(Self::ERROR_CODE_UNSPECIFIED),
675            1i32 => ::core::option::Option::Some(Self::ERROR_CODE_BAD_REQUEST),
676            2i32 => ::core::option::Option::Some(Self::ERROR_CODE_UNAUTHENTICATED),
677            3i32 => ::core::option::Option::Some(Self::ERROR_CODE_PERMISSION_DENIED),
678            4i32 => ::core::option::Option::Some(Self::ERROR_CODE_NOT_FOUND),
679            5i32 => ::core::option::Option::Some(Self::ERROR_CODE_MISSING_ACCOUNT_ID),
680            6i32 => ::core::option::Option::Some(Self::ERROR_CODE_INVALID_ACCOUNT_ID),
681            7i32 => ::core::option::Option::Some(Self::ERROR_CODE_MISSING_WALLET),
682            8i32 => {
683                ::core::option::Option::Some(
684                    Self::ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE,
685                )
686            }
687            9i32 => ::core::option::Option::Some(Self::ERROR_CODE_WALLET_NOT_FOUND),
688            10i32 => ::core::option::Option::Some(Self::ERROR_CODE_UPSTREAM_ERROR),
689            _ => ::core::option::Option::None,
690        }
691    }
692    fn to_i32(&self) -> i32 {
693        *self as i32
694    }
695    fn proto_name(&self) -> &'static str {
696        match self {
697            Self::ERROR_CODE_UNSPECIFIED => "ERROR_CODE_UNSPECIFIED",
698            Self::ERROR_CODE_BAD_REQUEST => "ERROR_CODE_BAD_REQUEST",
699            Self::ERROR_CODE_UNAUTHENTICATED => "ERROR_CODE_UNAUTHENTICATED",
700            Self::ERROR_CODE_PERMISSION_DENIED => "ERROR_CODE_PERMISSION_DENIED",
701            Self::ERROR_CODE_NOT_FOUND => "ERROR_CODE_NOT_FOUND",
702            Self::ERROR_CODE_MISSING_ACCOUNT_ID => "ERROR_CODE_MISSING_ACCOUNT_ID",
703            Self::ERROR_CODE_INVALID_ACCOUNT_ID => "ERROR_CODE_INVALID_ACCOUNT_ID",
704            Self::ERROR_CODE_MISSING_WALLET => "ERROR_CODE_MISSING_WALLET",
705            Self::ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE => {
706                "ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE"
707            }
708            Self::ERROR_CODE_WALLET_NOT_FOUND => "ERROR_CODE_WALLET_NOT_FOUND",
709            Self::ERROR_CODE_UPSTREAM_ERROR => "ERROR_CODE_UPSTREAM_ERROR",
710        }
711    }
712    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
713        match name {
714            "ERROR_CODE_UNSPECIFIED" => {
715                ::core::option::Option::Some(Self::ERROR_CODE_UNSPECIFIED)
716            }
717            "ERROR_CODE_BAD_REQUEST" => {
718                ::core::option::Option::Some(Self::ERROR_CODE_BAD_REQUEST)
719            }
720            "ERROR_CODE_UNAUTHENTICATED" => {
721                ::core::option::Option::Some(Self::ERROR_CODE_UNAUTHENTICATED)
722            }
723            "ERROR_CODE_PERMISSION_DENIED" => {
724                ::core::option::Option::Some(Self::ERROR_CODE_PERMISSION_DENIED)
725            }
726            "ERROR_CODE_NOT_FOUND" => {
727                ::core::option::Option::Some(Self::ERROR_CODE_NOT_FOUND)
728            }
729            "ERROR_CODE_MISSING_ACCOUNT_ID" => {
730                ::core::option::Option::Some(Self::ERROR_CODE_MISSING_ACCOUNT_ID)
731            }
732            "ERROR_CODE_INVALID_ACCOUNT_ID" => {
733                ::core::option::Option::Some(Self::ERROR_CODE_INVALID_ACCOUNT_ID)
734            }
735            "ERROR_CODE_MISSING_WALLET" => {
736                ::core::option::Option::Some(Self::ERROR_CODE_MISSING_WALLET)
737            }
738            "ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE" => {
739                ::core::option::Option::Some(
740                    Self::ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE,
741                )
742            }
743            "ERROR_CODE_WALLET_NOT_FOUND" => {
744                ::core::option::Option::Some(Self::ERROR_CODE_WALLET_NOT_FOUND)
745            }
746            "ERROR_CODE_UPSTREAM_ERROR" => {
747                ::core::option::Option::Some(Self::ERROR_CODE_UPSTREAM_ERROR)
748            }
749            _ => ::core::option::Option::None,
750        }
751    }
752    fn values() -> &'static [Self] {
753        &[
754            Self::ERROR_CODE_UNSPECIFIED,
755            Self::ERROR_CODE_BAD_REQUEST,
756            Self::ERROR_CODE_UNAUTHENTICATED,
757            Self::ERROR_CODE_PERMISSION_DENIED,
758            Self::ERROR_CODE_NOT_FOUND,
759            Self::ERROR_CODE_MISSING_ACCOUNT_ID,
760            Self::ERROR_CODE_INVALID_ACCOUNT_ID,
761            Self::ERROR_CODE_MISSING_WALLET,
762            Self::ERROR_CODE_WALLET_RESOLUTION_UNAVAILABLE,
763            Self::ERROR_CODE_WALLET_NOT_FOUND,
764            Self::ERROR_CODE_UPSTREAM_ERROR,
765        ]
766    }
767}
768/// Read surface for the Ledger (stable, versionable).
769///
770/// Canonical amounts are represented as integer quantities:
771/// - IDs: fixed64/uint32
772/// - Ledger amounts: U128 (hi/lo) at fixed 18-decimal scale
773/// - Chart series: scaled integer vectors (e.g. *_q) with field-specific scales
774///
775/// REST JSON responses render
776/// human-friendly decimal strings without duplicating REST message types here.
777#[derive(Clone, PartialEq, Default)]
778#[derive(::serde::Serialize, ::serde::Deserialize)]
779#[serde(default)]
780pub struct GetBalancesRequest {
781    /// Optional sub-account to scope balances to. If omitted, balances are
782    /// returned for the authenticated root account derived from the JWT or API
783    /// key. The logical account id itself is always derived from the caller's JWT
784    /// or API key, not from this payload.
785    ///
786    /// Field 1: `subaccount_id`
787    #[serde(
788        rename = "subaccountId",
789        alias = "subaccount_id",
790        with = "::buffa::json_helpers::opt_uint64",
791        skip_serializing_if = "::core::option::Option::is_none"
792    )]
793    pub subaccount_id: ::core::option::Option<u64>,
794    #[serde(skip)]
795    #[doc(hidden)]
796    pub __buffa_unknown_fields: ::buffa::UnknownFields,
797}
798impl ::core::fmt::Debug for GetBalancesRequest {
799    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
800        f.debug_struct("GetBalancesRequest")
801            .field("subaccount_id", &self.subaccount_id)
802            .finish()
803    }
804}
805impl GetBalancesRequest {
806    /// Protobuf type URL for this message, for use with `Any::pack` and
807    /// `Any::unpack_if`.
808    ///
809    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
810    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalancesRequest";
811}
812impl GetBalancesRequest {
813    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
814    #[inline]
815    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
816    pub fn with_subaccount_id(mut self, value: u64) -> Self {
817        self.subaccount_id = Some(value);
818        self
819    }
820}
821::buffa::impl_default_instance!(GetBalancesRequest);
822impl ::buffa::MessageName for GetBalancesRequest {
823    const PACKAGE: &'static str = "ledger.read.v1";
824    const NAME: &'static str = "GetBalancesRequest";
825    const FULL_NAME: &'static str = "ledger.read.v1.GetBalancesRequest";
826    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalancesRequest";
827}
828impl ::buffa::Message for GetBalancesRequest {
829    /// Returns the total encoded size in bytes.
830    ///
831    /// The result is a `u32`; the protobuf specification requires all
832    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
833    /// compliant message will never overflow this type.
834    #[allow(clippy::let_and_return)]
835    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
836        #[allow(unused_imports)]
837        use ::buffa::Enumeration as _;
838        let mut size = 0u32;
839        if self.subaccount_id.is_some() {
840            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
841        }
842        size += self.__buffa_unknown_fields.encoded_len() as u32;
843        size
844    }
845    fn write_to(
846        &self,
847        _cache: &mut ::buffa::SizeCache,
848        buf: &mut impl ::buffa::bytes::BufMut,
849    ) {
850        #[allow(unused_imports)]
851        use ::buffa::Enumeration as _;
852        if let Some(v) = self.subaccount_id {
853            ::buffa::types::put_fixed64_field(1u32, v, buf);
854        }
855        self.__buffa_unknown_fields.write_to(buf);
856    }
857    fn merge_field(
858        &mut self,
859        tag: ::buffa::encoding::Tag,
860        buf: &mut impl ::buffa::bytes::Buf,
861        ctx: ::buffa::DecodeContext<'_>,
862    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
863        #[allow(unused_imports)]
864        use ::buffa::bytes::Buf as _;
865        #[allow(unused_imports)]
866        use ::buffa::Enumeration as _;
867        match tag.field_number() {
868            1u32 => {
869                ::buffa::encoding::check_wire_type(
870                    tag,
871                    ::buffa::encoding::WireType::Fixed64,
872                )?;
873                self.subaccount_id = ::core::option::Option::Some(
874                    ::buffa::types::decode_fixed64(buf)?,
875                );
876            }
877            _ => {
878                self.__buffa_unknown_fields
879                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
880            }
881        }
882        ::core::result::Result::Ok(())
883    }
884    fn clear(&mut self) {
885        self.subaccount_id = ::core::option::Option::None;
886        self.__buffa_unknown_fields.clear();
887    }
888}
889impl ::buffa::ExtensionSet for GetBalancesRequest {
890    const PROTO_FQN: &'static str = "ledger.read.v1.GetBalancesRequest";
891    fn unknown_fields(&self) -> &::buffa::UnknownFields {
892        &self.__buffa_unknown_fields
893    }
894    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
895        &mut self.__buffa_unknown_fields
896    }
897}
898impl ::buffa::json_helpers::ProtoElemJson for GetBalancesRequest {
899    fn serialize_proto_json<S: ::serde::Serializer>(
900        v: &Self,
901        s: S,
902    ) -> ::core::result::Result<S::Ok, S::Error> {
903        ::serde::Serialize::serialize(v, s)
904    }
905    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
906        d: D,
907    ) -> ::core::result::Result<Self, D::Error> {
908        <Self as ::serde::Deserialize>::deserialize(d)
909    }
910}
911#[doc(hidden)]
912pub const __GET_BALANCES_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
913    type_url: "type.googleapis.com/ledger.read.v1.GetBalancesRequest",
914    to_json: ::buffa::type_registry::any_to_json::<GetBalancesRequest>,
915    from_json: ::buffa::type_registry::any_from_json::<GetBalancesRequest>,
916    is_wkt: false,
917};
918/// Fixed-size representation for balances (for Protobuf/WS clients).
919/// Uses common U128 messages for amounts to keep schema tidy and consistent.
920#[derive(Clone, PartialEq, Default)]
921#[derive(::serde::Serialize, ::serde::Deserialize)]
922#[serde(default)]
923pub struct AssetBalance {
924    /// Public unified asset id. Resolve symbol from SpotConfig; U128 amounts in
925    /// this message always use fixed 18-decimal ledger scale.
926    ///
927    /// Field 1: `asset_id`
928    #[serde(
929        rename = "assetId",
930        alias = "asset_id",
931        with = "::buffa::json_helpers::uint32",
932        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
933    )]
934    pub asset_id: u32,
935    /// Trading balance at fixed 18-decimal ledger scale.
936    ///
937    /// Field 2: `trading`
938    #[serde(
939        rename = "trading",
940        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
941    )]
942    pub trading: ::buffa::MessageField<super::super::super::polyester::r#type::v1::U128>,
943    /// Funding balance at fixed 18-decimal ledger scale.
944    ///
945    /// Field 3: `funding`
946    #[serde(
947        rename = "funding",
948        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
949    )]
950    pub funding: ::buffa::MessageField<super::super::super::polyester::r#type::v1::U128>,
951    /// Reserved amount in the trading bucket at fixed 18-decimal ledger scale.
952    ///
953    /// Field 4: `reserved`
954    #[serde(
955        rename = "reserved",
956        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
957    )]
958    pub reserved: ::buffa::MessageField<
959        super::super::super::polyester::r#type::v1::U128,
960    >,
961    /// Amount currently available for new trading activity at fixed 18-decimal
962    /// ledger scale. This value already accounts for active reservations.
963    ///
964    /// Field 5: `available`
965    #[serde(
966        rename = "available",
967        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
968    )]
969    pub available: ::buffa::MessageField<
970        super::super::super::polyester::r#type::v1::U128,
971    >,
972    /// Opaque monotonic revision for the atomic trading, reserved, and available
973    /// values. Higher means newer; zero means no trading state has been observed.
974    ///
975    /// Field 6: `trading_revision`
976    #[serde(
977        rename = "tradingRevision",
978        alias = "trading_revision",
979        with = "::buffa::json_helpers::uint64",
980        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
981    )]
982    pub trading_revision: u64,
983    /// Opaque monotonic revision for the funding value. Higher means newer; zero
984    /// means no funding state has been observed.
985    ///
986    /// Field 7: `funding_revision`
987    #[serde(
988        rename = "fundingRevision",
989        alias = "funding_revision",
990        with = "::buffa::json_helpers::uint64",
991        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
992    )]
993    pub funding_revision: u64,
994    #[serde(skip)]
995    #[doc(hidden)]
996    pub __buffa_unknown_fields: ::buffa::UnknownFields,
997}
998impl ::core::fmt::Debug for AssetBalance {
999    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1000        f.debug_struct("AssetBalance")
1001            .field("asset_id", &self.asset_id)
1002            .field("trading", &self.trading)
1003            .field("funding", &self.funding)
1004            .field("reserved", &self.reserved)
1005            .field("available", &self.available)
1006            .field("trading_revision", &self.trading_revision)
1007            .field("funding_revision", &self.funding_revision)
1008            .finish()
1009    }
1010}
1011impl AssetBalance {
1012    /// Protobuf type URL for this message, for use with `Any::pack` and
1013    /// `Any::unpack_if`.
1014    ///
1015    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1016    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AssetBalance";
1017}
1018::buffa::impl_default_instance!(AssetBalance);
1019impl ::buffa::MessageName for AssetBalance {
1020    const PACKAGE: &'static str = "ledger.read.v1";
1021    const NAME: &'static str = "AssetBalance";
1022    const FULL_NAME: &'static str = "ledger.read.v1.AssetBalance";
1023    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AssetBalance";
1024}
1025impl ::buffa::Message for AssetBalance {
1026    /// Returns the total encoded size in bytes.
1027    ///
1028    /// The result is a `u32`; the protobuf specification requires all
1029    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1030    /// compliant message will never overflow this type.
1031    #[allow(clippy::let_and_return)]
1032    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1033        #[allow(unused_imports)]
1034        use ::buffa::Enumeration as _;
1035        let mut size = 0u32;
1036        if self.asset_id != 0u32 {
1037            size += 1u32 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
1038        }
1039        if self.trading.is_set() {
1040            let __slot = __cache.reserve();
1041            let inner_size = self.trading.compute_size(__cache);
1042            __cache.set(__slot, inner_size);
1043            size
1044                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1045                    + inner_size;
1046        }
1047        if self.funding.is_set() {
1048            let __slot = __cache.reserve();
1049            let inner_size = self.funding.compute_size(__cache);
1050            __cache.set(__slot, inner_size);
1051            size
1052                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1053                    + inner_size;
1054        }
1055        if self.reserved.is_set() {
1056            let __slot = __cache.reserve();
1057            let inner_size = self.reserved.compute_size(__cache);
1058            __cache.set(__slot, inner_size);
1059            size
1060                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1061                    + inner_size;
1062        }
1063        if self.available.is_set() {
1064            let __slot = __cache.reserve();
1065            let inner_size = self.available.compute_size(__cache);
1066            __cache.set(__slot, inner_size);
1067            size
1068                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1069                    + inner_size;
1070        }
1071        if self.trading_revision != 0u64 {
1072            size
1073                += 1u32
1074                    + ::buffa::types::uint64_encoded_len(self.trading_revision) as u32;
1075        }
1076        if self.funding_revision != 0u64 {
1077            size
1078                += 1u32
1079                    + ::buffa::types::uint64_encoded_len(self.funding_revision) as u32;
1080        }
1081        size += self.__buffa_unknown_fields.encoded_len() as u32;
1082        size
1083    }
1084    fn write_to(
1085        &self,
1086        __cache: &mut ::buffa::SizeCache,
1087        buf: &mut impl ::buffa::bytes::BufMut,
1088    ) {
1089        #[allow(unused_imports)]
1090        use ::buffa::Enumeration as _;
1091        if self.asset_id != 0u32 {
1092            ::buffa::types::put_uint32_field(1u32, self.asset_id, buf);
1093        }
1094        if self.trading.is_set() {
1095            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
1096            self.trading.write_to(__cache, buf);
1097        }
1098        if self.funding.is_set() {
1099            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
1100            self.funding.write_to(__cache, buf);
1101        }
1102        if self.reserved.is_set() {
1103            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
1104            self.reserved.write_to(__cache, buf);
1105        }
1106        if self.available.is_set() {
1107            ::buffa::types::put_len_delimited_header(5u32, __cache.consume_next(), buf);
1108            self.available.write_to(__cache, buf);
1109        }
1110        if self.trading_revision != 0u64 {
1111            ::buffa::types::put_uint64_field(6u32, self.trading_revision, buf);
1112        }
1113        if self.funding_revision != 0u64 {
1114            ::buffa::types::put_uint64_field(7u32, self.funding_revision, buf);
1115        }
1116        self.__buffa_unknown_fields.write_to(buf);
1117    }
1118    fn merge_field(
1119        &mut self,
1120        tag: ::buffa::encoding::Tag,
1121        buf: &mut impl ::buffa::bytes::Buf,
1122        ctx: ::buffa::DecodeContext<'_>,
1123    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1124        #[allow(unused_imports)]
1125        use ::buffa::bytes::Buf as _;
1126        #[allow(unused_imports)]
1127        use ::buffa::Enumeration as _;
1128        match tag.field_number() {
1129            1u32 => {
1130                ::buffa::encoding::check_wire_type(
1131                    tag,
1132                    ::buffa::encoding::WireType::Varint,
1133                )?;
1134                self.asset_id = ::buffa::types::decode_uint32(buf)?;
1135            }
1136            2u32 => {
1137                ::buffa::encoding::check_wire_type(
1138                    tag,
1139                    ::buffa::encoding::WireType::LengthDelimited,
1140                )?;
1141                ::buffa::Message::merge_length_delimited(
1142                    self.trading.get_or_insert_default(),
1143                    buf,
1144                    ctx,
1145                )?;
1146            }
1147            3u32 => {
1148                ::buffa::encoding::check_wire_type(
1149                    tag,
1150                    ::buffa::encoding::WireType::LengthDelimited,
1151                )?;
1152                ::buffa::Message::merge_length_delimited(
1153                    self.funding.get_or_insert_default(),
1154                    buf,
1155                    ctx,
1156                )?;
1157            }
1158            4u32 => {
1159                ::buffa::encoding::check_wire_type(
1160                    tag,
1161                    ::buffa::encoding::WireType::LengthDelimited,
1162                )?;
1163                ::buffa::Message::merge_length_delimited(
1164                    self.reserved.get_or_insert_default(),
1165                    buf,
1166                    ctx,
1167                )?;
1168            }
1169            5u32 => {
1170                ::buffa::encoding::check_wire_type(
1171                    tag,
1172                    ::buffa::encoding::WireType::LengthDelimited,
1173                )?;
1174                ::buffa::Message::merge_length_delimited(
1175                    self.available.get_or_insert_default(),
1176                    buf,
1177                    ctx,
1178                )?;
1179            }
1180            6u32 => {
1181                ::buffa::encoding::check_wire_type(
1182                    tag,
1183                    ::buffa::encoding::WireType::Varint,
1184                )?;
1185                self.trading_revision = ::buffa::types::decode_uint64(buf)?;
1186            }
1187            7u32 => {
1188                ::buffa::encoding::check_wire_type(
1189                    tag,
1190                    ::buffa::encoding::WireType::Varint,
1191                )?;
1192                self.funding_revision = ::buffa::types::decode_uint64(buf)?;
1193            }
1194            _ => {
1195                self.__buffa_unknown_fields
1196                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1197            }
1198        }
1199        ::core::result::Result::Ok(())
1200    }
1201    fn clear(&mut self) {
1202        self.asset_id = 0u32;
1203        self.trading = ::buffa::MessageField::none();
1204        self.funding = ::buffa::MessageField::none();
1205        self.reserved = ::buffa::MessageField::none();
1206        self.available = ::buffa::MessageField::none();
1207        self.trading_revision = 0u64;
1208        self.funding_revision = 0u64;
1209        self.__buffa_unknown_fields.clear();
1210    }
1211}
1212impl ::buffa::ExtensionSet for AssetBalance {
1213    const PROTO_FQN: &'static str = "ledger.read.v1.AssetBalance";
1214    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1215        &self.__buffa_unknown_fields
1216    }
1217    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1218        &mut self.__buffa_unknown_fields
1219    }
1220}
1221impl ::buffa::json_helpers::ProtoElemJson for AssetBalance {
1222    fn serialize_proto_json<S: ::serde::Serializer>(
1223        v: &Self,
1224        s: S,
1225    ) -> ::core::result::Result<S::Ok, S::Error> {
1226        ::serde::Serialize::serialize(v, s)
1227    }
1228    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1229        d: D,
1230    ) -> ::core::result::Result<Self, D::Error> {
1231        <Self as ::serde::Deserialize>::deserialize(d)
1232    }
1233}
1234#[doc(hidden)]
1235pub const __ASSET_BALANCE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1236    type_url: "type.googleapis.com/ledger.read.v1.AssetBalance",
1237    to_json: ::buffa::type_registry::any_to_json::<AssetBalance>,
1238    from_json: ::buffa::type_registry::any_from_json::<AssetBalance>,
1239    is_wkt: false,
1240};
1241#[derive(Clone, PartialEq, Default)]
1242#[derive(::serde::Serialize, ::serde::Deserialize)]
1243#[serde(default)]
1244pub struct GetBalancesResponse {
1245    /// One entry for every supported unified asset, including assets with zero
1246    /// balances. Sorted by available trading amount (highest first), then by
1247    /// asset symbol alphabetically.
1248    ///
1249    /// Field 1: `balances`
1250    #[serde(
1251        rename = "balances",
1252        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1253        deserialize_with = "::buffa::json_helpers::null_as_default"
1254    )]
1255    pub balances: ::buffa::alloc::vec::Vec<AssetBalance>,
1256    #[serde(skip)]
1257    #[doc(hidden)]
1258    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1259}
1260impl ::core::fmt::Debug for GetBalancesResponse {
1261    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1262        f.debug_struct("GetBalancesResponse").field("balances", &self.balances).finish()
1263    }
1264}
1265impl GetBalancesResponse {
1266    /// Protobuf type URL for this message, for use with `Any::pack` and
1267    /// `Any::unpack_if`.
1268    ///
1269    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1270    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalancesResponse";
1271}
1272::buffa::impl_default_instance!(GetBalancesResponse);
1273impl ::buffa::MessageName for GetBalancesResponse {
1274    const PACKAGE: &'static str = "ledger.read.v1";
1275    const NAME: &'static str = "GetBalancesResponse";
1276    const FULL_NAME: &'static str = "ledger.read.v1.GetBalancesResponse";
1277    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalancesResponse";
1278}
1279impl ::buffa::Message for GetBalancesResponse {
1280    /// Returns the total encoded size in bytes.
1281    ///
1282    /// The result is a `u32`; the protobuf specification requires all
1283    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1284    /// compliant message will never overflow this type.
1285    #[allow(clippy::let_and_return)]
1286    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1287        #[allow(unused_imports)]
1288        use ::buffa::Enumeration as _;
1289        let mut size = 0u32;
1290        for v in &self.balances {
1291            let __slot = __cache.reserve();
1292            let inner_size = v.compute_size(__cache);
1293            __cache.set(__slot, inner_size);
1294            size
1295                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1296                    + inner_size;
1297        }
1298        size += self.__buffa_unknown_fields.encoded_len() as u32;
1299        size
1300    }
1301    fn write_to(
1302        &self,
1303        __cache: &mut ::buffa::SizeCache,
1304        buf: &mut impl ::buffa::bytes::BufMut,
1305    ) {
1306        #[allow(unused_imports)]
1307        use ::buffa::Enumeration as _;
1308        for v in &self.balances {
1309            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
1310            v.write_to(__cache, buf);
1311        }
1312        self.__buffa_unknown_fields.write_to(buf);
1313    }
1314    fn merge_field(
1315        &mut self,
1316        tag: ::buffa::encoding::Tag,
1317        buf: &mut impl ::buffa::bytes::Buf,
1318        ctx: ::buffa::DecodeContext<'_>,
1319    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1320        #[allow(unused_imports)]
1321        use ::buffa::bytes::Buf as _;
1322        #[allow(unused_imports)]
1323        use ::buffa::Enumeration as _;
1324        match tag.field_number() {
1325            1u32 => {
1326                ::buffa::encoding::check_wire_type(
1327                    tag,
1328                    ::buffa::encoding::WireType::LengthDelimited,
1329                )?;
1330                let mut elem = ::core::default::Default::default();
1331                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
1332                self.balances.push(elem);
1333            }
1334            _ => {
1335                self.__buffa_unknown_fields
1336                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1337            }
1338        }
1339        ::core::result::Result::Ok(())
1340    }
1341    fn clear(&mut self) {
1342        self.balances.clear();
1343        self.__buffa_unknown_fields.clear();
1344    }
1345}
1346impl ::buffa::ExtensionSet for GetBalancesResponse {
1347    const PROTO_FQN: &'static str = "ledger.read.v1.GetBalancesResponse";
1348    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1349        &self.__buffa_unknown_fields
1350    }
1351    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1352        &mut self.__buffa_unknown_fields
1353    }
1354}
1355impl ::buffa::json_helpers::ProtoElemJson for GetBalancesResponse {
1356    fn serialize_proto_json<S: ::serde::Serializer>(
1357        v: &Self,
1358        s: S,
1359    ) -> ::core::result::Result<S::Ok, S::Error> {
1360        ::serde::Serialize::serialize(v, s)
1361    }
1362    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1363        d: D,
1364    ) -> ::core::result::Result<Self, D::Error> {
1365        <Self as ::serde::Deserialize>::deserialize(d)
1366    }
1367}
1368#[doc(hidden)]
1369pub const __GET_BALANCES_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1370    type_url: "type.googleapis.com/ledger.read.v1.GetBalancesResponse",
1371    to_json: ::buffa::type_registry::any_to_json::<GetBalancesResponse>,
1372    from_json: ::buffa::type_registry::any_from_json::<GetBalancesResponse>,
1373    is_wkt: false,
1374};
1375#[derive(Clone, PartialEq, Default)]
1376#[derive(::serde::Serialize, ::serde::Deserialize)]
1377#[serde(default)]
1378pub struct GetBalanceHistoryRequest {
1379    /// Optional sub-account to scope balances to. If omitted, balances are
1380    /// returned for the authenticated root account derived from the JWT or API
1381    /// key. The logical account id itself is always derived from the caller's JWT
1382    /// or API key, not from this payload.
1383    ///
1384    /// Field 1: `subaccount_id`
1385    #[serde(
1386        rename = "subaccountId",
1387        alias = "subaccount_id",
1388        with = "::buffa::json_helpers::opt_uint64",
1389        skip_serializing_if = "::core::option::Option::is_none"
1390    )]
1391    pub subaccount_id: ::core::option::Option<u64>,
1392    /// History window to return. When unset/UNSPECIFIED, defaults to 1D.
1393    ///
1394    /// Field 2: `range`
1395    #[serde(
1396        rename = "range",
1397        with = "::buffa::json_helpers::proto_enum",
1398        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
1399    )]
1400    pub range: ::buffa::EnumValue<BalanceRange>,
1401    /// Optional public asset filter. When unset/0, returns all assets.
1402    ///
1403    /// Field 3: `ledger`
1404    #[serde(
1405        rename = "ledger",
1406        with = "::buffa::json_helpers::uint32",
1407        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
1408    )]
1409    pub ledger: u32,
1410    /// Optional subset of account buckets to return. When empty, returns all
1411    /// account buckets.
1412    ///
1413    /// Field 4: `account_codes`
1414    #[serde(
1415        rename = "accountCodes",
1416        alias = "account_codes",
1417        with = "::buffa::json_helpers::repeated_enum",
1418        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
1419    )]
1420    pub account_codes: ::buffa::alloc::vec::Vec<
1421        ::buffa::EnumValue<super::super::v1::AccountCode>,
1422    >,
1423    #[serde(skip)]
1424    #[doc(hidden)]
1425    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1426}
1427impl ::core::fmt::Debug for GetBalanceHistoryRequest {
1428    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1429        f.debug_struct("GetBalanceHistoryRequest")
1430            .field("subaccount_id", &self.subaccount_id)
1431            .field("range", &self.range)
1432            .field("ledger", &self.ledger)
1433            .field("account_codes", &self.account_codes)
1434            .finish()
1435    }
1436}
1437impl GetBalanceHistoryRequest {
1438    /// Protobuf type URL for this message, for use with `Any::pack` and
1439    /// `Any::unpack_if`.
1440    ///
1441    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1442    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalanceHistoryRequest";
1443}
1444impl GetBalanceHistoryRequest {
1445    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1446    #[inline]
1447    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
1448    pub fn with_subaccount_id(mut self, value: u64) -> Self {
1449        self.subaccount_id = Some(value);
1450        self
1451    }
1452}
1453::buffa::impl_default_instance!(GetBalanceHistoryRequest);
1454impl ::buffa::MessageName for GetBalanceHistoryRequest {
1455    const PACKAGE: &'static str = "ledger.read.v1";
1456    const NAME: &'static str = "GetBalanceHistoryRequest";
1457    const FULL_NAME: &'static str = "ledger.read.v1.GetBalanceHistoryRequest";
1458    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalanceHistoryRequest";
1459}
1460impl ::buffa::Message for GetBalanceHistoryRequest {
1461    /// Returns the total encoded size in bytes.
1462    ///
1463    /// The result is a `u32`; the protobuf specification requires all
1464    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1465    /// compliant message will never overflow this type.
1466    #[allow(clippy::let_and_return)]
1467    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1468        #[allow(unused_imports)]
1469        use ::buffa::Enumeration as _;
1470        let mut size = 0u32;
1471        if self.subaccount_id.is_some() {
1472            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
1473        }
1474        {
1475            let val = self.range.to_i32();
1476            if val != 0 {
1477                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1478            }
1479        }
1480        if self.ledger != 0u32 {
1481            size += 1u32 + ::buffa::types::uint32_encoded_len(self.ledger) as u32;
1482        }
1483        if !self.account_codes.is_empty() {
1484            let payload: u32 = self
1485                .account_codes
1486                .iter()
1487                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
1488                .sum::<u32>();
1489            size
1490                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
1491        }
1492        size += self.__buffa_unknown_fields.encoded_len() as u32;
1493        size
1494    }
1495    fn write_to(
1496        &self,
1497        _cache: &mut ::buffa::SizeCache,
1498        buf: &mut impl ::buffa::bytes::BufMut,
1499    ) {
1500        #[allow(unused_imports)]
1501        use ::buffa::Enumeration as _;
1502        if let Some(v) = self.subaccount_id {
1503            ::buffa::types::put_fixed64_field(1u32, v, buf);
1504        }
1505        {
1506            let val = self.range.to_i32();
1507            if val != 0 {
1508                ::buffa::types::put_int32_field(2u32, val, buf);
1509            }
1510        }
1511        if self.ledger != 0u32 {
1512            ::buffa::types::put_uint32_field(3u32, self.ledger, buf);
1513        }
1514        if !self.account_codes.is_empty() {
1515            let payload: u32 = self
1516                .account_codes
1517                .iter()
1518                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
1519                .sum::<u32>();
1520            ::buffa::types::put_len_delimited_header(4u32, payload, buf);
1521            for v in &self.account_codes {
1522                ::buffa::types::encode_int32(v.to_i32(), buf);
1523            }
1524        }
1525        self.__buffa_unknown_fields.write_to(buf);
1526    }
1527    fn merge_field(
1528        &mut self,
1529        tag: ::buffa::encoding::Tag,
1530        buf: &mut impl ::buffa::bytes::Buf,
1531        ctx: ::buffa::DecodeContext<'_>,
1532    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1533        #[allow(unused_imports)]
1534        use ::buffa::bytes::Buf as _;
1535        #[allow(unused_imports)]
1536        use ::buffa::Enumeration as _;
1537        match tag.field_number() {
1538            1u32 => {
1539                ::buffa::encoding::check_wire_type(
1540                    tag,
1541                    ::buffa::encoding::WireType::Fixed64,
1542                )?;
1543                self.subaccount_id = ::core::option::Option::Some(
1544                    ::buffa::types::decode_fixed64(buf)?,
1545                );
1546            }
1547            2u32 => {
1548                ::buffa::encoding::check_wire_type(
1549                    tag,
1550                    ::buffa::encoding::WireType::Varint,
1551                )?;
1552                self.range = ::buffa::EnumValue::from(
1553                    ::buffa::types::decode_int32(buf)?,
1554                );
1555            }
1556            3u32 => {
1557                ::buffa::encoding::check_wire_type(
1558                    tag,
1559                    ::buffa::encoding::WireType::Varint,
1560                )?;
1561                self.ledger = ::buffa::types::decode_uint32(buf)?;
1562            }
1563            4u32 => {
1564                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1565                    let len = ::buffa::encoding::decode_varint(buf)?;
1566                    let len = usize::try_from(len)
1567                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1568                    if buf.remaining() < len {
1569                        return ::core::result::Result::Err(
1570                            ::buffa::DecodeError::UnexpectedEof,
1571                        );
1572                    }
1573                    self.account_codes.reserve(len);
1574                    let mut limited = buf.take(len);
1575                    while limited.has_remaining() {
1576                        self.account_codes
1577                            .push(
1578                                ::buffa::EnumValue::from(
1579                                    ::buffa::types::decode_int32(&mut limited)?,
1580                                ),
1581                            );
1582                    }
1583                    let leftover = limited.remaining();
1584                    if leftover > 0 {
1585                        limited.advance(leftover);
1586                    }
1587                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1588                    self.account_codes
1589                        .push(
1590                            ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
1591                        );
1592                } else {
1593                    return ::core::result::Result::Err(
1594                        ::buffa::encoding::wire_type_mismatch(
1595                            tag,
1596                            ::buffa::encoding::WireType::LengthDelimited,
1597                        ),
1598                    );
1599                }
1600            }
1601            _ => {
1602                self.__buffa_unknown_fields
1603                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1604            }
1605        }
1606        ::core::result::Result::Ok(())
1607    }
1608    fn clear(&mut self) {
1609        self.subaccount_id = ::core::option::Option::None;
1610        self.range = ::buffa::EnumValue::from(0);
1611        self.ledger = 0u32;
1612        self.account_codes.clear();
1613        self.__buffa_unknown_fields.clear();
1614    }
1615}
1616impl ::buffa::ExtensionSet for GetBalanceHistoryRequest {
1617    const PROTO_FQN: &'static str = "ledger.read.v1.GetBalanceHistoryRequest";
1618    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1619        &self.__buffa_unknown_fields
1620    }
1621    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1622        &mut self.__buffa_unknown_fields
1623    }
1624}
1625impl ::buffa::json_helpers::ProtoElemJson for GetBalanceHistoryRequest {
1626    fn serialize_proto_json<S: ::serde::Serializer>(
1627        v: &Self,
1628        s: S,
1629    ) -> ::core::result::Result<S::Ok, S::Error> {
1630        ::serde::Serialize::serialize(v, s)
1631    }
1632    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1633        d: D,
1634    ) -> ::core::result::Result<Self, D::Error> {
1635        <Self as ::serde::Deserialize>::deserialize(d)
1636    }
1637}
1638#[doc(hidden)]
1639pub const __GET_BALANCE_HISTORY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1640    type_url: "type.googleapis.com/ledger.read.v1.GetBalanceHistoryRequest",
1641    to_json: ::buffa::type_registry::any_to_json::<GetBalanceHistoryRequest>,
1642    from_json: ::buffa::type_registry::any_from_json::<GetBalanceHistoryRequest>,
1643    is_wkt: false,
1644};
1645/// Columnar balance series payload (scaled integers).
1646/// REST renders decimal strings from these values.
1647#[derive(Clone, PartialEq, Default)]
1648#[derive(::serde::Serialize, ::serde::Deserialize)]
1649#[serde(default)]
1650pub struct BalanceSeries {
1651    /// public unified asset id
1652    ///
1653    /// Field 1: `asset_id`
1654    #[serde(
1655        rename = "assetId",
1656        alias = "asset_id",
1657        with = "::buffa::json_helpers::uint32",
1658        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
1659    )]
1660    pub asset_id: u32,
1661    /// account bucket
1662    ///
1663    /// Field 2: `account_code`
1664    #[serde(
1665        rename = "accountCode",
1666        alias = "account_code",
1667        with = "::buffa::json_helpers::proto_enum",
1668        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
1669    )]
1670    pub account_code: ::buffa::EnumValue<super::super::v1::AccountCode>,
1671    /// Chart balance in asset units scaled by 1e7 (7 decimals).
1672    /// Values are downscaled from 18-decimal ledger balances for compact charting
1673    /// and align 1:1 with implicit timestamps.
1674    ///
1675    /// Field 3: `balance_q`
1676    #[serde(
1677        rename = "balanceQ",
1678        alias = "balance_q",
1679        with = "::buffa::json_helpers::proto_seq",
1680        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
1681    )]
1682    pub balance_q: ::buffa::alloc::vec::Vec<u64>,
1683    #[serde(skip)]
1684    #[doc(hidden)]
1685    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1686}
1687impl ::core::fmt::Debug for BalanceSeries {
1688    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1689        f.debug_struct("BalanceSeries")
1690            .field("asset_id", &self.asset_id)
1691            .field("account_code", &self.account_code)
1692            .field("balance_q", &self.balance_q)
1693            .finish()
1694    }
1695}
1696impl BalanceSeries {
1697    /// Protobuf type URL for this message, for use with `Any::pack` and
1698    /// `Any::unpack_if`.
1699    ///
1700    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1701    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.BalanceSeries";
1702}
1703::buffa::impl_default_instance!(BalanceSeries);
1704impl ::buffa::MessageName for BalanceSeries {
1705    const PACKAGE: &'static str = "ledger.read.v1";
1706    const NAME: &'static str = "BalanceSeries";
1707    const FULL_NAME: &'static str = "ledger.read.v1.BalanceSeries";
1708    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.BalanceSeries";
1709}
1710impl ::buffa::Message for BalanceSeries {
1711    /// Returns the total encoded size in bytes.
1712    ///
1713    /// The result is a `u32`; the protobuf specification requires all
1714    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1715    /// compliant message will never overflow this type.
1716    #[allow(clippy::let_and_return)]
1717    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1718        #[allow(unused_imports)]
1719        use ::buffa::Enumeration as _;
1720        let mut size = 0u32;
1721        if self.asset_id != 0u32 {
1722            size += 1u32 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
1723        }
1724        {
1725            let val = self.account_code.to_i32();
1726            if val != 0 {
1727                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1728            }
1729        }
1730        if !self.balance_q.is_empty() {
1731            let payload: u32 = self
1732                .balance_q
1733                .iter()
1734                .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
1735                .sum::<u32>();
1736            size
1737                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
1738        }
1739        size += self.__buffa_unknown_fields.encoded_len() as u32;
1740        size
1741    }
1742    fn write_to(
1743        &self,
1744        _cache: &mut ::buffa::SizeCache,
1745        buf: &mut impl ::buffa::bytes::BufMut,
1746    ) {
1747        #[allow(unused_imports)]
1748        use ::buffa::Enumeration as _;
1749        if self.asset_id != 0u32 {
1750            ::buffa::types::put_uint32_field(1u32, self.asset_id, buf);
1751        }
1752        {
1753            let val = self.account_code.to_i32();
1754            if val != 0 {
1755                ::buffa::types::put_int32_field(2u32, val, buf);
1756            }
1757        }
1758        if !self.balance_q.is_empty() {
1759            let payload: u32 = self
1760                .balance_q
1761                .iter()
1762                .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
1763                .sum::<u32>();
1764            ::buffa::types::put_len_delimited_header(3u32, payload, buf);
1765            for &v in &self.balance_q {
1766                ::buffa::types::encode_uint64(v, buf);
1767            }
1768        }
1769        self.__buffa_unknown_fields.write_to(buf);
1770    }
1771    fn merge_field(
1772        &mut self,
1773        tag: ::buffa::encoding::Tag,
1774        buf: &mut impl ::buffa::bytes::Buf,
1775        ctx: ::buffa::DecodeContext<'_>,
1776    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1777        #[allow(unused_imports)]
1778        use ::buffa::bytes::Buf as _;
1779        #[allow(unused_imports)]
1780        use ::buffa::Enumeration as _;
1781        match tag.field_number() {
1782            1u32 => {
1783                ::buffa::encoding::check_wire_type(
1784                    tag,
1785                    ::buffa::encoding::WireType::Varint,
1786                )?;
1787                self.asset_id = ::buffa::types::decode_uint32(buf)?;
1788            }
1789            2u32 => {
1790                ::buffa::encoding::check_wire_type(
1791                    tag,
1792                    ::buffa::encoding::WireType::Varint,
1793                )?;
1794                self.account_code = ::buffa::EnumValue::from(
1795                    ::buffa::types::decode_int32(buf)?,
1796                );
1797            }
1798            3u32 => {
1799                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1800                    let len = ::buffa::encoding::decode_varint(buf)?;
1801                    let len = usize::try_from(len)
1802                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1803                    if buf.remaining() < len {
1804                        return ::core::result::Result::Err(
1805                            ::buffa::DecodeError::UnexpectedEof,
1806                        );
1807                    }
1808                    self.balance_q.reserve(len);
1809                    let mut limited = buf.take(len);
1810                    while limited.has_remaining() {
1811                        self.balance_q
1812                            .push(::buffa::types::decode_uint64(&mut limited)?);
1813                    }
1814                    let leftover = limited.remaining();
1815                    if leftover > 0 {
1816                        limited.advance(leftover);
1817                    }
1818                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1819                    self.balance_q.push(::buffa::types::decode_uint64(buf)?);
1820                } else {
1821                    return ::core::result::Result::Err(
1822                        ::buffa::encoding::wire_type_mismatch(
1823                            tag,
1824                            ::buffa::encoding::WireType::LengthDelimited,
1825                        ),
1826                    );
1827                }
1828            }
1829            _ => {
1830                self.__buffa_unknown_fields
1831                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1832            }
1833        }
1834        ::core::result::Result::Ok(())
1835    }
1836    fn clear(&mut self) {
1837        self.asset_id = 0u32;
1838        self.account_code = ::buffa::EnumValue::from(0);
1839        self.balance_q.clear();
1840        self.__buffa_unknown_fields.clear();
1841    }
1842}
1843impl ::buffa::ExtensionSet for BalanceSeries {
1844    const PROTO_FQN: &'static str = "ledger.read.v1.BalanceSeries";
1845    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1846        &self.__buffa_unknown_fields
1847    }
1848    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1849        &mut self.__buffa_unknown_fields
1850    }
1851}
1852impl ::buffa::json_helpers::ProtoElemJson for BalanceSeries {
1853    fn serialize_proto_json<S: ::serde::Serializer>(
1854        v: &Self,
1855        s: S,
1856    ) -> ::core::result::Result<S::Ok, S::Error> {
1857        ::serde::Serialize::serialize(v, s)
1858    }
1859    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1860        d: D,
1861    ) -> ::core::result::Result<Self, D::Error> {
1862        <Self as ::serde::Deserialize>::deserialize(d)
1863    }
1864}
1865#[doc(hidden)]
1866pub const __BALANCE_SERIES_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1867    type_url: "type.googleapis.com/ledger.read.v1.BalanceSeries",
1868    to_json: ::buffa::type_registry::any_to_json::<BalanceSeries>,
1869    from_json: ::buffa::type_registry::any_from_json::<BalanceSeries>,
1870    is_wkt: false,
1871};
1872/// GetBalanceHistoryResponse returns aligned balance chart series.
1873#[derive(Clone, PartialEq, Default)]
1874#[derive(::serde::Serialize, ::serde::Deserialize)]
1875#[serde(default)]
1876pub struct GetBalanceHistoryResponse {
1877    /// Resolved history window.
1878    ///
1879    /// Field 1: `range`
1880    #[serde(
1881        rename = "range",
1882        with = "::buffa::json_helpers::proto_enum",
1883        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
1884    )]
1885    pub range: ::buffa::EnumValue<BalanceRange>,
1886    /// Sampling interval between points, such as "5m" or "1h".
1887    ///
1888    /// Field 2: `bucket`
1889    #[serde(
1890        rename = "bucket",
1891        with = "::buffa::json_helpers::proto_string",
1892        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1893    )]
1894    pub bucket: ::buffa::alloc::string::String,
1895    /// First point timestamp in seconds since epoch (UTC).
1896    ///
1897    /// Field 3: `start_ts_sec`
1898    #[serde(
1899        rename = "startTsSec",
1900        alias = "start_ts_sec",
1901        with = "::buffa::json_helpers::uint32",
1902        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
1903    )]
1904    pub start_ts_sec: u32,
1905    /// Last point timestamp in seconds since epoch (UTC).
1906    ///
1907    /// Field 4: `end_ts_sec`
1908    #[serde(
1909        rename = "endTsSec",
1910        alias = "end_ts_sec",
1911        with = "::buffa::json_helpers::uint32",
1912        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
1913    )]
1914    pub end_ts_sec: u32,
1915    /// Number of aligned points in each returned series.
1916    ///
1917    /// Field 5: `points`
1918    #[serde(
1919        rename = "points",
1920        with = "::buffa::json_helpers::uint32",
1921        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
1922    )]
1923    pub points: u32,
1924    /// Balance series ordered by asset ID, then account bucket.
1925    ///
1926    /// Field 6: `series`
1927    #[serde(
1928        rename = "series",
1929        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1930        deserialize_with = "::buffa::json_helpers::null_as_default"
1931    )]
1932    pub series: ::buffa::alloc::vec::Vec<BalanceSeries>,
1933    #[serde(skip)]
1934    #[doc(hidden)]
1935    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1936}
1937impl ::core::fmt::Debug for GetBalanceHistoryResponse {
1938    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1939        f.debug_struct("GetBalanceHistoryResponse")
1940            .field("range", &self.range)
1941            .field("bucket", &self.bucket)
1942            .field("start_ts_sec", &self.start_ts_sec)
1943            .field("end_ts_sec", &self.end_ts_sec)
1944            .field("points", &self.points)
1945            .field("series", &self.series)
1946            .finish()
1947    }
1948}
1949impl GetBalanceHistoryResponse {
1950    /// Protobuf type URL for this message, for use with `Any::pack` and
1951    /// `Any::unpack_if`.
1952    ///
1953    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1954    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalanceHistoryResponse";
1955}
1956::buffa::impl_default_instance!(GetBalanceHistoryResponse);
1957impl ::buffa::MessageName for GetBalanceHistoryResponse {
1958    const PACKAGE: &'static str = "ledger.read.v1";
1959    const NAME: &'static str = "GetBalanceHistoryResponse";
1960    const FULL_NAME: &'static str = "ledger.read.v1.GetBalanceHistoryResponse";
1961    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalanceHistoryResponse";
1962}
1963impl ::buffa::Message for GetBalanceHistoryResponse {
1964    /// Returns the total encoded size in bytes.
1965    ///
1966    /// The result is a `u32`; the protobuf specification requires all
1967    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1968    /// compliant message will never overflow this type.
1969    #[allow(clippy::let_and_return)]
1970    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1971        #[allow(unused_imports)]
1972        use ::buffa::Enumeration as _;
1973        let mut size = 0u32;
1974        {
1975            let val = self.range.to_i32();
1976            if val != 0 {
1977                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1978            }
1979        }
1980        if !self.bucket.is_empty() {
1981            size += 1u32 + ::buffa::types::string_encoded_len(&self.bucket) as u32;
1982        }
1983        if self.start_ts_sec != 0u32 {
1984            size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
1985        }
1986        if self.end_ts_sec != 0u32 {
1987            size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
1988        }
1989        if self.points != 0u32 {
1990            size += 1u32 + ::buffa::types::uint32_encoded_len(self.points) as u32;
1991        }
1992        for v in &self.series {
1993            let __slot = __cache.reserve();
1994            let inner_size = v.compute_size(__cache);
1995            __cache.set(__slot, inner_size);
1996            size
1997                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1998                    + inner_size;
1999        }
2000        size += self.__buffa_unknown_fields.encoded_len() as u32;
2001        size
2002    }
2003    fn write_to(
2004        &self,
2005        __cache: &mut ::buffa::SizeCache,
2006        buf: &mut impl ::buffa::bytes::BufMut,
2007    ) {
2008        #[allow(unused_imports)]
2009        use ::buffa::Enumeration as _;
2010        {
2011            let val = self.range.to_i32();
2012            if val != 0 {
2013                ::buffa::types::put_int32_field(1u32, val, buf);
2014            }
2015        }
2016        if !self.bucket.is_empty() {
2017            ::buffa::types::put_string_field(2u32, &self.bucket, buf);
2018        }
2019        if self.start_ts_sec != 0u32 {
2020            ::buffa::types::put_fixed32_field(3u32, self.start_ts_sec, buf);
2021        }
2022        if self.end_ts_sec != 0u32 {
2023            ::buffa::types::put_fixed32_field(4u32, self.end_ts_sec, buf);
2024        }
2025        if self.points != 0u32 {
2026            ::buffa::types::put_uint32_field(5u32, self.points, buf);
2027        }
2028        for v in &self.series {
2029            ::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf);
2030            v.write_to(__cache, buf);
2031        }
2032        self.__buffa_unknown_fields.write_to(buf);
2033    }
2034    fn merge_field(
2035        &mut self,
2036        tag: ::buffa::encoding::Tag,
2037        buf: &mut impl ::buffa::bytes::Buf,
2038        ctx: ::buffa::DecodeContext<'_>,
2039    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2040        #[allow(unused_imports)]
2041        use ::buffa::bytes::Buf as _;
2042        #[allow(unused_imports)]
2043        use ::buffa::Enumeration as _;
2044        match tag.field_number() {
2045            1u32 => {
2046                ::buffa::encoding::check_wire_type(
2047                    tag,
2048                    ::buffa::encoding::WireType::Varint,
2049                )?;
2050                self.range = ::buffa::EnumValue::from(
2051                    ::buffa::types::decode_int32(buf)?,
2052                );
2053            }
2054            2u32 => {
2055                ::buffa::encoding::check_wire_type(
2056                    tag,
2057                    ::buffa::encoding::WireType::LengthDelimited,
2058                )?;
2059                ::buffa::types::merge_string(&mut self.bucket, buf)?;
2060            }
2061            3u32 => {
2062                ::buffa::encoding::check_wire_type(
2063                    tag,
2064                    ::buffa::encoding::WireType::Fixed32,
2065                )?;
2066                self.start_ts_sec = ::buffa::types::decode_fixed32(buf)?;
2067            }
2068            4u32 => {
2069                ::buffa::encoding::check_wire_type(
2070                    tag,
2071                    ::buffa::encoding::WireType::Fixed32,
2072                )?;
2073                self.end_ts_sec = ::buffa::types::decode_fixed32(buf)?;
2074            }
2075            5u32 => {
2076                ::buffa::encoding::check_wire_type(
2077                    tag,
2078                    ::buffa::encoding::WireType::Varint,
2079                )?;
2080                self.points = ::buffa::types::decode_uint32(buf)?;
2081            }
2082            6u32 => {
2083                ::buffa::encoding::check_wire_type(
2084                    tag,
2085                    ::buffa::encoding::WireType::LengthDelimited,
2086                )?;
2087                let mut elem = ::core::default::Default::default();
2088                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
2089                self.series.push(elem);
2090            }
2091            _ => {
2092                self.__buffa_unknown_fields
2093                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2094            }
2095        }
2096        ::core::result::Result::Ok(())
2097    }
2098    fn clear(&mut self) {
2099        self.range = ::buffa::EnumValue::from(0);
2100        self.bucket.clear();
2101        self.start_ts_sec = 0u32;
2102        self.end_ts_sec = 0u32;
2103        self.points = 0u32;
2104        self.series.clear();
2105        self.__buffa_unknown_fields.clear();
2106    }
2107}
2108impl ::buffa::ExtensionSet for GetBalanceHistoryResponse {
2109    const PROTO_FQN: &'static str = "ledger.read.v1.GetBalanceHistoryResponse";
2110    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2111        &self.__buffa_unknown_fields
2112    }
2113    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2114        &mut self.__buffa_unknown_fields
2115    }
2116}
2117impl ::buffa::json_helpers::ProtoElemJson for GetBalanceHistoryResponse {
2118    fn serialize_proto_json<S: ::serde::Serializer>(
2119        v: &Self,
2120        s: S,
2121    ) -> ::core::result::Result<S::Ok, S::Error> {
2122        ::serde::Serialize::serialize(v, s)
2123    }
2124    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2125        d: D,
2126    ) -> ::core::result::Result<Self, D::Error> {
2127        <Self as ::serde::Deserialize>::deserialize(d)
2128    }
2129}
2130#[doc(hidden)]
2131pub const __GET_BALANCE_HISTORY_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2132    type_url: "type.googleapis.com/ledger.read.v1.GetBalanceHistoryResponse",
2133    to_json: ::buffa::type_registry::any_to_json::<GetBalanceHistoryResponse>,
2134    from_json: ::buffa::type_registry::any_from_json::<GetBalanceHistoryResponse>,
2135    is_wkt: false,
2136};
2137/// Account grouping metadata (used when group_by = ACCOUNT).
2138#[derive(Clone, PartialEq, Default)]
2139#[derive(::serde::Serialize, ::serde::Deserialize)]
2140#[serde(default)]
2141pub struct AccountGrouping {
2142    /// account bucket code
2143    ///
2144    /// Field 1: `account_code`
2145    #[serde(
2146        rename = "accountCode",
2147        alias = "account_code",
2148        with = "::buffa::json_helpers::uint32",
2149        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
2150    )]
2151    pub account_code: u32,
2152    /// human-readable name ("funding", "trading")
2153    ///
2154    /// Field 2: `name`
2155    #[serde(
2156        rename = "name",
2157        with = "::buffa::json_helpers::proto_string",
2158        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2159    )]
2160    pub name: ::buffa::alloc::string::String,
2161    #[serde(skip)]
2162    #[doc(hidden)]
2163    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2164}
2165impl ::core::fmt::Debug for AccountGrouping {
2166    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2167        f.debug_struct("AccountGrouping")
2168            .field("account_code", &self.account_code)
2169            .field("name", &self.name)
2170            .finish()
2171    }
2172}
2173impl AccountGrouping {
2174    /// Protobuf type URL for this message, for use with `Any::pack` and
2175    /// `Any::unpack_if`.
2176    ///
2177    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2178    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AccountGrouping";
2179}
2180::buffa::impl_default_instance!(AccountGrouping);
2181impl ::buffa::MessageName for AccountGrouping {
2182    const PACKAGE: &'static str = "ledger.read.v1";
2183    const NAME: &'static str = "AccountGrouping";
2184    const FULL_NAME: &'static str = "ledger.read.v1.AccountGrouping";
2185    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AccountGrouping";
2186}
2187impl ::buffa::Message for AccountGrouping {
2188    /// Returns the total encoded size in bytes.
2189    ///
2190    /// The result is a `u32`; the protobuf specification requires all
2191    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2192    /// compliant message will never overflow this type.
2193    #[allow(clippy::let_and_return)]
2194    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2195        #[allow(unused_imports)]
2196        use ::buffa::Enumeration as _;
2197        let mut size = 0u32;
2198        if self.account_code != 0u32 {
2199            size += 1u32 + ::buffa::types::uint32_encoded_len(self.account_code) as u32;
2200        }
2201        if !self.name.is_empty() {
2202            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
2203        }
2204        size += self.__buffa_unknown_fields.encoded_len() as u32;
2205        size
2206    }
2207    fn write_to(
2208        &self,
2209        _cache: &mut ::buffa::SizeCache,
2210        buf: &mut impl ::buffa::bytes::BufMut,
2211    ) {
2212        #[allow(unused_imports)]
2213        use ::buffa::Enumeration as _;
2214        if self.account_code != 0u32 {
2215            ::buffa::types::put_uint32_field(1u32, self.account_code, buf);
2216        }
2217        if !self.name.is_empty() {
2218            ::buffa::types::put_string_field(2u32, &self.name, buf);
2219        }
2220        self.__buffa_unknown_fields.write_to(buf);
2221    }
2222    fn merge_field(
2223        &mut self,
2224        tag: ::buffa::encoding::Tag,
2225        buf: &mut impl ::buffa::bytes::Buf,
2226        ctx: ::buffa::DecodeContext<'_>,
2227    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2228        #[allow(unused_imports)]
2229        use ::buffa::bytes::Buf as _;
2230        #[allow(unused_imports)]
2231        use ::buffa::Enumeration as _;
2232        match tag.field_number() {
2233            1u32 => {
2234                ::buffa::encoding::check_wire_type(
2235                    tag,
2236                    ::buffa::encoding::WireType::Varint,
2237                )?;
2238                self.account_code = ::buffa::types::decode_uint32(buf)?;
2239            }
2240            2u32 => {
2241                ::buffa::encoding::check_wire_type(
2242                    tag,
2243                    ::buffa::encoding::WireType::LengthDelimited,
2244                )?;
2245                ::buffa::types::merge_string(&mut self.name, buf)?;
2246            }
2247            _ => {
2248                self.__buffa_unknown_fields
2249                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2250            }
2251        }
2252        ::core::result::Result::Ok(())
2253    }
2254    fn clear(&mut self) {
2255        self.account_code = 0u32;
2256        self.name.clear();
2257        self.__buffa_unknown_fields.clear();
2258    }
2259}
2260impl ::buffa::ExtensionSet for AccountGrouping {
2261    const PROTO_FQN: &'static str = "ledger.read.v1.AccountGrouping";
2262    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2263        &self.__buffa_unknown_fields
2264    }
2265    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2266        &mut self.__buffa_unknown_fields
2267    }
2268}
2269impl ::buffa::json_helpers::ProtoElemJson for AccountGrouping {
2270    fn serialize_proto_json<S: ::serde::Serializer>(
2271        v: &Self,
2272        s: S,
2273    ) -> ::core::result::Result<S::Ok, S::Error> {
2274        ::serde::Serialize::serialize(v, s)
2275    }
2276    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2277        d: D,
2278    ) -> ::core::result::Result<Self, D::Error> {
2279        <Self as ::serde::Deserialize>::deserialize(d)
2280    }
2281}
2282#[doc(hidden)]
2283pub const __ACCOUNT_GROUPING_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2284    type_url: "type.googleapis.com/ledger.read.v1.AccountGrouping",
2285    to_json: ::buffa::type_registry::any_to_json::<AccountGrouping>,
2286    from_json: ::buffa::type_registry::any_from_json::<AccountGrouping>,
2287    is_wkt: false,
2288};
2289/// Asset grouping metadata (used when group_by = ASSET).
2290#[derive(Clone, PartialEq, Default)]
2291#[derive(::serde::Serialize, ::serde::Deserialize)]
2292#[serde(default)]
2293pub struct AssetGrouping {
2294    /// public asset id (0 for "OTHER" bucket)
2295    ///
2296    /// Field 1: `id`
2297    #[serde(
2298        rename = "id",
2299        with = "::buffa::json_helpers::uint32",
2300        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
2301    )]
2302    pub id: u32,
2303    /// asset symbol ("BTC", "ETH", "OTHER")
2304    ///
2305    /// Field 2: `symbol`
2306    #[serde(
2307        rename = "symbol",
2308        with = "::buffa::json_helpers::proto_string",
2309        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2310    )]
2311    pub symbol: ::buffa::alloc::string::String,
2312    #[serde(skip)]
2313    #[doc(hidden)]
2314    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2315}
2316impl ::core::fmt::Debug for AssetGrouping {
2317    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2318        f.debug_struct("AssetGrouping")
2319            .field("id", &self.id)
2320            .field("symbol", &self.symbol)
2321            .finish()
2322    }
2323}
2324impl AssetGrouping {
2325    /// Protobuf type URL for this message, for use with `Any::pack` and
2326    /// `Any::unpack_if`.
2327    ///
2328    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2329    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AssetGrouping";
2330}
2331::buffa::impl_default_instance!(AssetGrouping);
2332impl ::buffa::MessageName for AssetGrouping {
2333    const PACKAGE: &'static str = "ledger.read.v1";
2334    const NAME: &'static str = "AssetGrouping";
2335    const FULL_NAME: &'static str = "ledger.read.v1.AssetGrouping";
2336    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AssetGrouping";
2337}
2338impl ::buffa::Message for AssetGrouping {
2339    /// Returns the total encoded size in bytes.
2340    ///
2341    /// The result is a `u32`; the protobuf specification requires all
2342    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2343    /// compliant message will never overflow this type.
2344    #[allow(clippy::let_and_return)]
2345    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2346        #[allow(unused_imports)]
2347        use ::buffa::Enumeration as _;
2348        let mut size = 0u32;
2349        if self.id != 0u32 {
2350            size += 1u32 + ::buffa::types::uint32_encoded_len(self.id) as u32;
2351        }
2352        if !self.symbol.is_empty() {
2353            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
2354        }
2355        size += self.__buffa_unknown_fields.encoded_len() as u32;
2356        size
2357    }
2358    fn write_to(
2359        &self,
2360        _cache: &mut ::buffa::SizeCache,
2361        buf: &mut impl ::buffa::bytes::BufMut,
2362    ) {
2363        #[allow(unused_imports)]
2364        use ::buffa::Enumeration as _;
2365        if self.id != 0u32 {
2366            ::buffa::types::put_uint32_field(1u32, self.id, buf);
2367        }
2368        if !self.symbol.is_empty() {
2369            ::buffa::types::put_string_field(2u32, &self.symbol, buf);
2370        }
2371        self.__buffa_unknown_fields.write_to(buf);
2372    }
2373    fn merge_field(
2374        &mut self,
2375        tag: ::buffa::encoding::Tag,
2376        buf: &mut impl ::buffa::bytes::Buf,
2377        ctx: ::buffa::DecodeContext<'_>,
2378    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2379        #[allow(unused_imports)]
2380        use ::buffa::bytes::Buf as _;
2381        #[allow(unused_imports)]
2382        use ::buffa::Enumeration as _;
2383        match tag.field_number() {
2384            1u32 => {
2385                ::buffa::encoding::check_wire_type(
2386                    tag,
2387                    ::buffa::encoding::WireType::Varint,
2388                )?;
2389                self.id = ::buffa::types::decode_uint32(buf)?;
2390            }
2391            2u32 => {
2392                ::buffa::encoding::check_wire_type(
2393                    tag,
2394                    ::buffa::encoding::WireType::LengthDelimited,
2395                )?;
2396                ::buffa::types::merge_string(&mut self.symbol, buf)?;
2397            }
2398            _ => {
2399                self.__buffa_unknown_fields
2400                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2401            }
2402        }
2403        ::core::result::Result::Ok(())
2404    }
2405    fn clear(&mut self) {
2406        self.id = 0u32;
2407        self.symbol.clear();
2408        self.__buffa_unknown_fields.clear();
2409    }
2410}
2411impl ::buffa::ExtensionSet for AssetGrouping {
2412    const PROTO_FQN: &'static str = "ledger.read.v1.AssetGrouping";
2413    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2414        &self.__buffa_unknown_fields
2415    }
2416    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2417        &mut self.__buffa_unknown_fields
2418    }
2419}
2420impl ::buffa::json_helpers::ProtoElemJson for AssetGrouping {
2421    fn serialize_proto_json<S: ::serde::Serializer>(
2422        v: &Self,
2423        s: S,
2424    ) -> ::core::result::Result<S::Ok, S::Error> {
2425        ::serde::Serialize::serialize(v, s)
2426    }
2427    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2428        d: D,
2429    ) -> ::core::result::Result<Self, D::Error> {
2430        <Self as ::serde::Deserialize>::deserialize(d)
2431    }
2432}
2433#[doc(hidden)]
2434pub const __ASSET_GROUPING_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2435    type_url: "type.googleapis.com/ledger.read.v1.AssetGrouping",
2436    to_json: ::buffa::type_registry::any_to_json::<AssetGrouping>,
2437    from_json: ::buffa::type_registry::any_from_json::<AssetGrouping>,
2438    is_wkt: false,
2439};
2440/// Equity history in USDT (or BTC via client-side conversion using btc_prices).
2441/// Values are derived from per-asset balances and market prices (close ticks).
2442#[derive(Clone, PartialEq, Default)]
2443#[derive(::serde::Serialize, ::serde::Deserialize)]
2444#[serde(default)]
2445pub struct GetEquityHistorySeriesRequest {
2446    /// Optional sub-account to scope equity to. If omitted, equity is returned for
2447    /// the authenticated root account derived from the JWT or API key.
2448    ///
2449    /// Field 1: `subaccount_id`
2450    #[serde(
2451        rename = "subaccountId",
2452        alias = "subaccount_id",
2453        with = "::buffa::json_helpers::opt_uint64",
2454        skip_serializing_if = "::core::option::Option::is_none"
2455    )]
2456    pub subaccount_id: ::core::option::Option<u64>,
2457    /// History window to return. When unset/UNSPECIFIED, defaults to 1D.
2458    ///
2459    /// Field 2: `range`
2460    #[serde(
2461        rename = "range",
2462        with = "::buffa::json_helpers::proto_enum",
2463        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2464    )]
2465    pub range: ::buffa::EnumValue<BalanceRange>,
2466    /// Optional subset of account buckets.
2467    /// When empty, server returns both funding and trading.
2468    /// Only used when group_by = ACCOUNT.
2469    ///
2470    /// Field 4: `account_codes`
2471    #[serde(
2472        rename = "accountCodes",
2473        alias = "account_codes",
2474        with = "::buffa::json_helpers::repeated_enum",
2475        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
2476    )]
2477    pub account_codes: ::buffa::alloc::vec::Vec<
2478        ::buffa::EnumValue<super::super::v1::AccountCode>,
2479    >,
2480    /// How to group the equity series. Defaults to ACCOUNT if unspecified.
2481    ///
2482    /// Field 5: `group_by`
2483    #[serde(
2484        rename = "groupBy",
2485        alias = "group_by",
2486        with = "::buffa::json_helpers::proto_enum",
2487        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2488    )]
2489    pub group_by: ::buffa::EnumValue<EquityGroupBy>,
2490    #[serde(skip)]
2491    #[doc(hidden)]
2492    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2493}
2494impl ::core::fmt::Debug for GetEquityHistorySeriesRequest {
2495    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2496        f.debug_struct("GetEquityHistorySeriesRequest")
2497            .field("subaccount_id", &self.subaccount_id)
2498            .field("range", &self.range)
2499            .field("account_codes", &self.account_codes)
2500            .field("group_by", &self.group_by)
2501            .finish()
2502    }
2503}
2504impl GetEquityHistorySeriesRequest {
2505    /// Protobuf type URL for this message, for use with `Any::pack` and
2506    /// `Any::unpack_if`.
2507    ///
2508    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2509    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesRequest";
2510}
2511impl GetEquityHistorySeriesRequest {
2512    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2513    #[inline]
2514    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
2515    pub fn with_subaccount_id(mut self, value: u64) -> Self {
2516        self.subaccount_id = Some(value);
2517        self
2518    }
2519}
2520::buffa::impl_default_instance!(GetEquityHistorySeriesRequest);
2521impl ::buffa::MessageName for GetEquityHistorySeriesRequest {
2522    const PACKAGE: &'static str = "ledger.read.v1";
2523    const NAME: &'static str = "GetEquityHistorySeriesRequest";
2524    const FULL_NAME: &'static str = "ledger.read.v1.GetEquityHistorySeriesRequest";
2525    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesRequest";
2526}
2527impl ::buffa::Message for GetEquityHistorySeriesRequest {
2528    /// Returns the total encoded size in bytes.
2529    ///
2530    /// The result is a `u32`; the protobuf specification requires all
2531    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2532    /// compliant message will never overflow this type.
2533    #[allow(clippy::let_and_return)]
2534    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2535        #[allow(unused_imports)]
2536        use ::buffa::Enumeration as _;
2537        let mut size = 0u32;
2538        if self.subaccount_id.is_some() {
2539            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
2540        }
2541        {
2542            let val = self.range.to_i32();
2543            if val != 0 {
2544                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2545            }
2546        }
2547        if !self.account_codes.is_empty() {
2548            let payload: u32 = self
2549                .account_codes
2550                .iter()
2551                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
2552                .sum::<u32>();
2553            size
2554                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
2555        }
2556        {
2557            let val = self.group_by.to_i32();
2558            if val != 0 {
2559                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2560            }
2561        }
2562        size += self.__buffa_unknown_fields.encoded_len() as u32;
2563        size
2564    }
2565    fn write_to(
2566        &self,
2567        _cache: &mut ::buffa::SizeCache,
2568        buf: &mut impl ::buffa::bytes::BufMut,
2569    ) {
2570        #[allow(unused_imports)]
2571        use ::buffa::Enumeration as _;
2572        if let Some(v) = self.subaccount_id {
2573            ::buffa::types::put_fixed64_field(1u32, v, buf);
2574        }
2575        {
2576            let val = self.range.to_i32();
2577            if val != 0 {
2578                ::buffa::types::put_int32_field(2u32, val, buf);
2579            }
2580        }
2581        if !self.account_codes.is_empty() {
2582            let payload: u32 = self
2583                .account_codes
2584                .iter()
2585                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
2586                .sum::<u32>();
2587            ::buffa::types::put_len_delimited_header(4u32, payload, buf);
2588            for v in &self.account_codes {
2589                ::buffa::types::encode_int32(v.to_i32(), buf);
2590            }
2591        }
2592        {
2593            let val = self.group_by.to_i32();
2594            if val != 0 {
2595                ::buffa::types::put_int32_field(5u32, val, buf);
2596            }
2597        }
2598        self.__buffa_unknown_fields.write_to(buf);
2599    }
2600    fn merge_field(
2601        &mut self,
2602        tag: ::buffa::encoding::Tag,
2603        buf: &mut impl ::buffa::bytes::Buf,
2604        ctx: ::buffa::DecodeContext<'_>,
2605    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2606        #[allow(unused_imports)]
2607        use ::buffa::bytes::Buf as _;
2608        #[allow(unused_imports)]
2609        use ::buffa::Enumeration as _;
2610        match tag.field_number() {
2611            1u32 => {
2612                ::buffa::encoding::check_wire_type(
2613                    tag,
2614                    ::buffa::encoding::WireType::Fixed64,
2615                )?;
2616                self.subaccount_id = ::core::option::Option::Some(
2617                    ::buffa::types::decode_fixed64(buf)?,
2618                );
2619            }
2620            2u32 => {
2621                ::buffa::encoding::check_wire_type(
2622                    tag,
2623                    ::buffa::encoding::WireType::Varint,
2624                )?;
2625                self.range = ::buffa::EnumValue::from(
2626                    ::buffa::types::decode_int32(buf)?,
2627                );
2628            }
2629            4u32 => {
2630                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
2631                    let len = ::buffa::encoding::decode_varint(buf)?;
2632                    let len = usize::try_from(len)
2633                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
2634                    if buf.remaining() < len {
2635                        return ::core::result::Result::Err(
2636                            ::buffa::DecodeError::UnexpectedEof,
2637                        );
2638                    }
2639                    self.account_codes.reserve(len);
2640                    let mut limited = buf.take(len);
2641                    while limited.has_remaining() {
2642                        self.account_codes
2643                            .push(
2644                                ::buffa::EnumValue::from(
2645                                    ::buffa::types::decode_int32(&mut limited)?,
2646                                ),
2647                            );
2648                    }
2649                    let leftover = limited.remaining();
2650                    if leftover > 0 {
2651                        limited.advance(leftover);
2652                    }
2653                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
2654                    self.account_codes
2655                        .push(
2656                            ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
2657                        );
2658                } else {
2659                    return ::core::result::Result::Err(
2660                        ::buffa::encoding::wire_type_mismatch(
2661                            tag,
2662                            ::buffa::encoding::WireType::LengthDelimited,
2663                        ),
2664                    );
2665                }
2666            }
2667            5u32 => {
2668                ::buffa::encoding::check_wire_type(
2669                    tag,
2670                    ::buffa::encoding::WireType::Varint,
2671                )?;
2672                self.group_by = ::buffa::EnumValue::from(
2673                    ::buffa::types::decode_int32(buf)?,
2674                );
2675            }
2676            _ => {
2677                self.__buffa_unknown_fields
2678                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2679            }
2680        }
2681        ::core::result::Result::Ok(())
2682    }
2683    fn clear(&mut self) {
2684        self.subaccount_id = ::core::option::Option::None;
2685        self.range = ::buffa::EnumValue::from(0);
2686        self.account_codes.clear();
2687        self.group_by = ::buffa::EnumValue::from(0);
2688        self.__buffa_unknown_fields.clear();
2689    }
2690}
2691impl ::buffa::ExtensionSet for GetEquityHistorySeriesRequest {
2692    const PROTO_FQN: &'static str = "ledger.read.v1.GetEquityHistorySeriesRequest";
2693    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2694        &self.__buffa_unknown_fields
2695    }
2696    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2697        &mut self.__buffa_unknown_fields
2698    }
2699}
2700impl ::buffa::json_helpers::ProtoElemJson for GetEquityHistorySeriesRequest {
2701    fn serialize_proto_json<S: ::serde::Serializer>(
2702        v: &Self,
2703        s: S,
2704    ) -> ::core::result::Result<S::Ok, S::Error> {
2705        ::serde::Serialize::serialize(v, s)
2706    }
2707    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2708        d: D,
2709    ) -> ::core::result::Result<Self, D::Error> {
2710        <Self as ::serde::Deserialize>::deserialize(d)
2711    }
2712}
2713#[doc(hidden)]
2714pub const __GET_EQUITY_HISTORY_SERIES_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2715    type_url: "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesRequest",
2716    to_json: ::buffa::type_registry::any_to_json::<GetEquityHistorySeriesRequest>,
2717    from_json: ::buffa::type_registry::any_from_json::<GetEquityHistorySeriesRequest>,
2718    is_wkt: false,
2719};
2720/// Columnar equity series payload (scaled integers).
2721/// REST renders decimal strings from these values.
2722#[derive(Clone, PartialEq, Default)]
2723#[derive(::serde::Serialize)]
2724#[serde(default)]
2725pub struct EquitySeries {
2726    /// Equity in quote currency (USDT) scaled by 1e4 (4 decimals).
2727    /// Values align 1:1 with timestamps.
2728    ///
2729    /// Field 2: `equity_q`
2730    #[serde(
2731        rename = "equityQ",
2732        alias = "equity_q",
2733        with = "::buffa::json_helpers::proto_seq",
2734        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
2735    )]
2736    pub equity_q: ::buffa::alloc::vec::Vec<i64>,
2737    #[serde(flatten)]
2738    pub grouping: ::core::option::Option<__buffa::oneof::equity_series::Grouping>,
2739    #[serde(skip)]
2740    #[doc(hidden)]
2741    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2742}
2743impl ::core::fmt::Debug for EquitySeries {
2744    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2745        f.debug_struct("EquitySeries")
2746            .field("equity_q", &self.equity_q)
2747            .field("grouping", &self.grouping)
2748            .finish()
2749    }
2750}
2751impl EquitySeries {
2752    /// Protobuf type URL for this message, for use with `Any::pack` and
2753    /// `Any::unpack_if`.
2754    ///
2755    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2756    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.EquitySeries";
2757}
2758::buffa::impl_default_instance!(EquitySeries);
2759impl ::buffa::MessageName for EquitySeries {
2760    const PACKAGE: &'static str = "ledger.read.v1";
2761    const NAME: &'static str = "EquitySeries";
2762    const FULL_NAME: &'static str = "ledger.read.v1.EquitySeries";
2763    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.EquitySeries";
2764}
2765impl ::buffa::Message for EquitySeries {
2766    /// Returns the total encoded size in bytes.
2767    ///
2768    /// The result is a `u32`; the protobuf specification requires all
2769    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2770    /// compliant message will never overflow this type.
2771    #[allow(clippy::let_and_return)]
2772    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2773        #[allow(unused_imports)]
2774        use ::buffa::Enumeration as _;
2775        let mut size = 0u32;
2776        if let ::core::option::Option::Some(ref v) = self.grouping {
2777            match v {
2778                __buffa::oneof::equity_series::Grouping::Account(x) => {
2779                    let __slot = __cache.reserve();
2780                    let inner = x.compute_size(__cache);
2781                    __cache.set(__slot, inner);
2782                    size
2783                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
2784                            + inner;
2785                }
2786                __buffa::oneof::equity_series::Grouping::Asset(x) => {
2787                    let __slot = __cache.reserve();
2788                    let inner = x.compute_size(__cache);
2789                    __cache.set(__slot, inner);
2790                    size
2791                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
2792                            + inner;
2793                }
2794            }
2795        }
2796        if !self.equity_q.is_empty() {
2797            let payload: u32 = self
2798                .equity_q
2799                .iter()
2800                .map(|&v| ::buffa::types::sint64_encoded_len(v) as u32)
2801                .sum::<u32>();
2802            size
2803                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
2804        }
2805        size += self.__buffa_unknown_fields.encoded_len() as u32;
2806        size
2807    }
2808    fn write_to(
2809        &self,
2810        __cache: &mut ::buffa::SizeCache,
2811        buf: &mut impl ::buffa::bytes::BufMut,
2812    ) {
2813        #[allow(unused_imports)]
2814        use ::buffa::Enumeration as _;
2815        if let ::core::option::Option::Some(ref v) = self.grouping {
2816            match v {
2817                __buffa::oneof::equity_series::Grouping::Account(x) => {
2818                    ::buffa::types::put_len_delimited_header(
2819                        1u32,
2820                        __cache.consume_next(),
2821                        buf,
2822                    );
2823                    x.write_to(__cache, buf);
2824                }
2825                __buffa::oneof::equity_series::Grouping::Asset(x) => {
2826                    ::buffa::types::put_len_delimited_header(
2827                        3u32,
2828                        __cache.consume_next(),
2829                        buf,
2830                    );
2831                    x.write_to(__cache, buf);
2832                }
2833            }
2834        }
2835        if !self.equity_q.is_empty() {
2836            let payload: u32 = self
2837                .equity_q
2838                .iter()
2839                .map(|&v| ::buffa::types::sint64_encoded_len(v) as u32)
2840                .sum::<u32>();
2841            ::buffa::types::put_len_delimited_header(2u32, payload, buf);
2842            for &v in &self.equity_q {
2843                ::buffa::types::encode_sint64(v, buf);
2844            }
2845        }
2846        self.__buffa_unknown_fields.write_to(buf);
2847    }
2848    fn merge_field(
2849        &mut self,
2850        tag: ::buffa::encoding::Tag,
2851        buf: &mut impl ::buffa::bytes::Buf,
2852        ctx: ::buffa::DecodeContext<'_>,
2853    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2854        #[allow(unused_imports)]
2855        use ::buffa::bytes::Buf as _;
2856        #[allow(unused_imports)]
2857        use ::buffa::Enumeration as _;
2858        match tag.field_number() {
2859            1u32 => {
2860                ::buffa::encoding::check_wire_type(
2861                    tag,
2862                    ::buffa::encoding::WireType::LengthDelimited,
2863                )?;
2864                if let ::core::option::Option::Some(
2865                    __buffa::oneof::equity_series::Grouping::Account(ref mut existing),
2866                ) = self.grouping
2867                {
2868                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
2869                } else {
2870                    let mut val = ::core::default::Default::default();
2871                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
2872                    self.grouping = ::core::option::Option::Some(
2873                        __buffa::oneof::equity_series::Grouping::Account(
2874                            ::buffa::alloc::boxed::Box::new(val),
2875                        ),
2876                    );
2877                }
2878            }
2879            3u32 => {
2880                ::buffa::encoding::check_wire_type(
2881                    tag,
2882                    ::buffa::encoding::WireType::LengthDelimited,
2883                )?;
2884                if let ::core::option::Option::Some(
2885                    __buffa::oneof::equity_series::Grouping::Asset(ref mut existing),
2886                ) = self.grouping
2887                {
2888                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
2889                } else {
2890                    let mut val = ::core::default::Default::default();
2891                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
2892                    self.grouping = ::core::option::Option::Some(
2893                        __buffa::oneof::equity_series::Grouping::Asset(
2894                            ::buffa::alloc::boxed::Box::new(val),
2895                        ),
2896                    );
2897                }
2898            }
2899            2u32 => {
2900                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
2901                    let len = ::buffa::encoding::decode_varint(buf)?;
2902                    let len = usize::try_from(len)
2903                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
2904                    if buf.remaining() < len {
2905                        return ::core::result::Result::Err(
2906                            ::buffa::DecodeError::UnexpectedEof,
2907                        );
2908                    }
2909                    self.equity_q.reserve(len);
2910                    let mut limited = buf.take(len);
2911                    while limited.has_remaining() {
2912                        self.equity_q.push(::buffa::types::decode_sint64(&mut limited)?);
2913                    }
2914                    let leftover = limited.remaining();
2915                    if leftover > 0 {
2916                        limited.advance(leftover);
2917                    }
2918                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
2919                    self.equity_q.push(::buffa::types::decode_sint64(buf)?);
2920                } else {
2921                    return ::core::result::Result::Err(
2922                        ::buffa::encoding::wire_type_mismatch(
2923                            tag,
2924                            ::buffa::encoding::WireType::LengthDelimited,
2925                        ),
2926                    );
2927                }
2928            }
2929            _ => {
2930                self.__buffa_unknown_fields
2931                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2932            }
2933        }
2934        ::core::result::Result::Ok(())
2935    }
2936    fn clear(&mut self) {
2937        self.grouping = ::core::option::Option::None;
2938        self.equity_q.clear();
2939        self.__buffa_unknown_fields.clear();
2940    }
2941}
2942impl ::buffa::ExtensionSet for EquitySeries {
2943    const PROTO_FQN: &'static str = "ledger.read.v1.EquitySeries";
2944    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2945        &self.__buffa_unknown_fields
2946    }
2947    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2948        &mut self.__buffa_unknown_fields
2949    }
2950}
2951impl<'de> serde::Deserialize<'de> for EquitySeries {
2952    fn deserialize<D: serde::Deserializer<'de>>(
2953        d: D,
2954    ) -> ::core::result::Result<Self, D::Error> {
2955        struct _V;
2956        impl<'de> serde::de::Visitor<'de> for _V {
2957            type Value = EquitySeries;
2958            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2959                f.write_str("struct EquitySeries")
2960            }
2961            #[allow(clippy::field_reassign_with_default)]
2962            fn visit_map<A: serde::de::MapAccess<'de>>(
2963                self,
2964                mut map: A,
2965            ) -> ::core::result::Result<EquitySeries, A::Error> {
2966                let mut __f_equity_q: ::core::option::Option<
2967                    ::buffa::alloc::vec::Vec<i64>,
2968                > = None;
2969                let mut __oneof_grouping: ::core::option::Option<
2970                    __buffa::oneof::equity_series::Grouping,
2971                > = None;
2972                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
2973                    match key.as_str() {
2974                        "equityQ" | "equity_q" => {
2975                            __f_equity_q = Some({
2976                                struct _S;
2977                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2978                                    type Value = ::buffa::alloc::vec::Vec<i64>;
2979                                    fn deserialize<D: serde::Deserializer<'de>>(
2980                                        self,
2981                                        d: D,
2982                                    ) -> ::core::result::Result<
2983                                        ::buffa::alloc::vec::Vec<i64>,
2984                                        D::Error,
2985                                    > {
2986                                        ::buffa::json_helpers::proto_seq::deserialize(d)
2987                                    }
2988                                }
2989                                map.next_value_seed(_S)?
2990                            });
2991                        }
2992                        "account" => {
2993                            let v: ::core::option::Option<AccountGrouping> = map
2994                                .next_value_seed(
2995                                    ::buffa::json_helpers::NullableDeserializeSeed(
2996                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
2997                                            AccountGrouping,
2998                                        >::new(),
2999                                    ),
3000                                )?;
3001                            if let Some(v) = v {
3002                                if __oneof_grouping.is_some() {
3003                                    return Err(
3004                                        serde::de::Error::custom(
3005                                            "multiple oneof fields set for 'grouping'",
3006                                        ),
3007                                    );
3008                                }
3009                                __oneof_grouping = Some(
3010                                    __buffa::oneof::equity_series::Grouping::Account(
3011                                        ::buffa::alloc::boxed::Box::new(v),
3012                                    ),
3013                                );
3014                            }
3015                        }
3016                        "asset" => {
3017                            let v: ::core::option::Option<AssetGrouping> = map
3018                                .next_value_seed(
3019                                    ::buffa::json_helpers::NullableDeserializeSeed(
3020                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3021                                            AssetGrouping,
3022                                        >::new(),
3023                                    ),
3024                                )?;
3025                            if let Some(v) = v {
3026                                if __oneof_grouping.is_some() {
3027                                    return Err(
3028                                        serde::de::Error::custom(
3029                                            "multiple oneof fields set for 'grouping'",
3030                                        ),
3031                                    );
3032                                }
3033                                __oneof_grouping = Some(
3034                                    __buffa::oneof::equity_series::Grouping::Asset(
3035                                        ::buffa::alloc::boxed::Box::new(v),
3036                                    ),
3037                                );
3038                            }
3039                        }
3040                        _ => {
3041                            map.next_value::<serde::de::IgnoredAny>()?;
3042                        }
3043                    }
3044                }
3045                let mut __r = <EquitySeries as ::core::default::Default>::default();
3046                if let ::core::option::Option::Some(v) = __f_equity_q {
3047                    __r.equity_q = v;
3048                }
3049                __r.grouping = __oneof_grouping;
3050                Ok(__r)
3051            }
3052        }
3053        d.deserialize_map(_V)
3054    }
3055}
3056impl ::buffa::json_helpers::ProtoElemJson for EquitySeries {
3057    fn serialize_proto_json<S: ::serde::Serializer>(
3058        v: &Self,
3059        s: S,
3060    ) -> ::core::result::Result<S::Ok, S::Error> {
3061        ::serde::Serialize::serialize(v, s)
3062    }
3063    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3064        d: D,
3065    ) -> ::core::result::Result<Self, D::Error> {
3066        <Self as ::serde::Deserialize>::deserialize(d)
3067    }
3068}
3069#[doc(hidden)]
3070pub const __EQUITY_SERIES_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3071    type_url: "type.googleapis.com/ledger.read.v1.EquitySeries",
3072    to_json: ::buffa::type_registry::any_to_json::<EquitySeries>,
3073    from_json: ::buffa::type_registry::any_from_json::<EquitySeries>,
3074    is_wkt: false,
3075};
3076pub mod equity_series {
3077    #[allow(unused_imports)]
3078    use super::*;
3079    #[doc(inline)]
3080    pub use super::__buffa::oneof::equity_series::Grouping;
3081    #[doc(inline)]
3082    pub use super::__buffa::view::oneof::equity_series::Grouping as GroupingView;
3083}
3084/// GetEquityHistorySeriesResponse returns aligned equity chart series.
3085#[derive(Clone, PartialEq, Default)]
3086#[derive(::serde::Serialize, ::serde::Deserialize)]
3087#[serde(default)]
3088pub struct GetEquityHistorySeriesResponse {
3089    /// Resolved history window.
3090    ///
3091    /// Field 1: `range`
3092    #[serde(
3093        rename = "range",
3094        with = "::buffa::json_helpers::proto_enum",
3095        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3096    )]
3097    pub range: ::buffa::EnumValue<BalanceRange>,
3098    /// Sampling interval between points, such as "5m" or "1h".
3099    ///
3100    /// Field 2: `bucket`
3101    #[serde(
3102        rename = "bucket",
3103        with = "::buffa::json_helpers::proto_string",
3104        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3105    )]
3106    pub bucket: ::buffa::alloc::string::String,
3107    /// First point timestamp in seconds since epoch (UTC).
3108    ///
3109    /// Field 3: `start_ts_sec`
3110    #[serde(
3111        rename = "startTsSec",
3112        alias = "start_ts_sec",
3113        with = "::buffa::json_helpers::uint32",
3114        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3115    )]
3116    pub start_ts_sec: u32,
3117    /// Last point timestamp in seconds since epoch (UTC).
3118    ///
3119    /// Field 4: `end_ts_sec`
3120    #[serde(
3121        rename = "endTsSec",
3122        alias = "end_ts_sec",
3123        with = "::buffa::json_helpers::uint32",
3124        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3125    )]
3126    pub end_ts_sec: u32,
3127    /// Human-readable quote asset symbol (always "USDT").
3128    ///
3129    /// Field 6: `quote_asset`
3130    #[serde(
3131        rename = "quoteAsset",
3132        alias = "quote_asset",
3133        with = "::buffa::json_helpers::proto_string",
3134        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3135    )]
3136    pub quote_asset: ::buffa::alloc::string::String,
3137    /// Number of aligned points in each returned series.
3138    ///
3139    /// Field 7: `points`
3140    #[serde(
3141        rename = "points",
3142        with = "::buffa::json_helpers::uint32",
3143        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3144    )]
3145    pub points: u32,
3146    /// Equity series ordered by grouping identifier ascending.
3147    ///
3148    /// Field 8: `series`
3149    #[serde(
3150        rename = "series",
3151        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
3152        deserialize_with = "::buffa::json_helpers::null_as_default"
3153    )]
3154    pub series: ::buffa::alloc::vec::Vec<EquitySeries>,
3155    /// BTC-USDT close price at each timestamp, scaled by 1e6 (same as price_ticks).
3156    /// Enables client-side conversion to BTC denomination without refetch.
3157    ///
3158    /// Field 10: `btc_prices_q`
3159    #[serde(
3160        rename = "btcPricesQ",
3161        alias = "btc_prices_q",
3162        with = "::buffa::json_helpers::proto_seq",
3163        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
3164    )]
3165    pub btc_prices_q: ::buffa::alloc::vec::Vec<i64>,
3166    #[serde(skip)]
3167    #[doc(hidden)]
3168    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3169}
3170impl ::core::fmt::Debug for GetEquityHistorySeriesResponse {
3171    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3172        f.debug_struct("GetEquityHistorySeriesResponse")
3173            .field("range", &self.range)
3174            .field("bucket", &self.bucket)
3175            .field("start_ts_sec", &self.start_ts_sec)
3176            .field("end_ts_sec", &self.end_ts_sec)
3177            .field("quote_asset", &self.quote_asset)
3178            .field("points", &self.points)
3179            .field("series", &self.series)
3180            .field("btc_prices_q", &self.btc_prices_q)
3181            .finish()
3182    }
3183}
3184impl GetEquityHistorySeriesResponse {
3185    /// Protobuf type URL for this message, for use with `Any::pack` and
3186    /// `Any::unpack_if`.
3187    ///
3188    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3189    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesResponse";
3190}
3191::buffa::impl_default_instance!(GetEquityHistorySeriesResponse);
3192impl ::buffa::MessageName for GetEquityHistorySeriesResponse {
3193    const PACKAGE: &'static str = "ledger.read.v1";
3194    const NAME: &'static str = "GetEquityHistorySeriesResponse";
3195    const FULL_NAME: &'static str = "ledger.read.v1.GetEquityHistorySeriesResponse";
3196    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesResponse";
3197}
3198impl ::buffa::Message for GetEquityHistorySeriesResponse {
3199    /// Returns the total encoded size in bytes.
3200    ///
3201    /// The result is a `u32`; the protobuf specification requires all
3202    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3203    /// compliant message will never overflow this type.
3204    #[allow(clippy::let_and_return)]
3205    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3206        #[allow(unused_imports)]
3207        use ::buffa::Enumeration as _;
3208        let mut size = 0u32;
3209        {
3210            let val = self.range.to_i32();
3211            if val != 0 {
3212                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3213            }
3214        }
3215        if !self.bucket.is_empty() {
3216            size += 1u32 + ::buffa::types::string_encoded_len(&self.bucket) as u32;
3217        }
3218        if self.start_ts_sec != 0u32 {
3219            size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
3220        }
3221        if self.end_ts_sec != 0u32 {
3222            size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
3223        }
3224        if !self.quote_asset.is_empty() {
3225            size += 1u32 + ::buffa::types::string_encoded_len(&self.quote_asset) as u32;
3226        }
3227        if self.points != 0u32 {
3228            size += 1u32 + ::buffa::types::uint32_encoded_len(self.points) as u32;
3229        }
3230        for v in &self.series {
3231            let __slot = __cache.reserve();
3232            let inner_size = v.compute_size(__cache);
3233            __cache.set(__slot, inner_size);
3234            size
3235                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3236                    + inner_size;
3237        }
3238        if !self.btc_prices_q.is_empty() {
3239            let payload: u32 = self
3240                .btc_prices_q
3241                .iter()
3242                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
3243                .sum::<u32>();
3244            size
3245                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
3246        }
3247        size += self.__buffa_unknown_fields.encoded_len() as u32;
3248        size
3249    }
3250    fn write_to(
3251        &self,
3252        __cache: &mut ::buffa::SizeCache,
3253        buf: &mut impl ::buffa::bytes::BufMut,
3254    ) {
3255        #[allow(unused_imports)]
3256        use ::buffa::Enumeration as _;
3257        {
3258            let val = self.range.to_i32();
3259            if val != 0 {
3260                ::buffa::types::put_int32_field(1u32, val, buf);
3261            }
3262        }
3263        if !self.bucket.is_empty() {
3264            ::buffa::types::put_string_field(2u32, &self.bucket, buf);
3265        }
3266        if self.start_ts_sec != 0u32 {
3267            ::buffa::types::put_fixed32_field(3u32, self.start_ts_sec, buf);
3268        }
3269        if self.end_ts_sec != 0u32 {
3270            ::buffa::types::put_fixed32_field(4u32, self.end_ts_sec, buf);
3271        }
3272        if !self.quote_asset.is_empty() {
3273            ::buffa::types::put_string_field(6u32, &self.quote_asset, buf);
3274        }
3275        if self.points != 0u32 {
3276            ::buffa::types::put_uint32_field(7u32, self.points, buf);
3277        }
3278        for v in &self.series {
3279            ::buffa::types::put_len_delimited_header(8u32, __cache.consume_next(), buf);
3280            v.write_to(__cache, buf);
3281        }
3282        if !self.btc_prices_q.is_empty() {
3283            let payload: u32 = self
3284                .btc_prices_q
3285                .iter()
3286                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
3287                .sum::<u32>();
3288            ::buffa::types::put_len_delimited_header(10u32, payload, buf);
3289            for &v in &self.btc_prices_q {
3290                ::buffa::types::encode_int64(v, buf);
3291            }
3292        }
3293        self.__buffa_unknown_fields.write_to(buf);
3294    }
3295    fn merge_field(
3296        &mut self,
3297        tag: ::buffa::encoding::Tag,
3298        buf: &mut impl ::buffa::bytes::Buf,
3299        ctx: ::buffa::DecodeContext<'_>,
3300    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3301        #[allow(unused_imports)]
3302        use ::buffa::bytes::Buf as _;
3303        #[allow(unused_imports)]
3304        use ::buffa::Enumeration as _;
3305        match tag.field_number() {
3306            1u32 => {
3307                ::buffa::encoding::check_wire_type(
3308                    tag,
3309                    ::buffa::encoding::WireType::Varint,
3310                )?;
3311                self.range = ::buffa::EnumValue::from(
3312                    ::buffa::types::decode_int32(buf)?,
3313                );
3314            }
3315            2u32 => {
3316                ::buffa::encoding::check_wire_type(
3317                    tag,
3318                    ::buffa::encoding::WireType::LengthDelimited,
3319                )?;
3320                ::buffa::types::merge_string(&mut self.bucket, buf)?;
3321            }
3322            3u32 => {
3323                ::buffa::encoding::check_wire_type(
3324                    tag,
3325                    ::buffa::encoding::WireType::Fixed32,
3326                )?;
3327                self.start_ts_sec = ::buffa::types::decode_fixed32(buf)?;
3328            }
3329            4u32 => {
3330                ::buffa::encoding::check_wire_type(
3331                    tag,
3332                    ::buffa::encoding::WireType::Fixed32,
3333                )?;
3334                self.end_ts_sec = ::buffa::types::decode_fixed32(buf)?;
3335            }
3336            6u32 => {
3337                ::buffa::encoding::check_wire_type(
3338                    tag,
3339                    ::buffa::encoding::WireType::LengthDelimited,
3340                )?;
3341                ::buffa::types::merge_string(&mut self.quote_asset, buf)?;
3342            }
3343            7u32 => {
3344                ::buffa::encoding::check_wire_type(
3345                    tag,
3346                    ::buffa::encoding::WireType::Varint,
3347                )?;
3348                self.points = ::buffa::types::decode_uint32(buf)?;
3349            }
3350            8u32 => {
3351                ::buffa::encoding::check_wire_type(
3352                    tag,
3353                    ::buffa::encoding::WireType::LengthDelimited,
3354                )?;
3355                let mut elem = ::core::default::Default::default();
3356                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
3357                self.series.push(elem);
3358            }
3359            10u32 => {
3360                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
3361                    let len = ::buffa::encoding::decode_varint(buf)?;
3362                    let len = usize::try_from(len)
3363                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
3364                    if buf.remaining() < len {
3365                        return ::core::result::Result::Err(
3366                            ::buffa::DecodeError::UnexpectedEof,
3367                        );
3368                    }
3369                    self.btc_prices_q.reserve(len);
3370                    let mut limited = buf.take(len);
3371                    while limited.has_remaining() {
3372                        self.btc_prices_q
3373                            .push(::buffa::types::decode_int64(&mut limited)?);
3374                    }
3375                    let leftover = limited.remaining();
3376                    if leftover > 0 {
3377                        limited.advance(leftover);
3378                    }
3379                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
3380                    self.btc_prices_q.push(::buffa::types::decode_int64(buf)?);
3381                } else {
3382                    return ::core::result::Result::Err(
3383                        ::buffa::encoding::wire_type_mismatch(
3384                            tag,
3385                            ::buffa::encoding::WireType::LengthDelimited,
3386                        ),
3387                    );
3388                }
3389            }
3390            _ => {
3391                self.__buffa_unknown_fields
3392                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3393            }
3394        }
3395        ::core::result::Result::Ok(())
3396    }
3397    fn clear(&mut self) {
3398        self.range = ::buffa::EnumValue::from(0);
3399        self.bucket.clear();
3400        self.start_ts_sec = 0u32;
3401        self.end_ts_sec = 0u32;
3402        self.quote_asset.clear();
3403        self.points = 0u32;
3404        self.series.clear();
3405        self.btc_prices_q.clear();
3406        self.__buffa_unknown_fields.clear();
3407    }
3408}
3409impl ::buffa::ExtensionSet for GetEquityHistorySeriesResponse {
3410    const PROTO_FQN: &'static str = "ledger.read.v1.GetEquityHistorySeriesResponse";
3411    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3412        &self.__buffa_unknown_fields
3413    }
3414    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3415        &mut self.__buffa_unknown_fields
3416    }
3417}
3418impl ::buffa::json_helpers::ProtoElemJson for GetEquityHistorySeriesResponse {
3419    fn serialize_proto_json<S: ::serde::Serializer>(
3420        v: &Self,
3421        s: S,
3422    ) -> ::core::result::Result<S::Ok, S::Error> {
3423        ::serde::Serialize::serialize(v, s)
3424    }
3425    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3426        d: D,
3427    ) -> ::core::result::Result<Self, D::Error> {
3428        <Self as ::serde::Deserialize>::deserialize(d)
3429    }
3430}
3431#[doc(hidden)]
3432pub const __GET_EQUITY_HISTORY_SERIES_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3433    type_url: "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesResponse",
3434    to_json: ::buffa::type_registry::any_to_json::<GetEquityHistorySeriesResponse>,
3435    from_json: ::buffa::type_registry::any_from_json::<GetEquityHistorySeriesResponse>,
3436    is_wkt: false,
3437};
3438#[derive(Clone, PartialEq, Default)]
3439#[derive(::serde::Serialize, ::serde::Deserialize)]
3440#[serde(default)]
3441pub struct ListTransfersRequest {
3442    /// Optional sub-account to scope transfers to. If omitted, transfers are
3443    /// listed for the authenticated root account derived from the JWT or API key.
3444    ///
3445    /// Field 1: `subaccount_id`
3446    #[serde(
3447        rename = "subaccountId",
3448        alias = "subaccount_id",
3449        with = "::buffa::json_helpers::opt_uint64",
3450        skip_serializing_if = "::core::option::Option::is_none"
3451    )]
3452    pub subaccount_id: ::core::option::Option<u64>,
3453    /// Maximum number of transfer rows to return. Defaults to 100 when omitted;
3454    /// maximum is 1000.
3455    ///
3456    /// Field 2: `limit`
3457    #[serde(
3458        rename = "limit",
3459        with = "::buffa::json_helpers::uint32",
3460        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3461    )]
3462    pub limit: u32,
3463    /// Sort direction. When true, rows are returned newest first; when false,
3464    /// rows are returned oldest first.
3465    ///
3466    /// Field 3: `reversed`
3467    #[serde(
3468        rename = "reversed",
3469        with = "::buffa::json_helpers::proto_bool",
3470        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
3471    )]
3472    pub reversed: bool,
3473    /// Optional lower transfer timestamp bound in microseconds since epoch (UTC),
3474    /// inclusive.
3475    ///
3476    /// Field 4: `ts_min_us`
3477    #[serde(
3478        rename = "tsMinUs",
3479        alias = "ts_min_us",
3480        with = "::buffa::json_helpers::uint64",
3481        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
3482    )]
3483    pub ts_min_us: u64,
3484    /// Optional upper transfer timestamp bound in microseconds since epoch (UTC),
3485    /// inclusive.
3486    ///
3487    /// Field 5: `ts_max_us`
3488    #[serde(
3489        rename = "tsMaxUs",
3490        alias = "ts_max_us",
3491        with = "::buffa::json_helpers::uint64",
3492        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
3493    )]
3494    pub ts_max_us: u64,
3495    /// Optional filter by transfer reason.
3496    ///
3497    /// Field 6: `transfer_code`
3498    #[serde(
3499        rename = "transferCode",
3500        alias = "transfer_code",
3501        with = "::buffa::json_helpers::proto_enum",
3502        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3503    )]
3504    pub transfer_code: ::buffa::EnumValue<super::super::v1::TransferCode>,
3505    /// Optional filter by asset ledger.
3506    ///
3507    /// Field 7: `ledger`
3508    #[serde(
3509        rename = "ledger",
3510        with = "::buffa::json_helpers::uint32",
3511        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3512    )]
3513    pub ledger: u32,
3514    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
3515    /// bound to the authenticated account, sub-account scope, filters, timestamp
3516    /// bounds, and sort direction.
3517    ///
3518    /// Field 9: `page_token`
3519    #[serde(
3520        rename = "pageToken",
3521        alias = "page_token",
3522        with = "::buffa::json_helpers::proto_string",
3523        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3524    )]
3525    pub page_token: ::buffa::alloc::string::String,
3526    #[serde(skip)]
3527    #[doc(hidden)]
3528    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3529}
3530impl ::core::fmt::Debug for ListTransfersRequest {
3531    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3532        f.debug_struct("ListTransfersRequest")
3533            .field("subaccount_id", &self.subaccount_id)
3534            .field("limit", &self.limit)
3535            .field("reversed", &self.reversed)
3536            .field("ts_min_us", &self.ts_min_us)
3537            .field("ts_max_us", &self.ts_max_us)
3538            .field("transfer_code", &self.transfer_code)
3539            .field("ledger", &self.ledger)
3540            .field("page_token", &self.page_token)
3541            .finish()
3542    }
3543}
3544impl ListTransfersRequest {
3545    /// Protobuf type URL for this message, for use with `Any::pack` and
3546    /// `Any::unpack_if`.
3547    ///
3548    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3549    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListTransfersRequest";
3550}
3551impl ListTransfersRequest {
3552    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3553    #[inline]
3554    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
3555    pub fn with_subaccount_id(mut self, value: u64) -> Self {
3556        self.subaccount_id = Some(value);
3557        self
3558    }
3559}
3560::buffa::impl_default_instance!(ListTransfersRequest);
3561impl ::buffa::MessageName for ListTransfersRequest {
3562    const PACKAGE: &'static str = "ledger.read.v1";
3563    const NAME: &'static str = "ListTransfersRequest";
3564    const FULL_NAME: &'static str = "ledger.read.v1.ListTransfersRequest";
3565    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListTransfersRequest";
3566}
3567impl ::buffa::Message for ListTransfersRequest {
3568    /// Returns the total encoded size in bytes.
3569    ///
3570    /// The result is a `u32`; the protobuf specification requires all
3571    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3572    /// compliant message will never overflow this type.
3573    #[allow(clippy::let_and_return)]
3574    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3575        #[allow(unused_imports)]
3576        use ::buffa::Enumeration as _;
3577        let mut size = 0u32;
3578        if self.subaccount_id.is_some() {
3579            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
3580        }
3581        if self.limit != 0u32 {
3582            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
3583        }
3584        if self.reversed {
3585            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
3586        }
3587        if self.ts_min_us != 0u64 {
3588            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_min_us) as u32;
3589        }
3590        if self.ts_max_us != 0u64 {
3591            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_max_us) as u32;
3592        }
3593        {
3594            let val = self.transfer_code.to_i32();
3595            if val != 0 {
3596                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3597            }
3598        }
3599        if self.ledger != 0u32 {
3600            size += 1u32 + ::buffa::types::uint32_encoded_len(self.ledger) as u32;
3601        }
3602        if !self.page_token.is_empty() {
3603            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
3604        }
3605        size += self.__buffa_unknown_fields.encoded_len() as u32;
3606        size
3607    }
3608    fn write_to(
3609        &self,
3610        _cache: &mut ::buffa::SizeCache,
3611        buf: &mut impl ::buffa::bytes::BufMut,
3612    ) {
3613        #[allow(unused_imports)]
3614        use ::buffa::Enumeration as _;
3615        if let Some(v) = self.subaccount_id {
3616            ::buffa::types::put_fixed64_field(1u32, v, buf);
3617        }
3618        if self.limit != 0u32 {
3619            ::buffa::types::put_uint32_field(2u32, self.limit, buf);
3620        }
3621        if self.reversed {
3622            ::buffa::types::put_bool_field(3u32, self.reversed, buf);
3623        }
3624        if self.ts_min_us != 0u64 {
3625            ::buffa::types::put_uint64_field(4u32, self.ts_min_us, buf);
3626        }
3627        if self.ts_max_us != 0u64 {
3628            ::buffa::types::put_uint64_field(5u32, self.ts_max_us, buf);
3629        }
3630        {
3631            let val = self.transfer_code.to_i32();
3632            if val != 0 {
3633                ::buffa::types::put_int32_field(6u32, val, buf);
3634            }
3635        }
3636        if self.ledger != 0u32 {
3637            ::buffa::types::put_uint32_field(7u32, self.ledger, buf);
3638        }
3639        if !self.page_token.is_empty() {
3640            ::buffa::types::put_string_field(9u32, &self.page_token, buf);
3641        }
3642        self.__buffa_unknown_fields.write_to(buf);
3643    }
3644    fn merge_field(
3645        &mut self,
3646        tag: ::buffa::encoding::Tag,
3647        buf: &mut impl ::buffa::bytes::Buf,
3648        ctx: ::buffa::DecodeContext<'_>,
3649    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3650        #[allow(unused_imports)]
3651        use ::buffa::bytes::Buf as _;
3652        #[allow(unused_imports)]
3653        use ::buffa::Enumeration as _;
3654        match tag.field_number() {
3655            1u32 => {
3656                ::buffa::encoding::check_wire_type(
3657                    tag,
3658                    ::buffa::encoding::WireType::Fixed64,
3659                )?;
3660                self.subaccount_id = ::core::option::Option::Some(
3661                    ::buffa::types::decode_fixed64(buf)?,
3662                );
3663            }
3664            2u32 => {
3665                ::buffa::encoding::check_wire_type(
3666                    tag,
3667                    ::buffa::encoding::WireType::Varint,
3668                )?;
3669                self.limit = ::buffa::types::decode_uint32(buf)?;
3670            }
3671            3u32 => {
3672                ::buffa::encoding::check_wire_type(
3673                    tag,
3674                    ::buffa::encoding::WireType::Varint,
3675                )?;
3676                self.reversed = ::buffa::types::decode_bool(buf)?;
3677            }
3678            4u32 => {
3679                ::buffa::encoding::check_wire_type(
3680                    tag,
3681                    ::buffa::encoding::WireType::Varint,
3682                )?;
3683                self.ts_min_us = ::buffa::types::decode_uint64(buf)?;
3684            }
3685            5u32 => {
3686                ::buffa::encoding::check_wire_type(
3687                    tag,
3688                    ::buffa::encoding::WireType::Varint,
3689                )?;
3690                self.ts_max_us = ::buffa::types::decode_uint64(buf)?;
3691            }
3692            6u32 => {
3693                ::buffa::encoding::check_wire_type(
3694                    tag,
3695                    ::buffa::encoding::WireType::Varint,
3696                )?;
3697                self.transfer_code = ::buffa::EnumValue::from(
3698                    ::buffa::types::decode_int32(buf)?,
3699                );
3700            }
3701            7u32 => {
3702                ::buffa::encoding::check_wire_type(
3703                    tag,
3704                    ::buffa::encoding::WireType::Varint,
3705                )?;
3706                self.ledger = ::buffa::types::decode_uint32(buf)?;
3707            }
3708            9u32 => {
3709                ::buffa::encoding::check_wire_type(
3710                    tag,
3711                    ::buffa::encoding::WireType::LengthDelimited,
3712                )?;
3713                ::buffa::types::merge_string(&mut self.page_token, buf)?;
3714            }
3715            _ => {
3716                self.__buffa_unknown_fields
3717                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3718            }
3719        }
3720        ::core::result::Result::Ok(())
3721    }
3722    fn clear(&mut self) {
3723        self.subaccount_id = ::core::option::Option::None;
3724        self.limit = 0u32;
3725        self.reversed = false;
3726        self.ts_min_us = 0u64;
3727        self.ts_max_us = 0u64;
3728        self.transfer_code = ::buffa::EnumValue::from(0);
3729        self.ledger = 0u32;
3730        self.page_token.clear();
3731        self.__buffa_unknown_fields.clear();
3732    }
3733}
3734impl ::buffa::ExtensionSet for ListTransfersRequest {
3735    const PROTO_FQN: &'static str = "ledger.read.v1.ListTransfersRequest";
3736    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3737        &self.__buffa_unknown_fields
3738    }
3739    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3740        &mut self.__buffa_unknown_fields
3741    }
3742}
3743impl ::buffa::json_helpers::ProtoElemJson for ListTransfersRequest {
3744    fn serialize_proto_json<S: ::serde::Serializer>(
3745        v: &Self,
3746        s: S,
3747    ) -> ::core::result::Result<S::Ok, S::Error> {
3748        ::serde::Serialize::serialize(v, s)
3749    }
3750    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3751        d: D,
3752    ) -> ::core::result::Result<Self, D::Error> {
3753        <Self as ::serde::Deserialize>::deserialize(d)
3754    }
3755}
3756#[doc(hidden)]
3757pub const __LIST_TRANSFERS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3758    type_url: "type.googleapis.com/ledger.read.v1.ListTransfersRequest",
3759    to_json: ::buffa::type_registry::any_to_json::<ListTransfersRequest>,
3760    from_json: ::buffa::type_registry::any_from_json::<ListTransfersRequest>,
3761    is_wkt: false,
3762};
3763/// TransferSide describes one side of a ledger transfer for display.
3764#[derive(Clone, PartialEq, Default)]
3765#[derive(::serde::Serialize, ::serde::Deserialize)]
3766#[serde(default)]
3767pub struct TransferSide {
3768    /// Display classification for this transfer side.
3769    ///
3770    /// Field 1: `kind`
3771    #[serde(
3772        rename = "kind",
3773        with = "::buffa::json_helpers::proto_enum",
3774        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3775    )]
3776    pub kind: ::buffa::EnumValue<TransferSideKind>,
3777    /// Public root account or subaccount ID when this side is safe to identify. Never
3778    /// populated for private counterparties or non-user ledger accounts.
3779    ///
3780    /// Field 2: `account_id`
3781    #[serde(
3782        rename = "accountId",
3783        alias = "account_id",
3784        with = "::buffa::json_helpers::opt_uint64",
3785        skip_serializing_if = "::core::option::Option::is_none"
3786    )]
3787    pub account_id: ::core::option::Option<u64>,
3788    /// Address for this side when known. For EXTERNAL_ADDRESS this is an
3789    /// external-chain wallet address from lifecycle correlation; for identifiable
3790    /// Polyester accounts this is a Polyester smart-account address.
3791    /// May be empty until the corresponding lifecycle details are available.
3792    ///
3793    /// Field 3: `address`
3794    #[serde(
3795        rename = "address",
3796        with = "::buffa::json_helpers::proto_string",
3797        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3798    )]
3799    pub address: ::buffa::alloc::string::String,
3800    #[serde(skip)]
3801    #[doc(hidden)]
3802    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3803}
3804impl ::core::fmt::Debug for TransferSide {
3805    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3806        f.debug_struct("TransferSide")
3807            .field("kind", &self.kind)
3808            .field("account_id", &self.account_id)
3809            .field("address", &self.address)
3810            .finish()
3811    }
3812}
3813impl TransferSide {
3814    /// Protobuf type URL for this message, for use with `Any::pack` and
3815    /// `Any::unpack_if`.
3816    ///
3817    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3818    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.TransferSide";
3819}
3820impl TransferSide {
3821    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3822    #[inline]
3823    ///Sets [`Self::account_id`] to `Some(value)`, consuming and returning `self`.
3824    pub fn with_account_id(mut self, value: u64) -> Self {
3825        self.account_id = Some(value);
3826        self
3827    }
3828}
3829::buffa::impl_default_instance!(TransferSide);
3830impl ::buffa::MessageName for TransferSide {
3831    const PACKAGE: &'static str = "ledger.read.v1";
3832    const NAME: &'static str = "TransferSide";
3833    const FULL_NAME: &'static str = "ledger.read.v1.TransferSide";
3834    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.TransferSide";
3835}
3836impl ::buffa::Message for TransferSide {
3837    /// Returns the total encoded size in bytes.
3838    ///
3839    /// The result is a `u32`; the protobuf specification requires all
3840    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3841    /// compliant message will never overflow this type.
3842    #[allow(clippy::let_and_return)]
3843    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3844        #[allow(unused_imports)]
3845        use ::buffa::Enumeration as _;
3846        let mut size = 0u32;
3847        {
3848            let val = self.kind.to_i32();
3849            if val != 0 {
3850                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3851            }
3852        }
3853        if self.account_id.is_some() {
3854            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
3855        }
3856        if !self.address.is_empty() {
3857            size += 1u32 + ::buffa::types::string_encoded_len(&self.address) as u32;
3858        }
3859        size += self.__buffa_unknown_fields.encoded_len() as u32;
3860        size
3861    }
3862    fn write_to(
3863        &self,
3864        _cache: &mut ::buffa::SizeCache,
3865        buf: &mut impl ::buffa::bytes::BufMut,
3866    ) {
3867        #[allow(unused_imports)]
3868        use ::buffa::Enumeration as _;
3869        {
3870            let val = self.kind.to_i32();
3871            if val != 0 {
3872                ::buffa::types::put_int32_field(1u32, val, buf);
3873            }
3874        }
3875        if let Some(v) = self.account_id {
3876            ::buffa::types::put_fixed64_field(2u32, v, buf);
3877        }
3878        if !self.address.is_empty() {
3879            ::buffa::types::put_string_field(3u32, &self.address, buf);
3880        }
3881        self.__buffa_unknown_fields.write_to(buf);
3882    }
3883    fn merge_field(
3884        &mut self,
3885        tag: ::buffa::encoding::Tag,
3886        buf: &mut impl ::buffa::bytes::Buf,
3887        ctx: ::buffa::DecodeContext<'_>,
3888    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3889        #[allow(unused_imports)]
3890        use ::buffa::bytes::Buf as _;
3891        #[allow(unused_imports)]
3892        use ::buffa::Enumeration as _;
3893        match tag.field_number() {
3894            1u32 => {
3895                ::buffa::encoding::check_wire_type(
3896                    tag,
3897                    ::buffa::encoding::WireType::Varint,
3898                )?;
3899                self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
3900            }
3901            2u32 => {
3902                ::buffa::encoding::check_wire_type(
3903                    tag,
3904                    ::buffa::encoding::WireType::Fixed64,
3905                )?;
3906                self.account_id = ::core::option::Option::Some(
3907                    ::buffa::types::decode_fixed64(buf)?,
3908                );
3909            }
3910            3u32 => {
3911                ::buffa::encoding::check_wire_type(
3912                    tag,
3913                    ::buffa::encoding::WireType::LengthDelimited,
3914                )?;
3915                ::buffa::types::merge_string(&mut self.address, buf)?;
3916            }
3917            _ => {
3918                self.__buffa_unknown_fields
3919                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3920            }
3921        }
3922        ::core::result::Result::Ok(())
3923    }
3924    fn clear(&mut self) {
3925        self.kind = ::buffa::EnumValue::from(0);
3926        self.account_id = ::core::option::Option::None;
3927        self.address.clear();
3928        self.__buffa_unknown_fields.clear();
3929    }
3930}
3931impl ::buffa::ExtensionSet for TransferSide {
3932    const PROTO_FQN: &'static str = "ledger.read.v1.TransferSide";
3933    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3934        &self.__buffa_unknown_fields
3935    }
3936    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3937        &mut self.__buffa_unknown_fields
3938    }
3939}
3940impl ::buffa::json_helpers::ProtoElemJson for TransferSide {
3941    fn serialize_proto_json<S: ::serde::Serializer>(
3942        v: &Self,
3943        s: S,
3944    ) -> ::core::result::Result<S::Ok, S::Error> {
3945        ::serde::Serialize::serialize(v, s)
3946    }
3947    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3948        d: D,
3949    ) -> ::core::result::Result<Self, D::Error> {
3950        <Self as ::serde::Deserialize>::deserialize(d)
3951    }
3952}
3953#[doc(hidden)]
3954pub const __TRANSFER_SIDE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3955    type_url: "type.googleapis.com/ledger.read.v1.TransferSide",
3956    to_json: ::buffa::type_registry::any_to_json::<TransferSide>,
3957    from_json: ::buffa::type_registry::any_from_json::<TransferSide>,
3958    is_wkt: false,
3959};
3960/// TransferRow describes one debit or credit leg of a ledger transfer.
3961#[derive(Clone, PartialEq, Default)]
3962#[derive(::serde::Serialize, ::serde::Deserialize)]
3963#[serde(default)]
3964pub struct TransferRow {
3965    /// Public unified asset ID. Resolve its symbol through the spot configuration
3966    /// API. U128 amounts in this row always use a fixed 18-decimal ledger scale.
3967    ///
3968    /// Field 1: `asset_id`
3969    #[serde(
3970        rename = "assetId",
3971        alias = "asset_id",
3972        with = "::buffa::json_helpers::uint32",
3973        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3974    )]
3975    pub asset_id: u32,
3976    /// Transfer amount at fixed 18-decimal ledger scale.
3977    ///
3978    /// Field 2: `amount_e18`
3979    #[serde(
3980        rename = "amountE18",
3981        alias = "amount_e18",
3982        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
3983    )]
3984    pub amount_e18: ::buffa::MessageField<
3985        super::super::super::polyester::r#type::v1::U128,
3986    >,
3987    /// Product reason for this transfer.
3988    ///
3989    /// Field 3: `transfer_code`
3990    #[serde(
3991        rename = "transferCode",
3992        alias = "transfer_code",
3993        with = "::buffa::json_helpers::proto_enum",
3994        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3995    )]
3996    pub transfer_code: ::buffa::EnumValue<super::super::v1::TransferCode>,
3997    /// Account bucket affected by this transfer.
3998    ///
3999    /// Field 4: `account_code`
4000    #[serde(
4001        rename = "accountCode",
4002        alias = "account_code",
4003        with = "::buffa::json_helpers::proto_enum",
4004        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
4005    )]
4006    pub account_code: ::buffa::EnumValue<super::super::v1::AccountCode>,
4007    /// Transfer timestamp in microseconds since epoch (UTC).
4008    ///
4009    /// Field 5: `ts_us`
4010    #[serde(
4011        rename = "tsUs",
4012        alias = "ts_us",
4013        with = "::buffa::json_helpers::uint64",
4014        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4015    )]
4016    pub ts_us: u64,
4017    /// Post-transfer balance at fixed 18-decimal ledger scale.
4018    ///
4019    /// Field 9: `balance_after_e18`
4020    #[serde(
4021        rename = "balanceAfterE18",
4022        alias = "balance_after_e18",
4023        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4024    )]
4025    pub balance_after_e18: ::buffa::MessageField<
4026        super::super::super::polyester::r#type::v1::U128,
4027    >,
4028    /// True when this row is the debit leg; false when it is the credit leg.
4029    ///
4030    /// Field 10: `is_debit`
4031    #[serde(
4032        rename = "isDebit",
4033        alias = "is_debit",
4034        with = "::buffa::json_helpers::proto_bool",
4035        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
4036    )]
4037    pub is_debit: bool,
4038    /// Correlation ID used to group related transfer legs. Zero when unavailable.
4039    ///
4040    /// Field 11: `link_id`
4041    #[serde(
4042        rename = "linkId",
4043        alias = "link_id",
4044        with = "::buffa::json_helpers::uint64",
4045        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4046    )]
4047    pub link_id: u64,
4048    /// Public lifecycle flow ID when this transfer belongs to a chain lifecycle flow.
4049    ///
4050    /// Field 12: `flow_id`
4051    #[serde(
4052        rename = "flowId",
4053        alias = "flow_id",
4054        with = "::buffa::json_helpers::proto_string",
4055        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4056    )]
4057    pub flow_id: ::buffa::alloc::string::String,
4058    /// Debit side of the transfer. This relationship is debit-to-credit rather
4059    /// than row-relative; use is_debit to determine whether this row is the debit leg.
4060    ///
4061    /// Field 13: `source`
4062    #[serde(
4063        rename = "source",
4064        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4065    )]
4066    pub source: ::buffa::MessageField<TransferSide>,
4067    /// Credit side of the transfer. This relationship is debit-to-credit rather
4068    /// than row-relative; use is_debit to determine whether this row is the credit leg.
4069    ///
4070    /// Field 14: `destination`
4071    #[serde(
4072        rename = "destination",
4073        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4074    )]
4075    pub destination: ::buffa::MessageField<TransferSide>,
4076    #[serde(skip)]
4077    #[doc(hidden)]
4078    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4079}
4080impl ::core::fmt::Debug for TransferRow {
4081    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4082        f.debug_struct("TransferRow")
4083            .field("asset_id", &self.asset_id)
4084            .field("amount_e18", &self.amount_e18)
4085            .field("transfer_code", &self.transfer_code)
4086            .field("account_code", &self.account_code)
4087            .field("ts_us", &self.ts_us)
4088            .field("balance_after_e18", &self.balance_after_e18)
4089            .field("is_debit", &self.is_debit)
4090            .field("link_id", &self.link_id)
4091            .field("flow_id", &self.flow_id)
4092            .field("source", &self.source)
4093            .field("destination", &self.destination)
4094            .finish()
4095    }
4096}
4097impl TransferRow {
4098    /// Protobuf type URL for this message, for use with `Any::pack` and
4099    /// `Any::unpack_if`.
4100    ///
4101    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4102    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.TransferRow";
4103}
4104::buffa::impl_default_instance!(TransferRow);
4105impl ::buffa::MessageName for TransferRow {
4106    const PACKAGE: &'static str = "ledger.read.v1";
4107    const NAME: &'static str = "TransferRow";
4108    const FULL_NAME: &'static str = "ledger.read.v1.TransferRow";
4109    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.TransferRow";
4110}
4111impl ::buffa::Message for TransferRow {
4112    /// Returns the total encoded size in bytes.
4113    ///
4114    /// The result is a `u32`; the protobuf specification requires all
4115    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4116    /// compliant message will never overflow this type.
4117    #[allow(clippy::let_and_return)]
4118    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4119        #[allow(unused_imports)]
4120        use ::buffa::Enumeration as _;
4121        let mut size = 0u32;
4122        if self.asset_id != 0u32 {
4123            size += 1u32 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
4124        }
4125        if self.amount_e18.is_set() {
4126            let __slot = __cache.reserve();
4127            let inner_size = self.amount_e18.compute_size(__cache);
4128            __cache.set(__slot, inner_size);
4129            size
4130                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4131                    + inner_size;
4132        }
4133        {
4134            let val = self.transfer_code.to_i32();
4135            if val != 0 {
4136                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4137            }
4138        }
4139        {
4140            let val = self.account_code.to_i32();
4141            if val != 0 {
4142                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4143            }
4144        }
4145        if self.ts_us != 0u64 {
4146            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_us) as u32;
4147        }
4148        if self.balance_after_e18.is_set() {
4149            let __slot = __cache.reserve();
4150            let inner_size = self.balance_after_e18.compute_size(__cache);
4151            __cache.set(__slot, inner_size);
4152            size
4153                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4154                    + inner_size;
4155        }
4156        if self.is_debit {
4157            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4158        }
4159        if self.link_id != 0u64 {
4160            size += 1u32 + ::buffa::types::uint64_encoded_len(self.link_id) as u32;
4161        }
4162        if !self.flow_id.is_empty() {
4163            size += 1u32 + ::buffa::types::string_encoded_len(&self.flow_id) as u32;
4164        }
4165        if self.source.is_set() {
4166            let __slot = __cache.reserve();
4167            let inner_size = self.source.compute_size(__cache);
4168            __cache.set(__slot, inner_size);
4169            size
4170                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4171                    + inner_size;
4172        }
4173        if self.destination.is_set() {
4174            let __slot = __cache.reserve();
4175            let inner_size = self.destination.compute_size(__cache);
4176            __cache.set(__slot, inner_size);
4177            size
4178                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4179                    + inner_size;
4180        }
4181        size += self.__buffa_unknown_fields.encoded_len() as u32;
4182        size
4183    }
4184    fn write_to(
4185        &self,
4186        __cache: &mut ::buffa::SizeCache,
4187        buf: &mut impl ::buffa::bytes::BufMut,
4188    ) {
4189        #[allow(unused_imports)]
4190        use ::buffa::Enumeration as _;
4191        if self.asset_id != 0u32 {
4192            ::buffa::types::put_uint32_field(1u32, self.asset_id, buf);
4193        }
4194        if self.amount_e18.is_set() {
4195            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
4196            self.amount_e18.write_to(__cache, buf);
4197        }
4198        {
4199            let val = self.transfer_code.to_i32();
4200            if val != 0 {
4201                ::buffa::types::put_int32_field(3u32, val, buf);
4202            }
4203        }
4204        {
4205            let val = self.account_code.to_i32();
4206            if val != 0 {
4207                ::buffa::types::put_int32_field(4u32, val, buf);
4208            }
4209        }
4210        if self.ts_us != 0u64 {
4211            ::buffa::types::put_uint64_field(5u32, self.ts_us, buf);
4212        }
4213        if self.balance_after_e18.is_set() {
4214            ::buffa::types::put_len_delimited_header(9u32, __cache.consume_next(), buf);
4215            self.balance_after_e18.write_to(__cache, buf);
4216        }
4217        if self.is_debit {
4218            ::buffa::types::put_bool_field(10u32, self.is_debit, buf);
4219        }
4220        if self.link_id != 0u64 {
4221            ::buffa::types::put_uint64_field(11u32, self.link_id, buf);
4222        }
4223        if !self.flow_id.is_empty() {
4224            ::buffa::types::put_string_field(12u32, &self.flow_id, buf);
4225        }
4226        if self.source.is_set() {
4227            ::buffa::types::put_len_delimited_header(13u32, __cache.consume_next(), buf);
4228            self.source.write_to(__cache, buf);
4229        }
4230        if self.destination.is_set() {
4231            ::buffa::types::put_len_delimited_header(14u32, __cache.consume_next(), buf);
4232            self.destination.write_to(__cache, buf);
4233        }
4234        self.__buffa_unknown_fields.write_to(buf);
4235    }
4236    fn merge_field(
4237        &mut self,
4238        tag: ::buffa::encoding::Tag,
4239        buf: &mut impl ::buffa::bytes::Buf,
4240        ctx: ::buffa::DecodeContext<'_>,
4241    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4242        #[allow(unused_imports)]
4243        use ::buffa::bytes::Buf as _;
4244        #[allow(unused_imports)]
4245        use ::buffa::Enumeration as _;
4246        match tag.field_number() {
4247            1u32 => {
4248                ::buffa::encoding::check_wire_type(
4249                    tag,
4250                    ::buffa::encoding::WireType::Varint,
4251                )?;
4252                self.asset_id = ::buffa::types::decode_uint32(buf)?;
4253            }
4254            2u32 => {
4255                ::buffa::encoding::check_wire_type(
4256                    tag,
4257                    ::buffa::encoding::WireType::LengthDelimited,
4258                )?;
4259                ::buffa::Message::merge_length_delimited(
4260                    self.amount_e18.get_or_insert_default(),
4261                    buf,
4262                    ctx,
4263                )?;
4264            }
4265            3u32 => {
4266                ::buffa::encoding::check_wire_type(
4267                    tag,
4268                    ::buffa::encoding::WireType::Varint,
4269                )?;
4270                self.transfer_code = ::buffa::EnumValue::from(
4271                    ::buffa::types::decode_int32(buf)?,
4272                );
4273            }
4274            4u32 => {
4275                ::buffa::encoding::check_wire_type(
4276                    tag,
4277                    ::buffa::encoding::WireType::Varint,
4278                )?;
4279                self.account_code = ::buffa::EnumValue::from(
4280                    ::buffa::types::decode_int32(buf)?,
4281                );
4282            }
4283            5u32 => {
4284                ::buffa::encoding::check_wire_type(
4285                    tag,
4286                    ::buffa::encoding::WireType::Varint,
4287                )?;
4288                self.ts_us = ::buffa::types::decode_uint64(buf)?;
4289            }
4290            9u32 => {
4291                ::buffa::encoding::check_wire_type(
4292                    tag,
4293                    ::buffa::encoding::WireType::LengthDelimited,
4294                )?;
4295                ::buffa::Message::merge_length_delimited(
4296                    self.balance_after_e18.get_or_insert_default(),
4297                    buf,
4298                    ctx,
4299                )?;
4300            }
4301            10u32 => {
4302                ::buffa::encoding::check_wire_type(
4303                    tag,
4304                    ::buffa::encoding::WireType::Varint,
4305                )?;
4306                self.is_debit = ::buffa::types::decode_bool(buf)?;
4307            }
4308            11u32 => {
4309                ::buffa::encoding::check_wire_type(
4310                    tag,
4311                    ::buffa::encoding::WireType::Varint,
4312                )?;
4313                self.link_id = ::buffa::types::decode_uint64(buf)?;
4314            }
4315            12u32 => {
4316                ::buffa::encoding::check_wire_type(
4317                    tag,
4318                    ::buffa::encoding::WireType::LengthDelimited,
4319                )?;
4320                ::buffa::types::merge_string(&mut self.flow_id, buf)?;
4321            }
4322            13u32 => {
4323                ::buffa::encoding::check_wire_type(
4324                    tag,
4325                    ::buffa::encoding::WireType::LengthDelimited,
4326                )?;
4327                ::buffa::Message::merge_length_delimited(
4328                    self.source.get_or_insert_default(),
4329                    buf,
4330                    ctx,
4331                )?;
4332            }
4333            14u32 => {
4334                ::buffa::encoding::check_wire_type(
4335                    tag,
4336                    ::buffa::encoding::WireType::LengthDelimited,
4337                )?;
4338                ::buffa::Message::merge_length_delimited(
4339                    self.destination.get_or_insert_default(),
4340                    buf,
4341                    ctx,
4342                )?;
4343            }
4344            _ => {
4345                self.__buffa_unknown_fields
4346                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4347            }
4348        }
4349        ::core::result::Result::Ok(())
4350    }
4351    fn clear(&mut self) {
4352        self.asset_id = 0u32;
4353        self.amount_e18 = ::buffa::MessageField::none();
4354        self.transfer_code = ::buffa::EnumValue::from(0);
4355        self.account_code = ::buffa::EnumValue::from(0);
4356        self.ts_us = 0u64;
4357        self.balance_after_e18 = ::buffa::MessageField::none();
4358        self.is_debit = false;
4359        self.link_id = 0u64;
4360        self.flow_id.clear();
4361        self.source = ::buffa::MessageField::none();
4362        self.destination = ::buffa::MessageField::none();
4363        self.__buffa_unknown_fields.clear();
4364    }
4365}
4366impl ::buffa::ExtensionSet for TransferRow {
4367    const PROTO_FQN: &'static str = "ledger.read.v1.TransferRow";
4368    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4369        &self.__buffa_unknown_fields
4370    }
4371    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4372        &mut self.__buffa_unknown_fields
4373    }
4374}
4375impl ::buffa::json_helpers::ProtoElemJson for TransferRow {
4376    fn serialize_proto_json<S: ::serde::Serializer>(
4377        v: &Self,
4378        s: S,
4379    ) -> ::core::result::Result<S::Ok, S::Error> {
4380        ::serde::Serialize::serialize(v, s)
4381    }
4382    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4383        d: D,
4384    ) -> ::core::result::Result<Self, D::Error> {
4385        <Self as ::serde::Deserialize>::deserialize(d)
4386    }
4387}
4388#[doc(hidden)]
4389pub const __TRANSFER_ROW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4390    type_url: "type.googleapis.com/ledger.read.v1.TransferRow",
4391    to_json: ::buffa::type_registry::any_to_json::<TransferRow>,
4392    from_json: ::buffa::type_registry::any_from_json::<TransferRow>,
4393    is_wkt: false,
4394};
4395/// ListTransfersResponse contains transfer rows and an optional continuation cursor.
4396#[derive(Clone, PartialEq, Default)]
4397#[derive(::serde::Serialize, ::serde::Deserialize)]
4398#[serde(default)]
4399pub struct ListTransfersResponse {
4400    /// Transfer rows in requested order.
4401    ///
4402    /// Field 1: `transfers`
4403    #[serde(
4404        rename = "transfers",
4405        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
4406        deserialize_with = "::buffa::json_helpers::null_as_default"
4407    )]
4408    pub transfers: ::buffa::alloc::vec::Vec<TransferRow>,
4409    /// Opaque cursor for the next page. Empty when no more results exist.
4410    ///
4411    /// Field 3: `next_page_token`
4412    #[serde(
4413        rename = "nextPageToken",
4414        alias = "next_page_token",
4415        with = "::buffa::json_helpers::proto_string",
4416        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4417    )]
4418    pub next_page_token: ::buffa::alloc::string::String,
4419    #[serde(skip)]
4420    #[doc(hidden)]
4421    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4422}
4423impl ::core::fmt::Debug for ListTransfersResponse {
4424    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4425        f.debug_struct("ListTransfersResponse")
4426            .field("transfers", &self.transfers)
4427            .field("next_page_token", &self.next_page_token)
4428            .finish()
4429    }
4430}
4431impl ListTransfersResponse {
4432    /// Protobuf type URL for this message, for use with `Any::pack` and
4433    /// `Any::unpack_if`.
4434    ///
4435    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4436    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListTransfersResponse";
4437}
4438::buffa::impl_default_instance!(ListTransfersResponse);
4439impl ::buffa::MessageName for ListTransfersResponse {
4440    const PACKAGE: &'static str = "ledger.read.v1";
4441    const NAME: &'static str = "ListTransfersResponse";
4442    const FULL_NAME: &'static str = "ledger.read.v1.ListTransfersResponse";
4443    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListTransfersResponse";
4444}
4445impl ::buffa::Message for ListTransfersResponse {
4446    /// Returns the total encoded size in bytes.
4447    ///
4448    /// The result is a `u32`; the protobuf specification requires all
4449    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4450    /// compliant message will never overflow this type.
4451    #[allow(clippy::let_and_return)]
4452    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4453        #[allow(unused_imports)]
4454        use ::buffa::Enumeration as _;
4455        let mut size = 0u32;
4456        for v in &self.transfers {
4457            let __slot = __cache.reserve();
4458            let inner_size = v.compute_size(__cache);
4459            __cache.set(__slot, inner_size);
4460            size
4461                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4462                    + inner_size;
4463        }
4464        if !self.next_page_token.is_empty() {
4465            size
4466                += 1u32
4467                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
4468        }
4469        size += self.__buffa_unknown_fields.encoded_len() as u32;
4470        size
4471    }
4472    fn write_to(
4473        &self,
4474        __cache: &mut ::buffa::SizeCache,
4475        buf: &mut impl ::buffa::bytes::BufMut,
4476    ) {
4477        #[allow(unused_imports)]
4478        use ::buffa::Enumeration as _;
4479        for v in &self.transfers {
4480            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
4481            v.write_to(__cache, buf);
4482        }
4483        if !self.next_page_token.is_empty() {
4484            ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
4485        }
4486        self.__buffa_unknown_fields.write_to(buf);
4487    }
4488    fn merge_field(
4489        &mut self,
4490        tag: ::buffa::encoding::Tag,
4491        buf: &mut impl ::buffa::bytes::Buf,
4492        ctx: ::buffa::DecodeContext<'_>,
4493    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4494        #[allow(unused_imports)]
4495        use ::buffa::bytes::Buf as _;
4496        #[allow(unused_imports)]
4497        use ::buffa::Enumeration as _;
4498        match tag.field_number() {
4499            1u32 => {
4500                ::buffa::encoding::check_wire_type(
4501                    tag,
4502                    ::buffa::encoding::WireType::LengthDelimited,
4503                )?;
4504                let mut elem = ::core::default::Default::default();
4505                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
4506                self.transfers.push(elem);
4507            }
4508            3u32 => {
4509                ::buffa::encoding::check_wire_type(
4510                    tag,
4511                    ::buffa::encoding::WireType::LengthDelimited,
4512                )?;
4513                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
4514            }
4515            _ => {
4516                self.__buffa_unknown_fields
4517                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4518            }
4519        }
4520        ::core::result::Result::Ok(())
4521    }
4522    fn clear(&mut self) {
4523        self.transfers.clear();
4524        self.next_page_token.clear();
4525        self.__buffa_unknown_fields.clear();
4526    }
4527}
4528impl ::buffa::ExtensionSet for ListTransfersResponse {
4529    const PROTO_FQN: &'static str = "ledger.read.v1.ListTransfersResponse";
4530    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4531        &self.__buffa_unknown_fields
4532    }
4533    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4534        &mut self.__buffa_unknown_fields
4535    }
4536}
4537impl ::buffa::json_helpers::ProtoElemJson for ListTransfersResponse {
4538    fn serialize_proto_json<S: ::serde::Serializer>(
4539        v: &Self,
4540        s: S,
4541    ) -> ::core::result::Result<S::Ok, S::Error> {
4542        ::serde::Serialize::serialize(v, s)
4543    }
4544    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4545        d: D,
4546    ) -> ::core::result::Result<Self, D::Error> {
4547        <Self as ::serde::Deserialize>::deserialize(d)
4548    }
4549}
4550#[doc(hidden)]
4551pub const __LIST_TRANSFERS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4552    type_url: "type.googleapis.com/ledger.read.v1.ListTransfersResponse",
4553    to_json: ::buffa::type_registry::any_to_json::<ListTransfersResponse>,
4554    from_json: ::buffa::type_registry::any_from_json::<ListTransfersResponse>,
4555    is_wkt: false,
4556};
4557#[derive(Clone, PartialEq, Default)]
4558#[derive(::serde::Serialize, ::serde::Deserialize)]
4559#[serde(default)]
4560pub struct ListHoldsRequest {
4561    /// Optional sub-account to scope holds to. If omitted, holds are listed for
4562    /// the authenticated root account derived from the JWT or API key.
4563    ///
4564    /// Field 1: `subaccount_id`
4565    #[serde(
4566        rename = "subaccountId",
4567        alias = "subaccount_id",
4568        with = "::buffa::json_helpers::opt_uint64",
4569        skip_serializing_if = "::core::option::Option::is_none"
4570    )]
4571    pub subaccount_id: ::core::option::Option<u64>,
4572    /// Maximum number of holds to return. Defaults to 100 when omitted; maximum is
4573    /// 1000.
4574    ///
4575    /// Field 2: `limit`
4576    #[serde(
4577        rename = "limit",
4578        with = "::buffa::json_helpers::uint32",
4579        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4580    )]
4581    pub limit: u32,
4582    /// true=newest first; false=oldest first.
4583    ///
4584    /// Field 3: `reversed`
4585    #[serde(
4586        rename = "reversed",
4587        with = "::buffa::json_helpers::proto_bool",
4588        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
4589    )]
4590    pub reversed: bool,
4591    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
4592    /// bound to account, sub-account scope, and sort direction.
4593    ///
4594    /// Field 4: `page_token`
4595    #[serde(
4596        rename = "pageToken",
4597        alias = "page_token",
4598        with = "::buffa::json_helpers::proto_string",
4599        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4600    )]
4601    pub page_token: ::buffa::alloc::string::String,
4602    #[serde(skip)]
4603    #[doc(hidden)]
4604    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4605}
4606impl ::core::fmt::Debug for ListHoldsRequest {
4607    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4608        f.debug_struct("ListHoldsRequest")
4609            .field("subaccount_id", &self.subaccount_id)
4610            .field("limit", &self.limit)
4611            .field("reversed", &self.reversed)
4612            .field("page_token", &self.page_token)
4613            .finish()
4614    }
4615}
4616impl ListHoldsRequest {
4617    /// Protobuf type URL for this message, for use with `Any::pack` and
4618    /// `Any::unpack_if`.
4619    ///
4620    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4621    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListHoldsRequest";
4622}
4623impl ListHoldsRequest {
4624    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4625    #[inline]
4626    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
4627    pub fn with_subaccount_id(mut self, value: u64) -> Self {
4628        self.subaccount_id = Some(value);
4629        self
4630    }
4631}
4632::buffa::impl_default_instance!(ListHoldsRequest);
4633impl ::buffa::MessageName for ListHoldsRequest {
4634    const PACKAGE: &'static str = "ledger.read.v1";
4635    const NAME: &'static str = "ListHoldsRequest";
4636    const FULL_NAME: &'static str = "ledger.read.v1.ListHoldsRequest";
4637    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListHoldsRequest";
4638}
4639impl ::buffa::Message for ListHoldsRequest {
4640    /// Returns the total encoded size in bytes.
4641    ///
4642    /// The result is a `u32`; the protobuf specification requires all
4643    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4644    /// compliant message will never overflow this type.
4645    #[allow(clippy::let_and_return)]
4646    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
4647        #[allow(unused_imports)]
4648        use ::buffa::Enumeration as _;
4649        let mut size = 0u32;
4650        if self.subaccount_id.is_some() {
4651            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4652        }
4653        if self.limit != 0u32 {
4654            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
4655        }
4656        if self.reversed {
4657            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4658        }
4659        if !self.page_token.is_empty() {
4660            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
4661        }
4662        size += self.__buffa_unknown_fields.encoded_len() as u32;
4663        size
4664    }
4665    fn write_to(
4666        &self,
4667        _cache: &mut ::buffa::SizeCache,
4668        buf: &mut impl ::buffa::bytes::BufMut,
4669    ) {
4670        #[allow(unused_imports)]
4671        use ::buffa::Enumeration as _;
4672        if let Some(v) = self.subaccount_id {
4673            ::buffa::types::put_fixed64_field(1u32, v, buf);
4674        }
4675        if self.limit != 0u32 {
4676            ::buffa::types::put_uint32_field(2u32, self.limit, buf);
4677        }
4678        if self.reversed {
4679            ::buffa::types::put_bool_field(3u32, self.reversed, buf);
4680        }
4681        if !self.page_token.is_empty() {
4682            ::buffa::types::put_string_field(4u32, &self.page_token, buf);
4683        }
4684        self.__buffa_unknown_fields.write_to(buf);
4685    }
4686    fn merge_field(
4687        &mut self,
4688        tag: ::buffa::encoding::Tag,
4689        buf: &mut impl ::buffa::bytes::Buf,
4690        ctx: ::buffa::DecodeContext<'_>,
4691    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4692        #[allow(unused_imports)]
4693        use ::buffa::bytes::Buf as _;
4694        #[allow(unused_imports)]
4695        use ::buffa::Enumeration as _;
4696        match tag.field_number() {
4697            1u32 => {
4698                ::buffa::encoding::check_wire_type(
4699                    tag,
4700                    ::buffa::encoding::WireType::Fixed64,
4701                )?;
4702                self.subaccount_id = ::core::option::Option::Some(
4703                    ::buffa::types::decode_fixed64(buf)?,
4704                );
4705            }
4706            2u32 => {
4707                ::buffa::encoding::check_wire_type(
4708                    tag,
4709                    ::buffa::encoding::WireType::Varint,
4710                )?;
4711                self.limit = ::buffa::types::decode_uint32(buf)?;
4712            }
4713            3u32 => {
4714                ::buffa::encoding::check_wire_type(
4715                    tag,
4716                    ::buffa::encoding::WireType::Varint,
4717                )?;
4718                self.reversed = ::buffa::types::decode_bool(buf)?;
4719            }
4720            4u32 => {
4721                ::buffa::encoding::check_wire_type(
4722                    tag,
4723                    ::buffa::encoding::WireType::LengthDelimited,
4724                )?;
4725                ::buffa::types::merge_string(&mut self.page_token, buf)?;
4726            }
4727            _ => {
4728                self.__buffa_unknown_fields
4729                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4730            }
4731        }
4732        ::core::result::Result::Ok(())
4733    }
4734    fn clear(&mut self) {
4735        self.subaccount_id = ::core::option::Option::None;
4736        self.limit = 0u32;
4737        self.reversed = false;
4738        self.page_token.clear();
4739        self.__buffa_unknown_fields.clear();
4740    }
4741}
4742impl ::buffa::ExtensionSet for ListHoldsRequest {
4743    const PROTO_FQN: &'static str = "ledger.read.v1.ListHoldsRequest";
4744    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4745        &self.__buffa_unknown_fields
4746    }
4747    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4748        &mut self.__buffa_unknown_fields
4749    }
4750}
4751impl ::buffa::json_helpers::ProtoElemJson for ListHoldsRequest {
4752    fn serialize_proto_json<S: ::serde::Serializer>(
4753        v: &Self,
4754        s: S,
4755    ) -> ::core::result::Result<S::Ok, S::Error> {
4756        ::serde::Serialize::serialize(v, s)
4757    }
4758    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4759        d: D,
4760    ) -> ::core::result::Result<Self, D::Error> {
4761        <Self as ::serde::Deserialize>::deserialize(d)
4762    }
4763}
4764#[doc(hidden)]
4765pub const __LIST_HOLDS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4766    type_url: "type.googleapis.com/ledger.read.v1.ListHoldsRequest",
4767    to_json: ::buffa::type_registry::any_to_json::<ListHoldsRequest>,
4768    from_json: ::buffa::type_registry::any_from_json::<ListHoldsRequest>,
4769    is_wkt: false,
4770};
4771/// Hold row with compact integers and client-side resolution.
4772#[derive(Clone, PartialEq, Default)]
4773#[derive(::serde::Serialize, ::serde::Deserialize)]
4774#[serde(default)]
4775pub struct HoldRow {
4776    /// pending transfer id (numeric)
4777    ///
4778    /// Field 1: `hold_id`
4779    #[serde(
4780        rename = "holdId",
4781        alias = "hold_id",
4782        with = "::buffa::json_helpers::uint64",
4783        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4784    )]
4785    pub hold_id: u64,
4786    /// Reserved amount at fixed 18-decimal ledger scale.
4787    ///
4788    /// Field 2: `amount_reserved_e18`
4789    #[serde(
4790        rename = "amountReservedE18",
4791        alias = "amount_reserved_e18",
4792        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4793    )]
4794    pub amount_reserved_e18: ::buffa::MessageField<
4795        super::super::super::polyester::r#type::v1::U128,
4796    >,
4797    /// Public unified asset id.
4798    ///
4799    /// Field 3: `asset_id`
4800    #[serde(
4801        rename = "assetId",
4802        alias = "asset_id",
4803        with = "::buffa::json_helpers::uint32",
4804        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4805    )]
4806    pub asset_id: u32,
4807    /// Expiration time in nanoseconds since epoch (UTC).
4808    ///
4809    /// Field 4: `expires_at_ns`
4810    #[serde(
4811        rename = "expiresAtNs",
4812        alias = "expires_at_ns",
4813        with = "::buffa::json_helpers::uint64",
4814        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4815    )]
4816    pub expires_at_ns: u64,
4817    #[serde(skip)]
4818    #[doc(hidden)]
4819    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4820}
4821impl ::core::fmt::Debug for HoldRow {
4822    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4823        f.debug_struct("HoldRow")
4824            .field("hold_id", &self.hold_id)
4825            .field("amount_reserved_e18", &self.amount_reserved_e18)
4826            .field("asset_id", &self.asset_id)
4827            .field("expires_at_ns", &self.expires_at_ns)
4828            .finish()
4829    }
4830}
4831impl HoldRow {
4832    /// Protobuf type URL for this message, for use with `Any::pack` and
4833    /// `Any::unpack_if`.
4834    ///
4835    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4836    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.HoldRow";
4837}
4838::buffa::impl_default_instance!(HoldRow);
4839impl ::buffa::MessageName for HoldRow {
4840    const PACKAGE: &'static str = "ledger.read.v1";
4841    const NAME: &'static str = "HoldRow";
4842    const FULL_NAME: &'static str = "ledger.read.v1.HoldRow";
4843    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.HoldRow";
4844}
4845impl ::buffa::Message for HoldRow {
4846    /// Returns the total encoded size in bytes.
4847    ///
4848    /// The result is a `u32`; the protobuf specification requires all
4849    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4850    /// compliant message will never overflow this type.
4851    #[allow(clippy::let_and_return)]
4852    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4853        #[allow(unused_imports)]
4854        use ::buffa::Enumeration as _;
4855        let mut size = 0u32;
4856        if self.hold_id != 0u64 {
4857            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4858        }
4859        if self.amount_reserved_e18.is_set() {
4860            let __slot = __cache.reserve();
4861            let inner_size = self.amount_reserved_e18.compute_size(__cache);
4862            __cache.set(__slot, inner_size);
4863            size
4864                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4865                    + inner_size;
4866        }
4867        if self.asset_id != 0u32 {
4868            size += 1u32 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
4869        }
4870        if self.expires_at_ns != 0u64 {
4871            size += 1u32 + ::buffa::types::uint64_encoded_len(self.expires_at_ns) as u32;
4872        }
4873        size += self.__buffa_unknown_fields.encoded_len() as u32;
4874        size
4875    }
4876    fn write_to(
4877        &self,
4878        __cache: &mut ::buffa::SizeCache,
4879        buf: &mut impl ::buffa::bytes::BufMut,
4880    ) {
4881        #[allow(unused_imports)]
4882        use ::buffa::Enumeration as _;
4883        if self.hold_id != 0u64 {
4884            ::buffa::types::put_fixed64_field(1u32, self.hold_id, buf);
4885        }
4886        if self.amount_reserved_e18.is_set() {
4887            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
4888            self.amount_reserved_e18.write_to(__cache, buf);
4889        }
4890        if self.asset_id != 0u32 {
4891            ::buffa::types::put_uint32_field(3u32, self.asset_id, buf);
4892        }
4893        if self.expires_at_ns != 0u64 {
4894            ::buffa::types::put_uint64_field(4u32, self.expires_at_ns, buf);
4895        }
4896        self.__buffa_unknown_fields.write_to(buf);
4897    }
4898    fn merge_field(
4899        &mut self,
4900        tag: ::buffa::encoding::Tag,
4901        buf: &mut impl ::buffa::bytes::Buf,
4902        ctx: ::buffa::DecodeContext<'_>,
4903    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4904        #[allow(unused_imports)]
4905        use ::buffa::bytes::Buf as _;
4906        #[allow(unused_imports)]
4907        use ::buffa::Enumeration as _;
4908        match tag.field_number() {
4909            1u32 => {
4910                ::buffa::encoding::check_wire_type(
4911                    tag,
4912                    ::buffa::encoding::WireType::Fixed64,
4913                )?;
4914                self.hold_id = ::buffa::types::decode_fixed64(buf)?;
4915            }
4916            2u32 => {
4917                ::buffa::encoding::check_wire_type(
4918                    tag,
4919                    ::buffa::encoding::WireType::LengthDelimited,
4920                )?;
4921                ::buffa::Message::merge_length_delimited(
4922                    self.amount_reserved_e18.get_or_insert_default(),
4923                    buf,
4924                    ctx,
4925                )?;
4926            }
4927            3u32 => {
4928                ::buffa::encoding::check_wire_type(
4929                    tag,
4930                    ::buffa::encoding::WireType::Varint,
4931                )?;
4932                self.asset_id = ::buffa::types::decode_uint32(buf)?;
4933            }
4934            4u32 => {
4935                ::buffa::encoding::check_wire_type(
4936                    tag,
4937                    ::buffa::encoding::WireType::Varint,
4938                )?;
4939                self.expires_at_ns = ::buffa::types::decode_uint64(buf)?;
4940            }
4941            _ => {
4942                self.__buffa_unknown_fields
4943                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4944            }
4945        }
4946        ::core::result::Result::Ok(())
4947    }
4948    fn clear(&mut self) {
4949        self.hold_id = 0u64;
4950        self.amount_reserved_e18 = ::buffa::MessageField::none();
4951        self.asset_id = 0u32;
4952        self.expires_at_ns = 0u64;
4953        self.__buffa_unknown_fields.clear();
4954    }
4955}
4956impl ::buffa::ExtensionSet for HoldRow {
4957    const PROTO_FQN: &'static str = "ledger.read.v1.HoldRow";
4958    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4959        &self.__buffa_unknown_fields
4960    }
4961    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4962        &mut self.__buffa_unknown_fields
4963    }
4964}
4965impl ::buffa::json_helpers::ProtoElemJson for HoldRow {
4966    fn serialize_proto_json<S: ::serde::Serializer>(
4967        v: &Self,
4968        s: S,
4969    ) -> ::core::result::Result<S::Ok, S::Error> {
4970        ::serde::Serialize::serialize(v, s)
4971    }
4972    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4973        d: D,
4974    ) -> ::core::result::Result<Self, D::Error> {
4975        <Self as ::serde::Deserialize>::deserialize(d)
4976    }
4977}
4978#[doc(hidden)]
4979pub const __HOLD_ROW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4980    type_url: "type.googleapis.com/ledger.read.v1.HoldRow",
4981    to_json: ::buffa::type_registry::any_to_json::<HoldRow>,
4982    from_json: ::buffa::type_registry::any_from_json::<HoldRow>,
4983    is_wkt: false,
4984};
4985#[derive(Clone, PartialEq, Default)]
4986#[derive(::serde::Serialize, ::serde::Deserialize)]
4987#[serde(default)]
4988pub struct ListHoldsResponse {
4989    /// Hold rows in the sort direction requested by the caller.
4990    ///
4991    /// Field 1: `holds`
4992    #[serde(
4993        rename = "holds",
4994        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
4995        deserialize_with = "::buffa::json_helpers::null_as_default"
4996    )]
4997    pub holds: ::buffa::alloc::vec::Vec<HoldRow>,
4998    /// Opaque cursor for the next page. Empty when no more results exist.
4999    ///
5000    /// Field 2: `next_page_token`
5001    #[serde(
5002        rename = "nextPageToken",
5003        alias = "next_page_token",
5004        with = "::buffa::json_helpers::proto_string",
5005        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5006    )]
5007    pub next_page_token: ::buffa::alloc::string::String,
5008    #[serde(skip)]
5009    #[doc(hidden)]
5010    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5011}
5012impl ::core::fmt::Debug for ListHoldsResponse {
5013    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5014        f.debug_struct("ListHoldsResponse")
5015            .field("holds", &self.holds)
5016            .field("next_page_token", &self.next_page_token)
5017            .finish()
5018    }
5019}
5020impl ListHoldsResponse {
5021    /// Protobuf type URL for this message, for use with `Any::pack` and
5022    /// `Any::unpack_if`.
5023    ///
5024    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5025    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListHoldsResponse";
5026}
5027::buffa::impl_default_instance!(ListHoldsResponse);
5028impl ::buffa::MessageName for ListHoldsResponse {
5029    const PACKAGE: &'static str = "ledger.read.v1";
5030    const NAME: &'static str = "ListHoldsResponse";
5031    const FULL_NAME: &'static str = "ledger.read.v1.ListHoldsResponse";
5032    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListHoldsResponse";
5033}
5034impl ::buffa::Message for ListHoldsResponse {
5035    /// Returns the total encoded size in bytes.
5036    ///
5037    /// The result is a `u32`; the protobuf specification requires all
5038    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5039    /// compliant message will never overflow this type.
5040    #[allow(clippy::let_and_return)]
5041    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5042        #[allow(unused_imports)]
5043        use ::buffa::Enumeration as _;
5044        let mut size = 0u32;
5045        for v in &self.holds {
5046            let __slot = __cache.reserve();
5047            let inner_size = v.compute_size(__cache);
5048            __cache.set(__slot, inner_size);
5049            size
5050                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5051                    + inner_size;
5052        }
5053        if !self.next_page_token.is_empty() {
5054            size
5055                += 1u32
5056                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
5057        }
5058        size += self.__buffa_unknown_fields.encoded_len() as u32;
5059        size
5060    }
5061    fn write_to(
5062        &self,
5063        __cache: &mut ::buffa::SizeCache,
5064        buf: &mut impl ::buffa::bytes::BufMut,
5065    ) {
5066        #[allow(unused_imports)]
5067        use ::buffa::Enumeration as _;
5068        for v in &self.holds {
5069            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
5070            v.write_to(__cache, buf);
5071        }
5072        if !self.next_page_token.is_empty() {
5073            ::buffa::types::put_string_field(2u32, &self.next_page_token, buf);
5074        }
5075        self.__buffa_unknown_fields.write_to(buf);
5076    }
5077    fn merge_field(
5078        &mut self,
5079        tag: ::buffa::encoding::Tag,
5080        buf: &mut impl ::buffa::bytes::Buf,
5081        ctx: ::buffa::DecodeContext<'_>,
5082    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5083        #[allow(unused_imports)]
5084        use ::buffa::bytes::Buf as _;
5085        #[allow(unused_imports)]
5086        use ::buffa::Enumeration as _;
5087        match tag.field_number() {
5088            1u32 => {
5089                ::buffa::encoding::check_wire_type(
5090                    tag,
5091                    ::buffa::encoding::WireType::LengthDelimited,
5092                )?;
5093                let mut elem = ::core::default::Default::default();
5094                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5095                self.holds.push(elem);
5096            }
5097            2u32 => {
5098                ::buffa::encoding::check_wire_type(
5099                    tag,
5100                    ::buffa::encoding::WireType::LengthDelimited,
5101                )?;
5102                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
5103            }
5104            _ => {
5105                self.__buffa_unknown_fields
5106                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5107            }
5108        }
5109        ::core::result::Result::Ok(())
5110    }
5111    fn clear(&mut self) {
5112        self.holds.clear();
5113        self.next_page_token.clear();
5114        self.__buffa_unknown_fields.clear();
5115    }
5116}
5117impl ::buffa::ExtensionSet for ListHoldsResponse {
5118    const PROTO_FQN: &'static str = "ledger.read.v1.ListHoldsResponse";
5119    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5120        &self.__buffa_unknown_fields
5121    }
5122    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5123        &mut self.__buffa_unknown_fields
5124    }
5125}
5126impl ::buffa::json_helpers::ProtoElemJson for ListHoldsResponse {
5127    fn serialize_proto_json<S: ::serde::Serializer>(
5128        v: &Self,
5129        s: S,
5130    ) -> ::core::result::Result<S::Ok, S::Error> {
5131        ::serde::Serialize::serialize(v, s)
5132    }
5133    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5134        d: D,
5135    ) -> ::core::result::Result<Self, D::Error> {
5136        <Self as ::serde::Deserialize>::deserialize(d)
5137    }
5138}
5139#[doc(hidden)]
5140pub const __LIST_HOLDS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5141    type_url: "type.googleapis.com/ledger.read.v1.ListHoldsResponse",
5142    to_json: ::buffa::type_registry::any_to_json::<ListHoldsResponse>,
5143    from_json: ::buffa::type_registry::any_from_json::<ListHoldsResponse>,
5144    is_wkt: false,
5145};
5146/// ErrorDetail is attached to ConnectRPC errors for structured error handling.
5147/// Clients can inspect this to get a stable machine-readable error code.
5148#[derive(Clone, PartialEq, Default)]
5149#[derive(::serde::Serialize, ::serde::Deserialize)]
5150#[serde(default)]
5151pub struct ErrorDetail {
5152    /// Stable error code matching the REST problem+json "code" field.
5153    ///
5154    /// Field 1: `code`
5155    #[serde(
5156        rename = "code",
5157        with = "::buffa::json_helpers::proto_enum",
5158        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5159    )]
5160    pub code: ::buffa::EnumValue<ErrorCode>,
5161    #[serde(skip)]
5162    #[doc(hidden)]
5163    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5164}
5165impl ::core::fmt::Debug for ErrorDetail {
5166    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5167        f.debug_struct("ErrorDetail").field("code", &self.code).finish()
5168    }
5169}
5170impl ErrorDetail {
5171    /// Protobuf type URL for this message, for use with `Any::pack` and
5172    /// `Any::unpack_if`.
5173    ///
5174    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5175    pub const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ErrorDetail";
5176}
5177::buffa::impl_default_instance!(ErrorDetail);
5178impl ::buffa::MessageName for ErrorDetail {
5179    const PACKAGE: &'static str = "ledger.read.v1";
5180    const NAME: &'static str = "ErrorDetail";
5181    const FULL_NAME: &'static str = "ledger.read.v1.ErrorDetail";
5182    const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ErrorDetail";
5183}
5184impl ::buffa::Message for ErrorDetail {
5185    /// Returns the total encoded size in bytes.
5186    ///
5187    /// The result is a `u32`; the protobuf specification requires all
5188    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5189    /// compliant message will never overflow this type.
5190    #[allow(clippy::let_and_return)]
5191    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5192        #[allow(unused_imports)]
5193        use ::buffa::Enumeration as _;
5194        let mut size = 0u32;
5195        {
5196            let val = self.code.to_i32();
5197            if val != 0 {
5198                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5199            }
5200        }
5201        size += self.__buffa_unknown_fields.encoded_len() as u32;
5202        size
5203    }
5204    fn write_to(
5205        &self,
5206        _cache: &mut ::buffa::SizeCache,
5207        buf: &mut impl ::buffa::bytes::BufMut,
5208    ) {
5209        #[allow(unused_imports)]
5210        use ::buffa::Enumeration as _;
5211        {
5212            let val = self.code.to_i32();
5213            if val != 0 {
5214                ::buffa::types::put_int32_field(1u32, val, buf);
5215            }
5216        }
5217        self.__buffa_unknown_fields.write_to(buf);
5218    }
5219    fn merge_field(
5220        &mut self,
5221        tag: ::buffa::encoding::Tag,
5222        buf: &mut impl ::buffa::bytes::Buf,
5223        ctx: ::buffa::DecodeContext<'_>,
5224    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5225        #[allow(unused_imports)]
5226        use ::buffa::bytes::Buf as _;
5227        #[allow(unused_imports)]
5228        use ::buffa::Enumeration as _;
5229        match tag.field_number() {
5230            1u32 => {
5231                ::buffa::encoding::check_wire_type(
5232                    tag,
5233                    ::buffa::encoding::WireType::Varint,
5234                )?;
5235                self.code = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
5236            }
5237            _ => {
5238                self.__buffa_unknown_fields
5239                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5240            }
5241        }
5242        ::core::result::Result::Ok(())
5243    }
5244    fn clear(&mut self) {
5245        self.code = ::buffa::EnumValue::from(0);
5246        self.__buffa_unknown_fields.clear();
5247    }
5248}
5249impl ::buffa::ExtensionSet for ErrorDetail {
5250    const PROTO_FQN: &'static str = "ledger.read.v1.ErrorDetail";
5251    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5252        &self.__buffa_unknown_fields
5253    }
5254    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5255        &mut self.__buffa_unknown_fields
5256    }
5257}
5258impl ::buffa::json_helpers::ProtoElemJson for ErrorDetail {
5259    fn serialize_proto_json<S: ::serde::Serializer>(
5260        v: &Self,
5261        s: S,
5262    ) -> ::core::result::Result<S::Ok, S::Error> {
5263        ::serde::Serialize::serialize(v, s)
5264    }
5265    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5266        d: D,
5267    ) -> ::core::result::Result<Self, D::Error> {
5268        <Self as ::serde::Deserialize>::deserialize(d)
5269    }
5270}
5271#[doc(hidden)]
5272pub const __ERROR_DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5273    type_url: "type.googleapis.com/ledger.read.v1.ErrorDetail",
5274    to_json: ::buffa::type_registry::any_to_json::<ErrorDetail>,
5275    from_json: ::buffa::type_registry::any_from_json::<ErrorDetail>,
5276    is_wkt: false,
5277};
5278#[allow(
5279    non_camel_case_types,
5280    dead_code,
5281    unused_imports,
5282    unused_qualifications,
5283    clippy::derivable_impls,
5284    clippy::match_single_binding,
5285    clippy::uninlined_format_args,
5286    clippy::doc_lazy_continuation,
5287    clippy::module_inception
5288)]
5289pub mod __buffa {
5290    #[allow(unused_imports)]
5291    use super::*;
5292    pub mod view {
5293        #[allow(unused_imports)]
5294        use super::*;
5295        /// Read surface for the Ledger (stable, versionable).
5296        ///
5297        /// Canonical amounts are represented as integer quantities:
5298        /// - IDs: fixed64/uint32
5299        /// - Ledger amounts: U128 (hi/lo) at fixed 18-decimal scale
5300        /// - Chart series: scaled integer vectors (e.g. *_q) with field-specific scales
5301        ///
5302        /// REST JSON responses render
5303        /// human-friendly decimal strings without duplicating REST message types here.
5304        #[derive(Clone, Debug, Default)]
5305        pub struct GetBalancesRequestView<'a> {
5306            /// Optional sub-account to scope balances to. If omitted, balances are
5307            /// returned for the authenticated root account derived from the JWT or API
5308            /// key. The logical account id itself is always derived from the caller's JWT
5309            /// or API key, not from this payload.
5310            ///
5311            /// Field 1: `subaccount_id`
5312            pub subaccount_id: ::core::option::Option<u64>,
5313            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
5314        }
5315        impl<'a> ::buffa::MessageView<'a> for GetBalancesRequestView<'a> {
5316            type Owned = super::super::GetBalancesRequest;
5317            fn decode_view(
5318                buf: &'a [u8],
5319            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5320                let __limit = ::core::cell::Cell::new(
5321                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
5322                );
5323                <Self as ::buffa::MessageView>::decode_view_ctx(
5324                    buf,
5325                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
5326                )
5327            }
5328            fn decode_view_with_ctx(
5329                buf: &'a [u8],
5330                ctx: ::buffa::DecodeContext<'_>,
5331            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5332                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
5333            }
5334            fn merge_view_field(
5335                &mut self,
5336                tag: ::buffa::encoding::Tag,
5337                cur: &'a [u8],
5338                before_tag: &'a [u8],
5339                ctx: ::buffa::DecodeContext<'_>,
5340            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
5341                let _ = ctx;
5342                #[allow(unused_variables)]
5343                let view = self;
5344                let mut cur = cur;
5345                match tag.field_number() {
5346                    1u32 => {
5347                        ::buffa::encoding::check_wire_type(
5348                            tag,
5349                            ::buffa::encoding::WireType::Fixed64,
5350                        )?;
5351                        view.subaccount_id = Some(
5352                            ::buffa::types::decode_fixed64(&mut cur)?,
5353                        );
5354                    }
5355                    _ => {
5356                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
5357                        let span_len = before_tag.len() - cur.len();
5358                        view.__buffa_unknown_fields
5359                            .push_record(before_tag, span_len, ctx)?;
5360                    }
5361                }
5362                ::core::result::Result::Ok(cur)
5363            }
5364            fn to_owned_message(
5365                &self,
5366            ) -> ::core::result::Result<
5367                super::super::GetBalancesRequest,
5368                ::buffa::DecodeError,
5369            > {
5370                self.to_owned_from_source(None)
5371            }
5372            #[allow(clippy::useless_conversion, clippy::needless_update)]
5373            fn to_owned_from_source(
5374                &self,
5375                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
5376            ) -> ::core::result::Result<
5377                super::super::GetBalancesRequest,
5378                ::buffa::DecodeError,
5379            > {
5380                #[allow(unused_imports)]
5381                use ::buffa::alloc::string::ToString as _;
5382                let _ = __buffa_src;
5383                ::core::result::Result::Ok(super::super::GetBalancesRequest {
5384                    subaccount_id: self.subaccount_id,
5385                    __buffa_unknown_fields: self
5386                        .__buffa_unknown_fields
5387                        .to_owned()?
5388                        .into(),
5389                    ..::core::default::Default::default()
5390                })
5391            }
5392        }
5393        impl<'a> ::buffa::ViewEncode<'a> for GetBalancesRequestView<'a> {
5394            #[allow(clippy::needless_borrow, clippy::let_and_return)]
5395            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5396                #[allow(unused_imports)]
5397                use ::buffa::Enumeration as _;
5398                let mut size = 0u32;
5399                if self.subaccount_id.is_some() {
5400                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5401                }
5402                size += self.__buffa_unknown_fields.encoded_len() as u32;
5403                size
5404            }
5405            #[allow(clippy::needless_borrow)]
5406            fn write_to(
5407                &self,
5408                _cache: &mut ::buffa::SizeCache,
5409                buf: &mut impl ::buffa::bytes::BufMut,
5410            ) {
5411                #[allow(unused_imports)]
5412                use ::buffa::Enumeration as _;
5413                if let Some(v) = self.subaccount_id {
5414                    ::buffa::types::put_fixed64_field(1u32, v, buf);
5415                }
5416                self.__buffa_unknown_fields.write_to(buf);
5417            }
5418        }
5419        /// Serializes this view as protobuf JSON.
5420        ///
5421        /// Implicit-presence fields with default values are omitted, `required`
5422        /// fields are always emitted, explicit-presence (`optional`) fields are
5423        /// emitted only when set, bytes fields are base64-encoded, and enum
5424        /// values are their proto name strings.
5425        ///
5426        /// This impl uses `serialize_map(None)` because the number of emitted
5427        /// fields depends on default-omission rules; serializers that require
5428        /// known map lengths (e.g. `bincode`) will return a runtime error.
5429        /// Use the owned message type for those formats.
5430        impl<'__a> ::serde::Serialize for GetBalancesRequestView<'__a> {
5431            fn serialize<__S: ::serde::Serializer>(
5432                &self,
5433                __s: __S,
5434            ) -> ::core::result::Result<__S::Ok, __S::Error> {
5435                use ::serde::ser::SerializeMap as _;
5436                let mut __map = __s.serialize_map(::core::option::Option::None)?;
5437                if let ::core::option::Option::Some(__v) = self.subaccount_id {
5438                    __map
5439                        .serialize_entry(
5440                            "subaccountId",
5441                            &::buffa::json_helpers::ProtoJson(&__v),
5442                        )?;
5443                }
5444                __map.end()
5445            }
5446        }
5447        impl<'a> ::buffa::MessageName for GetBalancesRequestView<'a> {
5448            const PACKAGE: &'static str = "ledger.read.v1";
5449            const NAME: &'static str = "GetBalancesRequest";
5450            const FULL_NAME: &'static str = "ledger.read.v1.GetBalancesRequest";
5451            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalancesRequest";
5452        }
5453        ::buffa::impl_default_view_instance!(GetBalancesRequestView);
5454        ::buffa::impl_view_reborrow!(GetBalancesRequestView);
5455        /** Self-contained, `'static` owned view of a `GetBalancesRequest` message.
5456
5457 Wraps [`::buffa::OwnedView`]`<`[`GetBalancesRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
5458
5459 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetBalancesRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
5460        #[derive(Clone, Debug)]
5461        pub struct GetBalancesRequestOwnedView(
5462            ::buffa::OwnedView<GetBalancesRequestView<'static>>,
5463        );
5464        impl GetBalancesRequestOwnedView {
5465            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
5466            ///
5467            /// The view borrows directly from the buffer's data; the buffer is
5468            /// retained inside the returned handle.
5469            ///
5470            /// # Errors
5471            ///
5472            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
5473            /// protobuf data.
5474            pub fn decode(
5475                bytes: ::buffa::bytes::Bytes,
5476            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5477                ::core::result::Result::Ok(
5478                    GetBalancesRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
5479                )
5480            }
5481            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
5482            /// max message size).
5483            ///
5484            /// # Errors
5485            ///
5486            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
5487            /// exceeds the configured limits.
5488            pub fn decode_with_options(
5489                bytes: ::buffa::bytes::Bytes,
5490                opts: &::buffa::DecodeOptions,
5491            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5492                ::core::result::Result::Ok(
5493                    GetBalancesRequestOwnedView(
5494                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
5495                    ),
5496                )
5497            }
5498            /// Build from an owned message via an encode → decode round-trip.
5499            ///
5500            /// # Errors
5501            ///
5502            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
5503            /// somehow invalid (should not happen for well-formed messages).
5504            pub fn from_owned(
5505                msg: &super::super::GetBalancesRequest,
5506            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5507                ::core::result::Result::Ok(
5508                    GetBalancesRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
5509                )
5510            }
5511            /// Borrow the full [`GetBalancesRequestView`] with its lifetime tied to `&self`.
5512            #[must_use]
5513            pub fn view(&self) -> &GetBalancesRequestView<'_> {
5514                self.0.reborrow()
5515            }
5516            /// Convert to the owned message type.
5517            ///
5518            /// # Errors
5519            ///
5520            /// Returns an error if re-materializing preserved unknown fields
5521            /// fails (e.g. the unknown-field limit is exceeded).
5522            pub fn to_owned_message(
5523                &self,
5524            ) -> ::core::result::Result<
5525                super::super::GetBalancesRequest,
5526                ::buffa::DecodeError,
5527            > {
5528                self.0.to_owned_message()
5529            }
5530            /// The underlying bytes buffer.
5531            #[must_use]
5532            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
5533                self.0.bytes()
5534            }
5535            /// Consume the handle, returning the underlying bytes buffer.
5536            #[must_use]
5537            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
5538                self.0.into_bytes()
5539            }
5540            /// Optional sub-account to scope balances to. If omitted, balances are
5541            /// returned for the authenticated root account derived from the JWT or API
5542            /// key. The logical account id itself is always derived from the caller's JWT
5543            /// or API key, not from this payload.
5544            ///
5545            /// Field 1: `subaccount_id`
5546            #[must_use]
5547            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
5548                self.0.reborrow().subaccount_id
5549            }
5550        }
5551        impl ::core::convert::From<::buffa::OwnedView<GetBalancesRequestView<'static>>>
5552        for GetBalancesRequestOwnedView {
5553            fn from(inner: ::buffa::OwnedView<GetBalancesRequestView<'static>>) -> Self {
5554                GetBalancesRequestOwnedView(inner)
5555            }
5556        }
5557        impl ::core::convert::From<GetBalancesRequestOwnedView>
5558        for ::buffa::OwnedView<GetBalancesRequestView<'static>> {
5559            fn from(wrapper: GetBalancesRequestOwnedView) -> Self {
5560                wrapper.0
5561            }
5562        }
5563        impl ::core::convert::AsRef<::buffa::OwnedView<GetBalancesRequestView<'static>>>
5564        for GetBalancesRequestOwnedView {
5565            fn as_ref(&self) -> &::buffa::OwnedView<GetBalancesRequestView<'static>> {
5566                &self.0
5567            }
5568        }
5569        impl ::buffa::HasMessageView for super::super::GetBalancesRequest {
5570            type View<'a> = GetBalancesRequestView<'a>;
5571            type ViewHandle = GetBalancesRequestOwnedView;
5572        }
5573        impl ::serde::Serialize for GetBalancesRequestOwnedView {
5574            fn serialize<__S: ::serde::Serializer>(
5575                &self,
5576                __s: __S,
5577            ) -> ::core::result::Result<__S::Ok, __S::Error> {
5578                ::serde::Serialize::serialize(&self.0, __s)
5579            }
5580        }
5581        /// Fixed-size representation for balances (for Protobuf/WS clients).
5582        /// Uses common U128 messages for amounts to keep schema tidy and consistent.
5583        #[derive(Clone, Debug, Default)]
5584        pub struct AssetBalanceView<'a> {
5585            /// Public unified asset id. Resolve symbol from SpotConfig; U128 amounts in
5586            /// this message always use fixed 18-decimal ledger scale.
5587            ///
5588            /// Field 1: `asset_id`
5589            pub asset_id: u32,
5590            /// Trading balance at fixed 18-decimal ledger scale.
5591            ///
5592            /// Field 2: `trading`
5593            pub trading: ::buffa::MessageFieldView<
5594                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
5595                    'a,
5596                >,
5597            >,
5598            /// Funding balance at fixed 18-decimal ledger scale.
5599            ///
5600            /// Field 3: `funding`
5601            pub funding: ::buffa::MessageFieldView<
5602                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
5603                    'a,
5604                >,
5605            >,
5606            /// Reserved amount in the trading bucket at fixed 18-decimal ledger scale.
5607            ///
5608            /// Field 4: `reserved`
5609            pub reserved: ::buffa::MessageFieldView<
5610                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
5611                    'a,
5612                >,
5613            >,
5614            /// Amount currently available for new trading activity at fixed 18-decimal
5615            /// ledger scale. This value already accounts for active reservations.
5616            ///
5617            /// Field 5: `available`
5618            pub available: ::buffa::MessageFieldView<
5619                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
5620                    'a,
5621                >,
5622            >,
5623            /// Opaque monotonic revision for the atomic trading, reserved, and available
5624            /// values. Higher means newer; zero means no trading state has been observed.
5625            ///
5626            /// Field 6: `trading_revision`
5627            pub trading_revision: u64,
5628            /// Opaque monotonic revision for the funding value. Higher means newer; zero
5629            /// means no funding state has been observed.
5630            ///
5631            /// Field 7: `funding_revision`
5632            pub funding_revision: u64,
5633            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
5634        }
5635        impl<'a> ::buffa::MessageView<'a> for AssetBalanceView<'a> {
5636            type Owned = super::super::AssetBalance;
5637            fn decode_view(
5638                buf: &'a [u8],
5639            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5640                let __limit = ::core::cell::Cell::new(
5641                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
5642                );
5643                <Self as ::buffa::MessageView>::decode_view_ctx(
5644                    buf,
5645                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
5646                )
5647            }
5648            fn decode_view_with_ctx(
5649                buf: &'a [u8],
5650                ctx: ::buffa::DecodeContext<'_>,
5651            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5652                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
5653            }
5654            fn merge_view_field(
5655                &mut self,
5656                tag: ::buffa::encoding::Tag,
5657                cur: &'a [u8],
5658                before_tag: &'a [u8],
5659                ctx: ::buffa::DecodeContext<'_>,
5660            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
5661                let _ = ctx;
5662                #[allow(unused_variables)]
5663                let view = self;
5664                let mut cur = cur;
5665                match tag.field_number() {
5666                    1u32 => {
5667                        ::buffa::encoding::check_wire_type(
5668                            tag,
5669                            ::buffa::encoding::WireType::Varint,
5670                        )?;
5671                        view.asset_id = ::buffa::types::decode_uint32(&mut cur)?;
5672                    }
5673                    2u32 => {
5674                        ::buffa::encoding::check_wire_type(
5675                            tag,
5676                            ::buffa::encoding::WireType::LengthDelimited,
5677                        )?;
5678                        let __sub_ctx = ctx.descend()?;
5679                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
5680                        match view.trading.as_mut() {
5681                            Some(existing) => {
5682                                ::buffa::MessageView::merge_into_view(
5683                                    existing,
5684                                    sub,
5685                                    __sub_ctx,
5686                                )?
5687                            }
5688                            None => {
5689                                view.trading = ::buffa::MessageFieldView::set(
5690                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
5691                                        sub,
5692                                        __sub_ctx,
5693                                    )?,
5694                                );
5695                            }
5696                        }
5697                    }
5698                    3u32 => {
5699                        ::buffa::encoding::check_wire_type(
5700                            tag,
5701                            ::buffa::encoding::WireType::LengthDelimited,
5702                        )?;
5703                        let __sub_ctx = ctx.descend()?;
5704                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
5705                        match view.funding.as_mut() {
5706                            Some(existing) => {
5707                                ::buffa::MessageView::merge_into_view(
5708                                    existing,
5709                                    sub,
5710                                    __sub_ctx,
5711                                )?
5712                            }
5713                            None => {
5714                                view.funding = ::buffa::MessageFieldView::set(
5715                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
5716                                        sub,
5717                                        __sub_ctx,
5718                                    )?,
5719                                );
5720                            }
5721                        }
5722                    }
5723                    4u32 => {
5724                        ::buffa::encoding::check_wire_type(
5725                            tag,
5726                            ::buffa::encoding::WireType::LengthDelimited,
5727                        )?;
5728                        let __sub_ctx = ctx.descend()?;
5729                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
5730                        match view.reserved.as_mut() {
5731                            Some(existing) => {
5732                                ::buffa::MessageView::merge_into_view(
5733                                    existing,
5734                                    sub,
5735                                    __sub_ctx,
5736                                )?
5737                            }
5738                            None => {
5739                                view.reserved = ::buffa::MessageFieldView::set(
5740                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
5741                                        sub,
5742                                        __sub_ctx,
5743                                    )?,
5744                                );
5745                            }
5746                        }
5747                    }
5748                    5u32 => {
5749                        ::buffa::encoding::check_wire_type(
5750                            tag,
5751                            ::buffa::encoding::WireType::LengthDelimited,
5752                        )?;
5753                        let __sub_ctx = ctx.descend()?;
5754                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
5755                        match view.available.as_mut() {
5756                            Some(existing) => {
5757                                ::buffa::MessageView::merge_into_view(
5758                                    existing,
5759                                    sub,
5760                                    __sub_ctx,
5761                                )?
5762                            }
5763                            None => {
5764                                view.available = ::buffa::MessageFieldView::set(
5765                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
5766                                        sub,
5767                                        __sub_ctx,
5768                                    )?,
5769                                );
5770                            }
5771                        }
5772                    }
5773                    6u32 => {
5774                        ::buffa::encoding::check_wire_type(
5775                            tag,
5776                            ::buffa::encoding::WireType::Varint,
5777                        )?;
5778                        view.trading_revision = ::buffa::types::decode_uint64(&mut cur)?;
5779                    }
5780                    7u32 => {
5781                        ::buffa::encoding::check_wire_type(
5782                            tag,
5783                            ::buffa::encoding::WireType::Varint,
5784                        )?;
5785                        view.funding_revision = ::buffa::types::decode_uint64(&mut cur)?;
5786                    }
5787                    _ => {
5788                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
5789                        let span_len = before_tag.len() - cur.len();
5790                        view.__buffa_unknown_fields
5791                            .push_record(before_tag, span_len, ctx)?;
5792                    }
5793                }
5794                ::core::result::Result::Ok(cur)
5795            }
5796            fn to_owned_message(
5797                &self,
5798            ) -> ::core::result::Result<
5799                super::super::AssetBalance,
5800                ::buffa::DecodeError,
5801            > {
5802                self.to_owned_from_source(None)
5803            }
5804            #[allow(clippy::useless_conversion, clippy::needless_update)]
5805            fn to_owned_from_source(
5806                &self,
5807                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
5808            ) -> ::core::result::Result<
5809                super::super::AssetBalance,
5810                ::buffa::DecodeError,
5811            > {
5812                #[allow(unused_imports)]
5813                use ::buffa::alloc::string::ToString as _;
5814                let _ = __buffa_src;
5815                ::core::result::Result::Ok(super::super::AssetBalance {
5816                    asset_id: self.asset_id,
5817                    trading: match self.trading.as_option() {
5818                        Some(v) => {
5819                            ::buffa::MessageField::<
5820                                super::super::super::super::super::polyester::r#type::v1::U128,
5821                            >::some(v.to_owned_from_source(__buffa_src)?)
5822                        }
5823                        None => ::buffa::MessageField::none(),
5824                    },
5825                    funding: match self.funding.as_option() {
5826                        Some(v) => {
5827                            ::buffa::MessageField::<
5828                                super::super::super::super::super::polyester::r#type::v1::U128,
5829                            >::some(v.to_owned_from_source(__buffa_src)?)
5830                        }
5831                        None => ::buffa::MessageField::none(),
5832                    },
5833                    reserved: match self.reserved.as_option() {
5834                        Some(v) => {
5835                            ::buffa::MessageField::<
5836                                super::super::super::super::super::polyester::r#type::v1::U128,
5837                            >::some(v.to_owned_from_source(__buffa_src)?)
5838                        }
5839                        None => ::buffa::MessageField::none(),
5840                    },
5841                    available: match self.available.as_option() {
5842                        Some(v) => {
5843                            ::buffa::MessageField::<
5844                                super::super::super::super::super::polyester::r#type::v1::U128,
5845                            >::some(v.to_owned_from_source(__buffa_src)?)
5846                        }
5847                        None => ::buffa::MessageField::none(),
5848                    },
5849                    trading_revision: self.trading_revision,
5850                    funding_revision: self.funding_revision,
5851                    __buffa_unknown_fields: self
5852                        .__buffa_unknown_fields
5853                        .to_owned()?
5854                        .into(),
5855                    ..::core::default::Default::default()
5856                })
5857            }
5858        }
5859        impl<'a> ::buffa::ViewEncode<'a> for AssetBalanceView<'a> {
5860            #[allow(clippy::needless_borrow, clippy::let_and_return)]
5861            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5862                #[allow(unused_imports)]
5863                use ::buffa::Enumeration as _;
5864                let mut size = 0u32;
5865                if self.asset_id != 0u32 {
5866                    size
5867                        += 1u32
5868                            + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
5869                }
5870                if self.trading.is_set() {
5871                    let __slot = __cache.reserve();
5872                    let inner_size = self.trading.compute_size(__cache);
5873                    __cache.set(__slot, inner_size);
5874                    size
5875                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5876                            + inner_size;
5877                }
5878                if self.funding.is_set() {
5879                    let __slot = __cache.reserve();
5880                    let inner_size = self.funding.compute_size(__cache);
5881                    __cache.set(__slot, inner_size);
5882                    size
5883                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5884                            + inner_size;
5885                }
5886                if self.reserved.is_set() {
5887                    let __slot = __cache.reserve();
5888                    let inner_size = self.reserved.compute_size(__cache);
5889                    __cache.set(__slot, inner_size);
5890                    size
5891                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5892                            + inner_size;
5893                }
5894                if self.available.is_set() {
5895                    let __slot = __cache.reserve();
5896                    let inner_size = self.available.compute_size(__cache);
5897                    __cache.set(__slot, inner_size);
5898                    size
5899                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5900                            + inner_size;
5901                }
5902                if self.trading_revision != 0u64 {
5903                    size
5904                        += 1u32
5905                            + ::buffa::types::uint64_encoded_len(self.trading_revision)
5906                                as u32;
5907                }
5908                if self.funding_revision != 0u64 {
5909                    size
5910                        += 1u32
5911                            + ::buffa::types::uint64_encoded_len(self.funding_revision)
5912                                as u32;
5913                }
5914                size += self.__buffa_unknown_fields.encoded_len() as u32;
5915                size
5916            }
5917            #[allow(clippy::needless_borrow)]
5918            fn write_to(
5919                &self,
5920                __cache: &mut ::buffa::SizeCache,
5921                buf: &mut impl ::buffa::bytes::BufMut,
5922            ) {
5923                #[allow(unused_imports)]
5924                use ::buffa::Enumeration as _;
5925                if self.asset_id != 0u32 {
5926                    ::buffa::types::put_uint32_field(1u32, self.asset_id, buf);
5927                }
5928                if self.trading.is_set() {
5929                    ::buffa::types::put_len_delimited_header(
5930                        2u32,
5931                        __cache.consume_next(),
5932                        buf,
5933                    );
5934                    self.trading.write_to(__cache, buf);
5935                }
5936                if self.funding.is_set() {
5937                    ::buffa::types::put_len_delimited_header(
5938                        3u32,
5939                        __cache.consume_next(),
5940                        buf,
5941                    );
5942                    self.funding.write_to(__cache, buf);
5943                }
5944                if self.reserved.is_set() {
5945                    ::buffa::types::put_len_delimited_header(
5946                        4u32,
5947                        __cache.consume_next(),
5948                        buf,
5949                    );
5950                    self.reserved.write_to(__cache, buf);
5951                }
5952                if self.available.is_set() {
5953                    ::buffa::types::put_len_delimited_header(
5954                        5u32,
5955                        __cache.consume_next(),
5956                        buf,
5957                    );
5958                    self.available.write_to(__cache, buf);
5959                }
5960                if self.trading_revision != 0u64 {
5961                    ::buffa::types::put_uint64_field(6u32, self.trading_revision, buf);
5962                }
5963                if self.funding_revision != 0u64 {
5964                    ::buffa::types::put_uint64_field(7u32, self.funding_revision, buf);
5965                }
5966                self.__buffa_unknown_fields.write_to(buf);
5967            }
5968        }
5969        /// Serializes this view as protobuf JSON.
5970        ///
5971        /// Implicit-presence fields with default values are omitted, `required`
5972        /// fields are always emitted, explicit-presence (`optional`) fields are
5973        /// emitted only when set, bytes fields are base64-encoded, and enum
5974        /// values are their proto name strings.
5975        ///
5976        /// This impl uses `serialize_map(None)` because the number of emitted
5977        /// fields depends on default-omission rules; serializers that require
5978        /// known map lengths (e.g. `bincode`) will return a runtime error.
5979        /// Use the owned message type for those formats.
5980        impl<'__a> ::serde::Serialize for AssetBalanceView<'__a> {
5981            fn serialize<__S: ::serde::Serializer>(
5982                &self,
5983                __s: __S,
5984            ) -> ::core::result::Result<__S::Ok, __S::Error> {
5985                use ::serde::ser::SerializeMap as _;
5986                let mut __map = __s.serialize_map(::core::option::Option::None)?;
5987                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.asset_id) {
5988                    __map
5989                        .serialize_entry(
5990                            "assetId",
5991                            &::buffa::json_helpers::ProtoJson(&self.asset_id),
5992                        )?;
5993                }
5994                {
5995                    if let ::core::option::Option::Some(__v) = self.trading.as_option() {
5996                        __map.serialize_entry("trading", __v)?;
5997                    }
5998                }
5999                {
6000                    if let ::core::option::Option::Some(__v) = self.funding.as_option() {
6001                        __map.serialize_entry("funding", __v)?;
6002                    }
6003                }
6004                {
6005                    if let ::core::option::Option::Some(__v) = self.reserved.as_option()
6006                    {
6007                        __map.serialize_entry("reserved", __v)?;
6008                    }
6009                }
6010                {
6011                    if let ::core::option::Option::Some(__v) = self.available.as_option()
6012                    {
6013                        __map.serialize_entry("available", __v)?;
6014                    }
6015                }
6016                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trading_revision) {
6017                    __map
6018                        .serialize_entry(
6019                            "tradingRevision",
6020                            &::buffa::json_helpers::ProtoJson(&self.trading_revision),
6021                        )?;
6022                }
6023                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.funding_revision) {
6024                    __map
6025                        .serialize_entry(
6026                            "fundingRevision",
6027                            &::buffa::json_helpers::ProtoJson(&self.funding_revision),
6028                        )?;
6029                }
6030                __map.end()
6031            }
6032        }
6033        impl<'a> ::buffa::MessageName for AssetBalanceView<'a> {
6034            const PACKAGE: &'static str = "ledger.read.v1";
6035            const NAME: &'static str = "AssetBalance";
6036            const FULL_NAME: &'static str = "ledger.read.v1.AssetBalance";
6037            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AssetBalance";
6038        }
6039        ::buffa::impl_default_view_instance!(AssetBalanceView);
6040        ::buffa::impl_view_reborrow!(AssetBalanceView);
6041        /** Self-contained, `'static` owned view of a `AssetBalance` message.
6042
6043 Wraps [`::buffa::OwnedView`]`<`[`AssetBalanceView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
6044
6045 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AssetBalanceView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
6046        #[derive(Clone, Debug)]
6047        pub struct AssetBalanceOwnedView(::buffa::OwnedView<AssetBalanceView<'static>>);
6048        impl AssetBalanceOwnedView {
6049            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
6050            ///
6051            /// The view borrows directly from the buffer's data; the buffer is
6052            /// retained inside the returned handle.
6053            ///
6054            /// # Errors
6055            ///
6056            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
6057            /// protobuf data.
6058            pub fn decode(
6059                bytes: ::buffa::bytes::Bytes,
6060            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6061                ::core::result::Result::Ok(
6062                    AssetBalanceOwnedView(::buffa::OwnedView::decode(bytes)?),
6063                )
6064            }
6065            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
6066            /// max message size).
6067            ///
6068            /// # Errors
6069            ///
6070            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
6071            /// exceeds the configured limits.
6072            pub fn decode_with_options(
6073                bytes: ::buffa::bytes::Bytes,
6074                opts: &::buffa::DecodeOptions,
6075            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6076                ::core::result::Result::Ok(
6077                    AssetBalanceOwnedView(
6078                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
6079                    ),
6080                )
6081            }
6082            /// Build from an owned message via an encode → decode round-trip.
6083            ///
6084            /// # Errors
6085            ///
6086            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
6087            /// somehow invalid (should not happen for well-formed messages).
6088            pub fn from_owned(
6089                msg: &super::super::AssetBalance,
6090            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6091                ::core::result::Result::Ok(
6092                    AssetBalanceOwnedView(::buffa::OwnedView::from_owned(msg)?),
6093                )
6094            }
6095            /// Borrow the full [`AssetBalanceView`] with its lifetime tied to `&self`.
6096            #[must_use]
6097            pub fn view(&self) -> &AssetBalanceView<'_> {
6098                self.0.reborrow()
6099            }
6100            /// Convert to the owned message type.
6101            ///
6102            /// # Errors
6103            ///
6104            /// Returns an error if re-materializing preserved unknown fields
6105            /// fails (e.g. the unknown-field limit is exceeded).
6106            pub fn to_owned_message(
6107                &self,
6108            ) -> ::core::result::Result<
6109                super::super::AssetBalance,
6110                ::buffa::DecodeError,
6111            > {
6112                self.0.to_owned_message()
6113            }
6114            /// The underlying bytes buffer.
6115            #[must_use]
6116            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
6117                self.0.bytes()
6118            }
6119            /// Consume the handle, returning the underlying bytes buffer.
6120            #[must_use]
6121            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
6122                self.0.into_bytes()
6123            }
6124            /// Public unified asset id. Resolve symbol from SpotConfig; U128 amounts in
6125            /// this message always use fixed 18-decimal ledger scale.
6126            ///
6127            /// Field 1: `asset_id`
6128            #[must_use]
6129            pub fn asset_id(&self) -> u32 {
6130                self.0.reborrow().asset_id
6131            }
6132            /// Trading balance at fixed 18-decimal ledger scale.
6133            ///
6134            /// Field 2: `trading`
6135            #[must_use]
6136            pub fn trading(
6137                &self,
6138            ) -> &::buffa::MessageFieldView<
6139                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
6140                    '_,
6141                >,
6142            > {
6143                &self.0.reborrow().trading
6144            }
6145            /// Funding balance at fixed 18-decimal ledger scale.
6146            ///
6147            /// Field 3: `funding`
6148            #[must_use]
6149            pub fn funding(
6150                &self,
6151            ) -> &::buffa::MessageFieldView<
6152                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
6153                    '_,
6154                >,
6155            > {
6156                &self.0.reborrow().funding
6157            }
6158            /// Reserved amount in the trading bucket at fixed 18-decimal ledger scale.
6159            ///
6160            /// Field 4: `reserved`
6161            #[must_use]
6162            pub fn reserved(
6163                &self,
6164            ) -> &::buffa::MessageFieldView<
6165                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
6166                    '_,
6167                >,
6168            > {
6169                &self.0.reborrow().reserved
6170            }
6171            /// Amount currently available for new trading activity at fixed 18-decimal
6172            /// ledger scale. This value already accounts for active reservations.
6173            ///
6174            /// Field 5: `available`
6175            #[must_use]
6176            pub fn available(
6177                &self,
6178            ) -> &::buffa::MessageFieldView<
6179                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
6180                    '_,
6181                >,
6182            > {
6183                &self.0.reborrow().available
6184            }
6185            /// Opaque monotonic revision for the atomic trading, reserved, and available
6186            /// values. Higher means newer; zero means no trading state has been observed.
6187            ///
6188            /// Field 6: `trading_revision`
6189            #[must_use]
6190            pub fn trading_revision(&self) -> u64 {
6191                self.0.reborrow().trading_revision
6192            }
6193            /// Opaque monotonic revision for the funding value. Higher means newer; zero
6194            /// means no funding state has been observed.
6195            ///
6196            /// Field 7: `funding_revision`
6197            #[must_use]
6198            pub fn funding_revision(&self) -> u64 {
6199                self.0.reborrow().funding_revision
6200            }
6201        }
6202        impl ::core::convert::From<::buffa::OwnedView<AssetBalanceView<'static>>>
6203        for AssetBalanceOwnedView {
6204            fn from(inner: ::buffa::OwnedView<AssetBalanceView<'static>>) -> Self {
6205                AssetBalanceOwnedView(inner)
6206            }
6207        }
6208        impl ::core::convert::From<AssetBalanceOwnedView>
6209        for ::buffa::OwnedView<AssetBalanceView<'static>> {
6210            fn from(wrapper: AssetBalanceOwnedView) -> Self {
6211                wrapper.0
6212            }
6213        }
6214        impl ::core::convert::AsRef<::buffa::OwnedView<AssetBalanceView<'static>>>
6215        for AssetBalanceOwnedView {
6216            fn as_ref(&self) -> &::buffa::OwnedView<AssetBalanceView<'static>> {
6217                &self.0
6218            }
6219        }
6220        impl ::buffa::HasMessageView for super::super::AssetBalance {
6221            type View<'a> = AssetBalanceView<'a>;
6222            type ViewHandle = AssetBalanceOwnedView;
6223        }
6224        impl ::serde::Serialize for AssetBalanceOwnedView {
6225            fn serialize<__S: ::serde::Serializer>(
6226                &self,
6227                __s: __S,
6228            ) -> ::core::result::Result<__S::Ok, __S::Error> {
6229                ::serde::Serialize::serialize(&self.0, __s)
6230            }
6231        }
6232        #[derive(Clone, Debug, Default)]
6233        pub struct GetBalancesResponseView<'a> {
6234            /// One entry for every supported unified asset, including assets with zero
6235            /// balances. Sorted by available trading amount (highest first), then by
6236            /// asset symbol alphabetically.
6237            ///
6238            /// Field 1: `balances`
6239            pub balances: ::buffa::RepeatedView<
6240                'a,
6241                super::super::__buffa::view::AssetBalanceView<'a>,
6242            >,
6243            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
6244        }
6245        impl<'a> ::buffa::MessageView<'a> for GetBalancesResponseView<'a> {
6246            type Owned = super::super::GetBalancesResponse;
6247            fn decode_view(
6248                buf: &'a [u8],
6249            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6250                let __limit = ::core::cell::Cell::new(
6251                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
6252                );
6253                <Self as ::buffa::MessageView>::decode_view_ctx(
6254                    buf,
6255                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
6256                )
6257            }
6258            fn decode_view_with_ctx(
6259                buf: &'a [u8],
6260                ctx: ::buffa::DecodeContext<'_>,
6261            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6262                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
6263            }
6264            fn merge_view_field(
6265                &mut self,
6266                tag: ::buffa::encoding::Tag,
6267                cur: &'a [u8],
6268                before_tag: &'a [u8],
6269                ctx: ::buffa::DecodeContext<'_>,
6270            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
6271                let _ = ctx;
6272                #[allow(unused_variables)]
6273                let view = self;
6274                let mut cur = cur;
6275                match tag.field_number() {
6276                    1u32 => {
6277                        ::buffa::encoding::check_wire_type(
6278                            tag,
6279                            ::buffa::encoding::WireType::LengthDelimited,
6280                        )?;
6281                        let __sub_ctx = ctx.descend()?;
6282                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
6283                        view.balances
6284                            .push(
6285                                <super::super::__buffa::view::AssetBalanceView as ::buffa::MessageView>::decode_view_ctx(
6286                                    sub,
6287                                    __sub_ctx,
6288                                )?,
6289                            );
6290                    }
6291                    _ => {
6292                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
6293                        let span_len = before_tag.len() - cur.len();
6294                        view.__buffa_unknown_fields
6295                            .push_record(before_tag, span_len, ctx)?;
6296                    }
6297                }
6298                ::core::result::Result::Ok(cur)
6299            }
6300            fn to_owned_message(
6301                &self,
6302            ) -> ::core::result::Result<
6303                super::super::GetBalancesResponse,
6304                ::buffa::DecodeError,
6305            > {
6306                self.to_owned_from_source(None)
6307            }
6308            #[allow(clippy::useless_conversion, clippy::needless_update)]
6309            fn to_owned_from_source(
6310                &self,
6311                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
6312            ) -> ::core::result::Result<
6313                super::super::GetBalancesResponse,
6314                ::buffa::DecodeError,
6315            > {
6316                #[allow(unused_imports)]
6317                use ::buffa::alloc::string::ToString as _;
6318                let _ = __buffa_src;
6319                ::core::result::Result::Ok(super::super::GetBalancesResponse {
6320                    balances: self
6321                        .balances
6322                        .iter()
6323                        .map(|v| v.to_owned_from_source(__buffa_src))
6324                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
6325                    __buffa_unknown_fields: self
6326                        .__buffa_unknown_fields
6327                        .to_owned()?
6328                        .into(),
6329                    ..::core::default::Default::default()
6330                })
6331            }
6332        }
6333        impl<'a> ::buffa::ViewEncode<'a> for GetBalancesResponseView<'a> {
6334            #[allow(clippy::needless_borrow, clippy::let_and_return)]
6335            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6336                #[allow(unused_imports)]
6337                use ::buffa::Enumeration as _;
6338                let mut size = 0u32;
6339                for v in &self.balances {
6340                    let __slot = __cache.reserve();
6341                    let inner_size = v.compute_size(__cache);
6342                    __cache.set(__slot, inner_size);
6343                    size
6344                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6345                            + inner_size;
6346                }
6347                size += self.__buffa_unknown_fields.encoded_len() as u32;
6348                size
6349            }
6350            #[allow(clippy::needless_borrow)]
6351            fn write_to(
6352                &self,
6353                __cache: &mut ::buffa::SizeCache,
6354                buf: &mut impl ::buffa::bytes::BufMut,
6355            ) {
6356                #[allow(unused_imports)]
6357                use ::buffa::Enumeration as _;
6358                for v in &self.balances {
6359                    ::buffa::types::put_len_delimited_header(
6360                        1u32,
6361                        __cache.consume_next(),
6362                        buf,
6363                    );
6364                    v.write_to(__cache, buf);
6365                }
6366                self.__buffa_unknown_fields.write_to(buf);
6367            }
6368        }
6369        /// Serializes this view as protobuf JSON.
6370        ///
6371        /// Implicit-presence fields with default values are omitted, `required`
6372        /// fields are always emitted, explicit-presence (`optional`) fields are
6373        /// emitted only when set, bytes fields are base64-encoded, and enum
6374        /// values are their proto name strings.
6375        ///
6376        /// This impl uses `serialize_map(None)` because the number of emitted
6377        /// fields depends on default-omission rules; serializers that require
6378        /// known map lengths (e.g. `bincode`) will return a runtime error.
6379        /// Use the owned message type for those formats.
6380        impl<'__a> ::serde::Serialize for GetBalancesResponseView<'__a> {
6381            fn serialize<__S: ::serde::Serializer>(
6382                &self,
6383                __s: __S,
6384            ) -> ::core::result::Result<__S::Ok, __S::Error> {
6385                use ::serde::ser::SerializeMap as _;
6386                let mut __map = __s.serialize_map(::core::option::Option::None)?;
6387                if !self.balances.is_empty() {
6388                    __map.serialize_entry("balances", &*self.balances)?;
6389                }
6390                __map.end()
6391            }
6392        }
6393        impl<'a> ::buffa::MessageName for GetBalancesResponseView<'a> {
6394            const PACKAGE: &'static str = "ledger.read.v1";
6395            const NAME: &'static str = "GetBalancesResponse";
6396            const FULL_NAME: &'static str = "ledger.read.v1.GetBalancesResponse";
6397            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalancesResponse";
6398        }
6399        ::buffa::impl_default_view_instance!(GetBalancesResponseView);
6400        ::buffa::impl_view_reborrow!(GetBalancesResponseView);
6401        /** Self-contained, `'static` owned view of a `GetBalancesResponse` message.
6402
6403 Wraps [`::buffa::OwnedView`]`<`[`GetBalancesResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
6404
6405 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetBalancesResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
6406        #[derive(Clone, Debug)]
6407        pub struct GetBalancesResponseOwnedView(
6408            ::buffa::OwnedView<GetBalancesResponseView<'static>>,
6409        );
6410        impl GetBalancesResponseOwnedView {
6411            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
6412            ///
6413            /// The view borrows directly from the buffer's data; the buffer is
6414            /// retained inside the returned handle.
6415            ///
6416            /// # Errors
6417            ///
6418            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
6419            /// protobuf data.
6420            pub fn decode(
6421                bytes: ::buffa::bytes::Bytes,
6422            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6423                ::core::result::Result::Ok(
6424                    GetBalancesResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
6425                )
6426            }
6427            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
6428            /// max message size).
6429            ///
6430            /// # Errors
6431            ///
6432            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
6433            /// exceeds the configured limits.
6434            pub fn decode_with_options(
6435                bytes: ::buffa::bytes::Bytes,
6436                opts: &::buffa::DecodeOptions,
6437            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6438                ::core::result::Result::Ok(
6439                    GetBalancesResponseOwnedView(
6440                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
6441                    ),
6442                )
6443            }
6444            /// Build from an owned message via an encode → decode round-trip.
6445            ///
6446            /// # Errors
6447            ///
6448            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
6449            /// somehow invalid (should not happen for well-formed messages).
6450            pub fn from_owned(
6451                msg: &super::super::GetBalancesResponse,
6452            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6453                ::core::result::Result::Ok(
6454                    GetBalancesResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
6455                )
6456            }
6457            /// Borrow the full [`GetBalancesResponseView`] with its lifetime tied to `&self`.
6458            #[must_use]
6459            pub fn view(&self) -> &GetBalancesResponseView<'_> {
6460                self.0.reborrow()
6461            }
6462            /// Convert to the owned message type.
6463            ///
6464            /// # Errors
6465            ///
6466            /// Returns an error if re-materializing preserved unknown fields
6467            /// fails (e.g. the unknown-field limit is exceeded).
6468            pub fn to_owned_message(
6469                &self,
6470            ) -> ::core::result::Result<
6471                super::super::GetBalancesResponse,
6472                ::buffa::DecodeError,
6473            > {
6474                self.0.to_owned_message()
6475            }
6476            /// The underlying bytes buffer.
6477            #[must_use]
6478            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
6479                self.0.bytes()
6480            }
6481            /// Consume the handle, returning the underlying bytes buffer.
6482            #[must_use]
6483            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
6484                self.0.into_bytes()
6485            }
6486            /// One entry for every supported unified asset, including assets with zero
6487            /// balances. Sorted by available trading amount (highest first), then by
6488            /// asset symbol alphabetically.
6489            ///
6490            /// Field 1: `balances`
6491            #[must_use]
6492            pub fn balances(
6493                &self,
6494            ) -> &::buffa::RepeatedView<
6495                '_,
6496                super::super::__buffa::view::AssetBalanceView<'_>,
6497            > {
6498                &self.0.reborrow().balances
6499            }
6500        }
6501        impl ::core::convert::From<::buffa::OwnedView<GetBalancesResponseView<'static>>>
6502        for GetBalancesResponseOwnedView {
6503            fn from(
6504                inner: ::buffa::OwnedView<GetBalancesResponseView<'static>>,
6505            ) -> Self {
6506                GetBalancesResponseOwnedView(inner)
6507            }
6508        }
6509        impl ::core::convert::From<GetBalancesResponseOwnedView>
6510        for ::buffa::OwnedView<GetBalancesResponseView<'static>> {
6511            fn from(wrapper: GetBalancesResponseOwnedView) -> Self {
6512                wrapper.0
6513            }
6514        }
6515        impl ::core::convert::AsRef<::buffa::OwnedView<GetBalancesResponseView<'static>>>
6516        for GetBalancesResponseOwnedView {
6517            fn as_ref(&self) -> &::buffa::OwnedView<GetBalancesResponseView<'static>> {
6518                &self.0
6519            }
6520        }
6521        impl ::buffa::HasMessageView for super::super::GetBalancesResponse {
6522            type View<'a> = GetBalancesResponseView<'a>;
6523            type ViewHandle = GetBalancesResponseOwnedView;
6524        }
6525        impl ::serde::Serialize for GetBalancesResponseOwnedView {
6526            fn serialize<__S: ::serde::Serializer>(
6527                &self,
6528                __s: __S,
6529            ) -> ::core::result::Result<__S::Ok, __S::Error> {
6530                ::serde::Serialize::serialize(&self.0, __s)
6531            }
6532        }
6533        #[derive(Clone, Debug, Default)]
6534        pub struct GetBalanceHistoryRequestView<'a> {
6535            /// Optional sub-account to scope balances to. If omitted, balances are
6536            /// returned for the authenticated root account derived from the JWT or API
6537            /// key. The logical account id itself is always derived from the caller's JWT
6538            /// or API key, not from this payload.
6539            ///
6540            /// Field 1: `subaccount_id`
6541            pub subaccount_id: ::core::option::Option<u64>,
6542            /// History window to return. When unset/UNSPECIFIED, defaults to 1D.
6543            ///
6544            /// Field 2: `range`
6545            pub range: ::buffa::EnumValue<super::super::BalanceRange>,
6546            /// Optional public asset filter. When unset/0, returns all assets.
6547            ///
6548            /// Field 3: `ledger`
6549            pub ledger: u32,
6550            /// Optional subset of account buckets to return. When empty, returns all
6551            /// account buckets.
6552            ///
6553            /// Field 4: `account_codes`
6554            pub account_codes: ::buffa::RepeatedView<
6555                'a,
6556                ::buffa::EnumValue<super::super::super::super::v1::AccountCode>,
6557            >,
6558            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
6559        }
6560        impl<'a> ::buffa::MessageView<'a> for GetBalanceHistoryRequestView<'a> {
6561            type Owned = super::super::GetBalanceHistoryRequest;
6562            fn decode_view(
6563                buf: &'a [u8],
6564            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6565                let __limit = ::core::cell::Cell::new(
6566                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
6567                );
6568                <Self as ::buffa::MessageView>::decode_view_ctx(
6569                    buf,
6570                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
6571                )
6572            }
6573            fn decode_view_with_ctx(
6574                buf: &'a [u8],
6575                ctx: ::buffa::DecodeContext<'_>,
6576            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6577                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
6578            }
6579            fn merge_view_field(
6580                &mut self,
6581                tag: ::buffa::encoding::Tag,
6582                cur: &'a [u8],
6583                before_tag: &'a [u8],
6584                ctx: ::buffa::DecodeContext<'_>,
6585            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
6586                let _ = ctx;
6587                #[allow(unused_variables)]
6588                let view = self;
6589                let mut cur = cur;
6590                match tag.field_number() {
6591                    1u32 => {
6592                        ::buffa::encoding::check_wire_type(
6593                            tag,
6594                            ::buffa::encoding::WireType::Fixed64,
6595                        )?;
6596                        view.subaccount_id = Some(
6597                            ::buffa::types::decode_fixed64(&mut cur)?,
6598                        );
6599                    }
6600                    2u32 => {
6601                        ::buffa::encoding::check_wire_type(
6602                            tag,
6603                            ::buffa::encoding::WireType::Varint,
6604                        )?;
6605                        view.range = ::buffa::EnumValue::from(
6606                            ::buffa::types::decode_int32(&mut cur)?,
6607                        );
6608                    }
6609                    3u32 => {
6610                        ::buffa::encoding::check_wire_type(
6611                            tag,
6612                            ::buffa::encoding::WireType::Varint,
6613                        )?;
6614                        view.ledger = ::buffa::types::decode_uint32(&mut cur)?;
6615                    }
6616                    4u32 => {
6617                        if tag.wire_type()
6618                            == ::buffa::encoding::WireType::LengthDelimited
6619                        {
6620                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
6621                            view.account_codes
6622                                .reserve(::buffa::encoding::count_varints(payload));
6623                            let mut pcur: &[u8] = payload;
6624                            while !pcur.is_empty() {
6625                                view.account_codes
6626                                    .push(
6627                                        ::buffa::EnumValue::from(
6628                                            ::buffa::types::decode_int32(&mut pcur)?,
6629                                        ),
6630                                    );
6631                            }
6632                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
6633                        {
6634                            view.account_codes
6635                                .push(
6636                                    ::buffa::EnumValue::from(
6637                                        ::buffa::types::decode_int32(&mut cur)?,
6638                                    ),
6639                                );
6640                        } else {
6641                            return Err(
6642                                ::buffa::encoding::wire_type_mismatch(
6643                                    tag,
6644                                    ::buffa::encoding::WireType::LengthDelimited,
6645                                ),
6646                            );
6647                        }
6648                    }
6649                    _ => {
6650                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
6651                        let span_len = before_tag.len() - cur.len();
6652                        view.__buffa_unknown_fields
6653                            .push_record(before_tag, span_len, ctx)?;
6654                    }
6655                }
6656                ::core::result::Result::Ok(cur)
6657            }
6658            fn to_owned_message(
6659                &self,
6660            ) -> ::core::result::Result<
6661                super::super::GetBalanceHistoryRequest,
6662                ::buffa::DecodeError,
6663            > {
6664                self.to_owned_from_source(None)
6665            }
6666            #[allow(clippy::useless_conversion, clippy::needless_update)]
6667            fn to_owned_from_source(
6668                &self,
6669                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
6670            ) -> ::core::result::Result<
6671                super::super::GetBalanceHistoryRequest,
6672                ::buffa::DecodeError,
6673            > {
6674                #[allow(unused_imports)]
6675                use ::buffa::alloc::string::ToString as _;
6676                let _ = __buffa_src;
6677                ::core::result::Result::Ok(super::super::GetBalanceHistoryRequest {
6678                    subaccount_id: self.subaccount_id,
6679                    range: self.range,
6680                    ledger: self.ledger,
6681                    account_codes: self.account_codes.to_vec(),
6682                    __buffa_unknown_fields: self
6683                        .__buffa_unknown_fields
6684                        .to_owned()?
6685                        .into(),
6686                    ..::core::default::Default::default()
6687                })
6688            }
6689        }
6690        impl<'a> ::buffa::ViewEncode<'a> for GetBalanceHistoryRequestView<'a> {
6691            #[allow(clippy::needless_borrow, clippy::let_and_return)]
6692            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
6693                #[allow(unused_imports)]
6694                use ::buffa::Enumeration as _;
6695                let mut size = 0u32;
6696                if self.subaccount_id.is_some() {
6697                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6698                }
6699                {
6700                    let val = self.range.to_i32();
6701                    if val != 0 {
6702                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
6703                    }
6704                }
6705                if self.ledger != 0u32 {
6706                    size
6707                        += 1u32 + ::buffa::types::uint32_encoded_len(self.ledger) as u32;
6708                }
6709                if !self.account_codes.is_empty() {
6710                    let payload: u32 = self
6711                        .account_codes
6712                        .iter()
6713                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
6714                        .sum::<u32>();
6715                    size
6716                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
6717                            + payload;
6718                }
6719                size += self.__buffa_unknown_fields.encoded_len() as u32;
6720                size
6721            }
6722            #[allow(clippy::needless_borrow)]
6723            fn write_to(
6724                &self,
6725                _cache: &mut ::buffa::SizeCache,
6726                buf: &mut impl ::buffa::bytes::BufMut,
6727            ) {
6728                #[allow(unused_imports)]
6729                use ::buffa::Enumeration as _;
6730                if let Some(v) = self.subaccount_id {
6731                    ::buffa::types::put_fixed64_field(1u32, v, buf);
6732                }
6733                {
6734                    let val = self.range.to_i32();
6735                    if val != 0 {
6736                        ::buffa::types::put_int32_field(2u32, val, buf);
6737                    }
6738                }
6739                if self.ledger != 0u32 {
6740                    ::buffa::types::put_uint32_field(3u32, self.ledger, buf);
6741                }
6742                if !self.account_codes.is_empty() {
6743                    let payload: u32 = self
6744                        .account_codes
6745                        .iter()
6746                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
6747                        .sum::<u32>();
6748                    ::buffa::types::put_len_delimited_header(4u32, payload, buf);
6749                    for v in &self.account_codes {
6750                        ::buffa::types::encode_int32(v.to_i32(), buf);
6751                    }
6752                }
6753                self.__buffa_unknown_fields.write_to(buf);
6754            }
6755        }
6756        /// Serializes this view as protobuf JSON.
6757        ///
6758        /// Implicit-presence fields with default values are omitted, `required`
6759        /// fields are always emitted, explicit-presence (`optional`) fields are
6760        /// emitted only when set, bytes fields are base64-encoded, and enum
6761        /// values are their proto name strings.
6762        ///
6763        /// This impl uses `serialize_map(None)` because the number of emitted
6764        /// fields depends on default-omission rules; serializers that require
6765        /// known map lengths (e.g. `bincode`) will return a runtime error.
6766        /// Use the owned message type for those formats.
6767        impl<'__a> ::serde::Serialize for GetBalanceHistoryRequestView<'__a> {
6768            fn serialize<__S: ::serde::Serializer>(
6769                &self,
6770                __s: __S,
6771            ) -> ::core::result::Result<__S::Ok, __S::Error> {
6772                use ::serde::ser::SerializeMap as _;
6773                let mut __map = __s.serialize_map(::core::option::Option::None)?;
6774                if let ::core::option::Option::Some(__v) = self.subaccount_id {
6775                    __map
6776                        .serialize_entry(
6777                            "subaccountId",
6778                            &::buffa::json_helpers::ProtoJson(&__v),
6779                        )?;
6780                }
6781                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.range) {
6782                    __map.serialize_entry("range", &self.range)?;
6783                }
6784                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.ledger) {
6785                    __map
6786                        .serialize_entry(
6787                            "ledger",
6788                            &::buffa::json_helpers::ProtoJson(&self.ledger),
6789                        )?;
6790                }
6791                if !self.account_codes.is_empty() {
6792                    __map
6793                        .serialize_entry(
6794                            "accountCodes",
6795                            &::buffa::json_helpers::EnumSeqJson(&self.account_codes),
6796                        )?;
6797                }
6798                __map.end()
6799            }
6800        }
6801        impl<'a> ::buffa::MessageName for GetBalanceHistoryRequestView<'a> {
6802            const PACKAGE: &'static str = "ledger.read.v1";
6803            const NAME: &'static str = "GetBalanceHistoryRequest";
6804            const FULL_NAME: &'static str = "ledger.read.v1.GetBalanceHistoryRequest";
6805            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalanceHistoryRequest";
6806        }
6807        ::buffa::impl_default_view_instance!(GetBalanceHistoryRequestView);
6808        ::buffa::impl_view_reborrow!(GetBalanceHistoryRequestView);
6809        /** Self-contained, `'static` owned view of a `GetBalanceHistoryRequest` message.
6810
6811 Wraps [`::buffa::OwnedView`]`<`[`GetBalanceHistoryRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
6812
6813 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetBalanceHistoryRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
6814        #[derive(Clone, Debug)]
6815        pub struct GetBalanceHistoryRequestOwnedView(
6816            ::buffa::OwnedView<GetBalanceHistoryRequestView<'static>>,
6817        );
6818        impl GetBalanceHistoryRequestOwnedView {
6819            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
6820            ///
6821            /// The view borrows directly from the buffer's data; the buffer is
6822            /// retained inside the returned handle.
6823            ///
6824            /// # Errors
6825            ///
6826            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
6827            /// protobuf data.
6828            pub fn decode(
6829                bytes: ::buffa::bytes::Bytes,
6830            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6831                ::core::result::Result::Ok(
6832                    GetBalanceHistoryRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
6833                )
6834            }
6835            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
6836            /// max message size).
6837            ///
6838            /// # Errors
6839            ///
6840            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
6841            /// exceeds the configured limits.
6842            pub fn decode_with_options(
6843                bytes: ::buffa::bytes::Bytes,
6844                opts: &::buffa::DecodeOptions,
6845            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6846                ::core::result::Result::Ok(
6847                    GetBalanceHistoryRequestOwnedView(
6848                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
6849                    ),
6850                )
6851            }
6852            /// Build from an owned message via an encode → decode round-trip.
6853            ///
6854            /// # Errors
6855            ///
6856            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
6857            /// somehow invalid (should not happen for well-formed messages).
6858            pub fn from_owned(
6859                msg: &super::super::GetBalanceHistoryRequest,
6860            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6861                ::core::result::Result::Ok(
6862                    GetBalanceHistoryRequestOwnedView(
6863                        ::buffa::OwnedView::from_owned(msg)?,
6864                    ),
6865                )
6866            }
6867            /// Borrow the full [`GetBalanceHistoryRequestView`] with its lifetime tied to `&self`.
6868            #[must_use]
6869            pub fn view(&self) -> &GetBalanceHistoryRequestView<'_> {
6870                self.0.reborrow()
6871            }
6872            /// Convert to the owned message type.
6873            ///
6874            /// # Errors
6875            ///
6876            /// Returns an error if re-materializing preserved unknown fields
6877            /// fails (e.g. the unknown-field limit is exceeded).
6878            pub fn to_owned_message(
6879                &self,
6880            ) -> ::core::result::Result<
6881                super::super::GetBalanceHistoryRequest,
6882                ::buffa::DecodeError,
6883            > {
6884                self.0.to_owned_message()
6885            }
6886            /// The underlying bytes buffer.
6887            #[must_use]
6888            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
6889                self.0.bytes()
6890            }
6891            /// Consume the handle, returning the underlying bytes buffer.
6892            #[must_use]
6893            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
6894                self.0.into_bytes()
6895            }
6896            /// Optional sub-account to scope balances to. If omitted, balances are
6897            /// returned for the authenticated root account derived from the JWT or API
6898            /// key. The logical account id itself is always derived from the caller's JWT
6899            /// or API key, not from this payload.
6900            ///
6901            /// Field 1: `subaccount_id`
6902            #[must_use]
6903            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
6904                self.0.reborrow().subaccount_id
6905            }
6906            /// History window to return. When unset/UNSPECIFIED, defaults to 1D.
6907            ///
6908            /// Field 2: `range`
6909            #[must_use]
6910            pub fn range(&self) -> ::buffa::EnumValue<super::super::BalanceRange> {
6911                self.0.reborrow().range
6912            }
6913            /// Optional public asset filter. When unset/0, returns all assets.
6914            ///
6915            /// Field 3: `ledger`
6916            #[must_use]
6917            pub fn ledger(&self) -> u32 {
6918                self.0.reborrow().ledger
6919            }
6920            /// Optional subset of account buckets to return. When empty, returns all
6921            /// account buckets.
6922            ///
6923            /// Field 4: `account_codes`
6924            #[must_use]
6925            pub fn account_codes(
6926                &self,
6927            ) -> &::buffa::RepeatedView<
6928                '_,
6929                ::buffa::EnumValue<super::super::super::super::v1::AccountCode>,
6930            > {
6931                &self.0.reborrow().account_codes
6932            }
6933        }
6934        impl ::core::convert::From<
6935            ::buffa::OwnedView<GetBalanceHistoryRequestView<'static>>,
6936        > for GetBalanceHistoryRequestOwnedView {
6937            fn from(
6938                inner: ::buffa::OwnedView<GetBalanceHistoryRequestView<'static>>,
6939            ) -> Self {
6940                GetBalanceHistoryRequestOwnedView(inner)
6941            }
6942        }
6943        impl ::core::convert::From<GetBalanceHistoryRequestOwnedView>
6944        for ::buffa::OwnedView<GetBalanceHistoryRequestView<'static>> {
6945            fn from(wrapper: GetBalanceHistoryRequestOwnedView) -> Self {
6946                wrapper.0
6947            }
6948        }
6949        impl ::core::convert::AsRef<
6950            ::buffa::OwnedView<GetBalanceHistoryRequestView<'static>>,
6951        > for GetBalanceHistoryRequestOwnedView {
6952            fn as_ref(
6953                &self,
6954            ) -> &::buffa::OwnedView<GetBalanceHistoryRequestView<'static>> {
6955                &self.0
6956            }
6957        }
6958        impl ::buffa::HasMessageView for super::super::GetBalanceHistoryRequest {
6959            type View<'a> = GetBalanceHistoryRequestView<'a>;
6960            type ViewHandle = GetBalanceHistoryRequestOwnedView;
6961        }
6962        impl ::serde::Serialize for GetBalanceHistoryRequestOwnedView {
6963            fn serialize<__S: ::serde::Serializer>(
6964                &self,
6965                __s: __S,
6966            ) -> ::core::result::Result<__S::Ok, __S::Error> {
6967                ::serde::Serialize::serialize(&self.0, __s)
6968            }
6969        }
6970        /// Columnar balance series payload (scaled integers).
6971        /// REST renders decimal strings from these values.
6972        #[derive(Clone, Debug, Default)]
6973        pub struct BalanceSeriesView<'a> {
6974            /// public unified asset id
6975            ///
6976            /// Field 1: `asset_id`
6977            pub asset_id: u32,
6978            /// account bucket
6979            ///
6980            /// Field 2: `account_code`
6981            pub account_code: ::buffa::EnumValue<
6982                super::super::super::super::v1::AccountCode,
6983            >,
6984            /// Chart balance in asset units scaled by 1e7 (7 decimals).
6985            /// Values are downscaled from 18-decimal ledger balances for compact charting
6986            /// and align 1:1 with implicit timestamps.
6987            ///
6988            /// Field 3: `balance_q`
6989            pub balance_q: ::buffa::RepeatedView<'a, u64>,
6990            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
6991        }
6992        impl<'a> ::buffa::MessageView<'a> for BalanceSeriesView<'a> {
6993            type Owned = super::super::BalanceSeries;
6994            fn decode_view(
6995                buf: &'a [u8],
6996            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6997                let __limit = ::core::cell::Cell::new(
6998                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
6999                );
7000                <Self as ::buffa::MessageView>::decode_view_ctx(
7001                    buf,
7002                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
7003                )
7004            }
7005            fn decode_view_with_ctx(
7006                buf: &'a [u8],
7007                ctx: ::buffa::DecodeContext<'_>,
7008            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7009                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
7010            }
7011            fn merge_view_field(
7012                &mut self,
7013                tag: ::buffa::encoding::Tag,
7014                cur: &'a [u8],
7015                before_tag: &'a [u8],
7016                ctx: ::buffa::DecodeContext<'_>,
7017            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
7018                let _ = ctx;
7019                #[allow(unused_variables)]
7020                let view = self;
7021                let mut cur = cur;
7022                match tag.field_number() {
7023                    1u32 => {
7024                        ::buffa::encoding::check_wire_type(
7025                            tag,
7026                            ::buffa::encoding::WireType::Varint,
7027                        )?;
7028                        view.asset_id = ::buffa::types::decode_uint32(&mut cur)?;
7029                    }
7030                    2u32 => {
7031                        ::buffa::encoding::check_wire_type(
7032                            tag,
7033                            ::buffa::encoding::WireType::Varint,
7034                        )?;
7035                        view.account_code = ::buffa::EnumValue::from(
7036                            ::buffa::types::decode_int32(&mut cur)?,
7037                        );
7038                    }
7039                    3u32 => {
7040                        if tag.wire_type()
7041                            == ::buffa::encoding::WireType::LengthDelimited
7042                        {
7043                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
7044                            view.balance_q
7045                                .reserve(::buffa::encoding::count_varints(payload));
7046                            let mut pcur: &[u8] = payload;
7047                            while !pcur.is_empty() {
7048                                view.balance_q
7049                                    .push(::buffa::types::decode_uint64(&mut pcur)?);
7050                            }
7051                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
7052                        {
7053                            view.balance_q
7054                                .push(::buffa::types::decode_uint64(&mut cur)?);
7055                        } else {
7056                            return Err(
7057                                ::buffa::encoding::wire_type_mismatch(
7058                                    tag,
7059                                    ::buffa::encoding::WireType::LengthDelimited,
7060                                ),
7061                            );
7062                        }
7063                    }
7064                    _ => {
7065                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
7066                        let span_len = before_tag.len() - cur.len();
7067                        view.__buffa_unknown_fields
7068                            .push_record(before_tag, span_len, ctx)?;
7069                    }
7070                }
7071                ::core::result::Result::Ok(cur)
7072            }
7073            fn to_owned_message(
7074                &self,
7075            ) -> ::core::result::Result<
7076                super::super::BalanceSeries,
7077                ::buffa::DecodeError,
7078            > {
7079                self.to_owned_from_source(None)
7080            }
7081            #[allow(clippy::useless_conversion, clippy::needless_update)]
7082            fn to_owned_from_source(
7083                &self,
7084                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
7085            ) -> ::core::result::Result<
7086                super::super::BalanceSeries,
7087                ::buffa::DecodeError,
7088            > {
7089                #[allow(unused_imports)]
7090                use ::buffa::alloc::string::ToString as _;
7091                let _ = __buffa_src;
7092                ::core::result::Result::Ok(super::super::BalanceSeries {
7093                    asset_id: self.asset_id,
7094                    account_code: self.account_code,
7095                    balance_q: self.balance_q.to_vec(),
7096                    __buffa_unknown_fields: self
7097                        .__buffa_unknown_fields
7098                        .to_owned()?
7099                        .into(),
7100                    ..::core::default::Default::default()
7101                })
7102            }
7103        }
7104        impl<'a> ::buffa::ViewEncode<'a> for BalanceSeriesView<'a> {
7105            #[allow(clippy::needless_borrow, clippy::let_and_return)]
7106            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7107                #[allow(unused_imports)]
7108                use ::buffa::Enumeration as _;
7109                let mut size = 0u32;
7110                if self.asset_id != 0u32 {
7111                    size
7112                        += 1u32
7113                            + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
7114                }
7115                {
7116                    let val = self.account_code.to_i32();
7117                    if val != 0 {
7118                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7119                    }
7120                }
7121                if !self.balance_q.is_empty() {
7122                    let payload: u32 = self
7123                        .balance_q
7124                        .iter()
7125                        .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
7126                        .sum::<u32>();
7127                    size
7128                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
7129                            + payload;
7130                }
7131                size += self.__buffa_unknown_fields.encoded_len() as u32;
7132                size
7133            }
7134            #[allow(clippy::needless_borrow)]
7135            fn write_to(
7136                &self,
7137                _cache: &mut ::buffa::SizeCache,
7138                buf: &mut impl ::buffa::bytes::BufMut,
7139            ) {
7140                #[allow(unused_imports)]
7141                use ::buffa::Enumeration as _;
7142                if self.asset_id != 0u32 {
7143                    ::buffa::types::put_uint32_field(1u32, self.asset_id, buf);
7144                }
7145                {
7146                    let val = self.account_code.to_i32();
7147                    if val != 0 {
7148                        ::buffa::types::put_int32_field(2u32, val, buf);
7149                    }
7150                }
7151                if !self.balance_q.is_empty() {
7152                    let payload: u32 = self
7153                        .balance_q
7154                        .iter()
7155                        .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
7156                        .sum::<u32>();
7157                    ::buffa::types::put_len_delimited_header(3u32, payload, buf);
7158                    for &v in &self.balance_q {
7159                        ::buffa::types::encode_uint64(v, buf);
7160                    }
7161                }
7162                self.__buffa_unknown_fields.write_to(buf);
7163            }
7164        }
7165        /// Serializes this view as protobuf JSON.
7166        ///
7167        /// Implicit-presence fields with default values are omitted, `required`
7168        /// fields are always emitted, explicit-presence (`optional`) fields are
7169        /// emitted only when set, bytes fields are base64-encoded, and enum
7170        /// values are their proto name strings.
7171        ///
7172        /// This impl uses `serialize_map(None)` because the number of emitted
7173        /// fields depends on default-omission rules; serializers that require
7174        /// known map lengths (e.g. `bincode`) will return a runtime error.
7175        /// Use the owned message type for those formats.
7176        impl<'__a> ::serde::Serialize for BalanceSeriesView<'__a> {
7177            fn serialize<__S: ::serde::Serializer>(
7178                &self,
7179                __s: __S,
7180            ) -> ::core::result::Result<__S::Ok, __S::Error> {
7181                use ::serde::ser::SerializeMap as _;
7182                let mut __map = __s.serialize_map(::core::option::Option::None)?;
7183                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.asset_id) {
7184                    __map
7185                        .serialize_entry(
7186                            "assetId",
7187                            &::buffa::json_helpers::ProtoJson(&self.asset_id),
7188                        )?;
7189                }
7190                if !::buffa::json_helpers::skip_if::is_default_enum_value(
7191                    &self.account_code,
7192                ) {
7193                    __map.serialize_entry("accountCode", &self.account_code)?;
7194                }
7195                if !self.balance_q.is_empty() {
7196                    __map
7197                        .serialize_entry(
7198                            "balanceQ",
7199                            &::buffa::json_helpers::RepeatedJson(&self.balance_q),
7200                        )?;
7201                }
7202                __map.end()
7203            }
7204        }
7205        impl<'a> ::buffa::MessageName for BalanceSeriesView<'a> {
7206            const PACKAGE: &'static str = "ledger.read.v1";
7207            const NAME: &'static str = "BalanceSeries";
7208            const FULL_NAME: &'static str = "ledger.read.v1.BalanceSeries";
7209            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.BalanceSeries";
7210        }
7211        ::buffa::impl_default_view_instance!(BalanceSeriesView);
7212        ::buffa::impl_view_reborrow!(BalanceSeriesView);
7213        /** Self-contained, `'static` owned view of a `BalanceSeries` message.
7214
7215 Wraps [`::buffa::OwnedView`]`<`[`BalanceSeriesView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
7216
7217 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`BalanceSeriesView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
7218        #[derive(Clone, Debug)]
7219        pub struct BalanceSeriesOwnedView(
7220            ::buffa::OwnedView<BalanceSeriesView<'static>>,
7221        );
7222        impl BalanceSeriesOwnedView {
7223            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
7224            ///
7225            /// The view borrows directly from the buffer's data; the buffer is
7226            /// retained inside the returned handle.
7227            ///
7228            /// # Errors
7229            ///
7230            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
7231            /// protobuf data.
7232            pub fn decode(
7233                bytes: ::buffa::bytes::Bytes,
7234            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7235                ::core::result::Result::Ok(
7236                    BalanceSeriesOwnedView(::buffa::OwnedView::decode(bytes)?),
7237                )
7238            }
7239            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
7240            /// max message size).
7241            ///
7242            /// # Errors
7243            ///
7244            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
7245            /// exceeds the configured limits.
7246            pub fn decode_with_options(
7247                bytes: ::buffa::bytes::Bytes,
7248                opts: &::buffa::DecodeOptions,
7249            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7250                ::core::result::Result::Ok(
7251                    BalanceSeriesOwnedView(
7252                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
7253                    ),
7254                )
7255            }
7256            /// Build from an owned message via an encode → decode round-trip.
7257            ///
7258            /// # Errors
7259            ///
7260            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
7261            /// somehow invalid (should not happen for well-formed messages).
7262            pub fn from_owned(
7263                msg: &super::super::BalanceSeries,
7264            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7265                ::core::result::Result::Ok(
7266                    BalanceSeriesOwnedView(::buffa::OwnedView::from_owned(msg)?),
7267                )
7268            }
7269            /// Borrow the full [`BalanceSeriesView`] with its lifetime tied to `&self`.
7270            #[must_use]
7271            pub fn view(&self) -> &BalanceSeriesView<'_> {
7272                self.0.reborrow()
7273            }
7274            /// Convert to the owned message type.
7275            ///
7276            /// # Errors
7277            ///
7278            /// Returns an error if re-materializing preserved unknown fields
7279            /// fails (e.g. the unknown-field limit is exceeded).
7280            pub fn to_owned_message(
7281                &self,
7282            ) -> ::core::result::Result<
7283                super::super::BalanceSeries,
7284                ::buffa::DecodeError,
7285            > {
7286                self.0.to_owned_message()
7287            }
7288            /// The underlying bytes buffer.
7289            #[must_use]
7290            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
7291                self.0.bytes()
7292            }
7293            /// Consume the handle, returning the underlying bytes buffer.
7294            #[must_use]
7295            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
7296                self.0.into_bytes()
7297            }
7298            /// public unified asset id
7299            ///
7300            /// Field 1: `asset_id`
7301            #[must_use]
7302            pub fn asset_id(&self) -> u32 {
7303                self.0.reborrow().asset_id
7304            }
7305            /// account bucket
7306            ///
7307            /// Field 2: `account_code`
7308            #[must_use]
7309            pub fn account_code(
7310                &self,
7311            ) -> ::buffa::EnumValue<super::super::super::super::v1::AccountCode> {
7312                self.0.reborrow().account_code
7313            }
7314            /// Chart balance in asset units scaled by 1e7 (7 decimals).
7315            /// Values are downscaled from 18-decimal ledger balances for compact charting
7316            /// and align 1:1 with implicit timestamps.
7317            ///
7318            /// Field 3: `balance_q`
7319            #[must_use]
7320            pub fn balance_q(&self) -> &::buffa::RepeatedView<'_, u64> {
7321                &self.0.reborrow().balance_q
7322            }
7323        }
7324        impl ::core::convert::From<::buffa::OwnedView<BalanceSeriesView<'static>>>
7325        for BalanceSeriesOwnedView {
7326            fn from(inner: ::buffa::OwnedView<BalanceSeriesView<'static>>) -> Self {
7327                BalanceSeriesOwnedView(inner)
7328            }
7329        }
7330        impl ::core::convert::From<BalanceSeriesOwnedView>
7331        for ::buffa::OwnedView<BalanceSeriesView<'static>> {
7332            fn from(wrapper: BalanceSeriesOwnedView) -> Self {
7333                wrapper.0
7334            }
7335        }
7336        impl ::core::convert::AsRef<::buffa::OwnedView<BalanceSeriesView<'static>>>
7337        for BalanceSeriesOwnedView {
7338            fn as_ref(&self) -> &::buffa::OwnedView<BalanceSeriesView<'static>> {
7339                &self.0
7340            }
7341        }
7342        impl ::buffa::HasMessageView for super::super::BalanceSeries {
7343            type View<'a> = BalanceSeriesView<'a>;
7344            type ViewHandle = BalanceSeriesOwnedView;
7345        }
7346        impl ::serde::Serialize for BalanceSeriesOwnedView {
7347            fn serialize<__S: ::serde::Serializer>(
7348                &self,
7349                __s: __S,
7350            ) -> ::core::result::Result<__S::Ok, __S::Error> {
7351                ::serde::Serialize::serialize(&self.0, __s)
7352            }
7353        }
7354        /// GetBalanceHistoryResponse returns aligned balance chart series.
7355        #[derive(Clone, Debug, Default)]
7356        pub struct GetBalanceHistoryResponseView<'a> {
7357            /// Resolved history window.
7358            ///
7359            /// Field 1: `range`
7360            pub range: ::buffa::EnumValue<super::super::BalanceRange>,
7361            /// Sampling interval between points, such as "5m" or "1h".
7362            ///
7363            /// Field 2: `bucket`
7364            pub bucket: &'a str,
7365            /// First point timestamp in seconds since epoch (UTC).
7366            ///
7367            /// Field 3: `start_ts_sec`
7368            pub start_ts_sec: u32,
7369            /// Last point timestamp in seconds since epoch (UTC).
7370            ///
7371            /// Field 4: `end_ts_sec`
7372            pub end_ts_sec: u32,
7373            /// Number of aligned points in each returned series.
7374            ///
7375            /// Field 5: `points`
7376            pub points: u32,
7377            /// Balance series ordered by asset ID, then account bucket.
7378            ///
7379            /// Field 6: `series`
7380            pub series: ::buffa::RepeatedView<
7381                'a,
7382                super::super::__buffa::view::BalanceSeriesView<'a>,
7383            >,
7384            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
7385        }
7386        impl<'a> ::buffa::MessageView<'a> for GetBalanceHistoryResponseView<'a> {
7387            type Owned = super::super::GetBalanceHistoryResponse;
7388            fn decode_view(
7389                buf: &'a [u8],
7390            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7391                let __limit = ::core::cell::Cell::new(
7392                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
7393                );
7394                <Self as ::buffa::MessageView>::decode_view_ctx(
7395                    buf,
7396                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
7397                )
7398            }
7399            fn decode_view_with_ctx(
7400                buf: &'a [u8],
7401                ctx: ::buffa::DecodeContext<'_>,
7402            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7403                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
7404            }
7405            fn merge_view_field(
7406                &mut self,
7407                tag: ::buffa::encoding::Tag,
7408                cur: &'a [u8],
7409                before_tag: &'a [u8],
7410                ctx: ::buffa::DecodeContext<'_>,
7411            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
7412                let _ = ctx;
7413                #[allow(unused_variables)]
7414                let view = self;
7415                let mut cur = cur;
7416                match tag.field_number() {
7417                    1u32 => {
7418                        ::buffa::encoding::check_wire_type(
7419                            tag,
7420                            ::buffa::encoding::WireType::Varint,
7421                        )?;
7422                        view.range = ::buffa::EnumValue::from(
7423                            ::buffa::types::decode_int32(&mut cur)?,
7424                        );
7425                    }
7426                    2u32 => {
7427                        ::buffa::encoding::check_wire_type(
7428                            tag,
7429                            ::buffa::encoding::WireType::LengthDelimited,
7430                        )?;
7431                        view.bucket = ::buffa::types::borrow_str(&mut cur)?;
7432                    }
7433                    3u32 => {
7434                        ::buffa::encoding::check_wire_type(
7435                            tag,
7436                            ::buffa::encoding::WireType::Fixed32,
7437                        )?;
7438                        view.start_ts_sec = ::buffa::types::decode_fixed32(&mut cur)?;
7439                    }
7440                    4u32 => {
7441                        ::buffa::encoding::check_wire_type(
7442                            tag,
7443                            ::buffa::encoding::WireType::Fixed32,
7444                        )?;
7445                        view.end_ts_sec = ::buffa::types::decode_fixed32(&mut cur)?;
7446                    }
7447                    5u32 => {
7448                        ::buffa::encoding::check_wire_type(
7449                            tag,
7450                            ::buffa::encoding::WireType::Varint,
7451                        )?;
7452                        view.points = ::buffa::types::decode_uint32(&mut cur)?;
7453                    }
7454                    6u32 => {
7455                        ::buffa::encoding::check_wire_type(
7456                            tag,
7457                            ::buffa::encoding::WireType::LengthDelimited,
7458                        )?;
7459                        let __sub_ctx = ctx.descend()?;
7460                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
7461                        view.series
7462                            .push(
7463                                <super::super::__buffa::view::BalanceSeriesView as ::buffa::MessageView>::decode_view_ctx(
7464                                    sub,
7465                                    __sub_ctx,
7466                                )?,
7467                            );
7468                    }
7469                    _ => {
7470                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
7471                        let span_len = before_tag.len() - cur.len();
7472                        view.__buffa_unknown_fields
7473                            .push_record(before_tag, span_len, ctx)?;
7474                    }
7475                }
7476                ::core::result::Result::Ok(cur)
7477            }
7478            fn to_owned_message(
7479                &self,
7480            ) -> ::core::result::Result<
7481                super::super::GetBalanceHistoryResponse,
7482                ::buffa::DecodeError,
7483            > {
7484                self.to_owned_from_source(None)
7485            }
7486            #[allow(clippy::useless_conversion, clippy::needless_update)]
7487            fn to_owned_from_source(
7488                &self,
7489                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
7490            ) -> ::core::result::Result<
7491                super::super::GetBalanceHistoryResponse,
7492                ::buffa::DecodeError,
7493            > {
7494                #[allow(unused_imports)]
7495                use ::buffa::alloc::string::ToString as _;
7496                let _ = __buffa_src;
7497                ::core::result::Result::Ok(super::super::GetBalanceHistoryResponse {
7498                    range: self.range,
7499                    bucket: self.bucket.to_string(),
7500                    start_ts_sec: self.start_ts_sec,
7501                    end_ts_sec: self.end_ts_sec,
7502                    points: self.points,
7503                    series: self
7504                        .series
7505                        .iter()
7506                        .map(|v| v.to_owned_from_source(__buffa_src))
7507                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
7508                    __buffa_unknown_fields: self
7509                        .__buffa_unknown_fields
7510                        .to_owned()?
7511                        .into(),
7512                    ..::core::default::Default::default()
7513                })
7514            }
7515        }
7516        impl<'a> ::buffa::ViewEncode<'a> for GetBalanceHistoryResponseView<'a> {
7517            #[allow(clippy::needless_borrow, clippy::let_and_return)]
7518            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7519                #[allow(unused_imports)]
7520                use ::buffa::Enumeration as _;
7521                let mut size = 0u32;
7522                {
7523                    let val = self.range.to_i32();
7524                    if val != 0 {
7525                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7526                    }
7527                }
7528                if !self.bucket.is_empty() {
7529                    size
7530                        += 1u32
7531                            + ::buffa::types::string_encoded_len(&self.bucket) as u32;
7532                }
7533                if self.start_ts_sec != 0u32 {
7534                    size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
7535                }
7536                if self.end_ts_sec != 0u32 {
7537                    size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
7538                }
7539                if self.points != 0u32 {
7540                    size
7541                        += 1u32 + ::buffa::types::uint32_encoded_len(self.points) as u32;
7542                }
7543                for v in &self.series {
7544                    let __slot = __cache.reserve();
7545                    let inner_size = v.compute_size(__cache);
7546                    __cache.set(__slot, inner_size);
7547                    size
7548                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7549                            + inner_size;
7550                }
7551                size += self.__buffa_unknown_fields.encoded_len() as u32;
7552                size
7553            }
7554            #[allow(clippy::needless_borrow)]
7555            fn write_to(
7556                &self,
7557                __cache: &mut ::buffa::SizeCache,
7558                buf: &mut impl ::buffa::bytes::BufMut,
7559            ) {
7560                #[allow(unused_imports)]
7561                use ::buffa::Enumeration as _;
7562                {
7563                    let val = self.range.to_i32();
7564                    if val != 0 {
7565                        ::buffa::types::put_int32_field(1u32, val, buf);
7566                    }
7567                }
7568                if !self.bucket.is_empty() {
7569                    ::buffa::types::put_string_field(2u32, &self.bucket, buf);
7570                }
7571                if self.start_ts_sec != 0u32 {
7572                    ::buffa::types::put_fixed32_field(3u32, self.start_ts_sec, buf);
7573                }
7574                if self.end_ts_sec != 0u32 {
7575                    ::buffa::types::put_fixed32_field(4u32, self.end_ts_sec, buf);
7576                }
7577                if self.points != 0u32 {
7578                    ::buffa::types::put_uint32_field(5u32, self.points, buf);
7579                }
7580                for v in &self.series {
7581                    ::buffa::types::put_len_delimited_header(
7582                        6u32,
7583                        __cache.consume_next(),
7584                        buf,
7585                    );
7586                    v.write_to(__cache, buf);
7587                }
7588                self.__buffa_unknown_fields.write_to(buf);
7589            }
7590        }
7591        /// Serializes this view as protobuf JSON.
7592        ///
7593        /// Implicit-presence fields with default values are omitted, `required`
7594        /// fields are always emitted, explicit-presence (`optional`) fields are
7595        /// emitted only when set, bytes fields are base64-encoded, and enum
7596        /// values are their proto name strings.
7597        ///
7598        /// This impl uses `serialize_map(None)` because the number of emitted
7599        /// fields depends on default-omission rules; serializers that require
7600        /// known map lengths (e.g. `bincode`) will return a runtime error.
7601        /// Use the owned message type for those formats.
7602        impl<'__a> ::serde::Serialize for GetBalanceHistoryResponseView<'__a> {
7603            fn serialize<__S: ::serde::Serializer>(
7604                &self,
7605                __s: __S,
7606            ) -> ::core::result::Result<__S::Ok, __S::Error> {
7607                use ::serde::ser::SerializeMap as _;
7608                let mut __map = __s.serialize_map(::core::option::Option::None)?;
7609                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.range) {
7610                    __map.serialize_entry("range", &self.range)?;
7611                }
7612                if !::buffa::json_helpers::skip_if::is_empty_str(self.bucket) {
7613                    __map.serialize_entry("bucket", self.bucket)?;
7614                }
7615                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.start_ts_sec) {
7616                    __map
7617                        .serialize_entry(
7618                            "startTsSec",
7619                            &::buffa::json_helpers::ProtoJson(&self.start_ts_sec),
7620                        )?;
7621                }
7622                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.end_ts_sec) {
7623                    __map
7624                        .serialize_entry(
7625                            "endTsSec",
7626                            &::buffa::json_helpers::ProtoJson(&self.end_ts_sec),
7627                        )?;
7628                }
7629                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.points) {
7630                    __map
7631                        .serialize_entry(
7632                            "points",
7633                            &::buffa::json_helpers::ProtoJson(&self.points),
7634                        )?;
7635                }
7636                if !self.series.is_empty() {
7637                    __map.serialize_entry("series", &*self.series)?;
7638                }
7639                __map.end()
7640            }
7641        }
7642        impl<'a> ::buffa::MessageName for GetBalanceHistoryResponseView<'a> {
7643            const PACKAGE: &'static str = "ledger.read.v1";
7644            const NAME: &'static str = "GetBalanceHistoryResponse";
7645            const FULL_NAME: &'static str = "ledger.read.v1.GetBalanceHistoryResponse";
7646            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetBalanceHistoryResponse";
7647        }
7648        ::buffa::impl_default_view_instance!(GetBalanceHistoryResponseView);
7649        ::buffa::impl_view_reborrow!(GetBalanceHistoryResponseView);
7650        /** Self-contained, `'static` owned view of a `GetBalanceHistoryResponse` message.
7651
7652 Wraps [`::buffa::OwnedView`]`<`[`GetBalanceHistoryResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
7653
7654 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetBalanceHistoryResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
7655        #[derive(Clone, Debug)]
7656        pub struct GetBalanceHistoryResponseOwnedView(
7657            ::buffa::OwnedView<GetBalanceHistoryResponseView<'static>>,
7658        );
7659        impl GetBalanceHistoryResponseOwnedView {
7660            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
7661            ///
7662            /// The view borrows directly from the buffer's data; the buffer is
7663            /// retained inside the returned handle.
7664            ///
7665            /// # Errors
7666            ///
7667            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
7668            /// protobuf data.
7669            pub fn decode(
7670                bytes: ::buffa::bytes::Bytes,
7671            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7672                ::core::result::Result::Ok(
7673                    GetBalanceHistoryResponseOwnedView(
7674                        ::buffa::OwnedView::decode(bytes)?,
7675                    ),
7676                )
7677            }
7678            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
7679            /// max message size).
7680            ///
7681            /// # Errors
7682            ///
7683            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
7684            /// exceeds the configured limits.
7685            pub fn decode_with_options(
7686                bytes: ::buffa::bytes::Bytes,
7687                opts: &::buffa::DecodeOptions,
7688            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7689                ::core::result::Result::Ok(
7690                    GetBalanceHistoryResponseOwnedView(
7691                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
7692                    ),
7693                )
7694            }
7695            /// Build from an owned message via an encode → decode round-trip.
7696            ///
7697            /// # Errors
7698            ///
7699            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
7700            /// somehow invalid (should not happen for well-formed messages).
7701            pub fn from_owned(
7702                msg: &super::super::GetBalanceHistoryResponse,
7703            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7704                ::core::result::Result::Ok(
7705                    GetBalanceHistoryResponseOwnedView(
7706                        ::buffa::OwnedView::from_owned(msg)?,
7707                    ),
7708                )
7709            }
7710            /// Borrow the full [`GetBalanceHistoryResponseView`] with its lifetime tied to `&self`.
7711            #[must_use]
7712            pub fn view(&self) -> &GetBalanceHistoryResponseView<'_> {
7713                self.0.reborrow()
7714            }
7715            /// Convert to the owned message type.
7716            ///
7717            /// # Errors
7718            ///
7719            /// Returns an error if re-materializing preserved unknown fields
7720            /// fails (e.g. the unknown-field limit is exceeded).
7721            pub fn to_owned_message(
7722                &self,
7723            ) -> ::core::result::Result<
7724                super::super::GetBalanceHistoryResponse,
7725                ::buffa::DecodeError,
7726            > {
7727                self.0.to_owned_message()
7728            }
7729            /// The underlying bytes buffer.
7730            #[must_use]
7731            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
7732                self.0.bytes()
7733            }
7734            /// Consume the handle, returning the underlying bytes buffer.
7735            #[must_use]
7736            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
7737                self.0.into_bytes()
7738            }
7739            /// Resolved history window.
7740            ///
7741            /// Field 1: `range`
7742            #[must_use]
7743            pub fn range(&self) -> ::buffa::EnumValue<super::super::BalanceRange> {
7744                self.0.reborrow().range
7745            }
7746            /// Sampling interval between points, such as "5m" or "1h".
7747            ///
7748            /// Field 2: `bucket`
7749            #[must_use]
7750            pub fn bucket(&self) -> &'_ str {
7751                self.0.reborrow().bucket
7752            }
7753            /// First point timestamp in seconds since epoch (UTC).
7754            ///
7755            /// Field 3: `start_ts_sec`
7756            #[must_use]
7757            pub fn start_ts_sec(&self) -> u32 {
7758                self.0.reborrow().start_ts_sec
7759            }
7760            /// Last point timestamp in seconds since epoch (UTC).
7761            ///
7762            /// Field 4: `end_ts_sec`
7763            #[must_use]
7764            pub fn end_ts_sec(&self) -> u32 {
7765                self.0.reborrow().end_ts_sec
7766            }
7767            /// Number of aligned points in each returned series.
7768            ///
7769            /// Field 5: `points`
7770            #[must_use]
7771            pub fn points(&self) -> u32 {
7772                self.0.reborrow().points
7773            }
7774            /// Balance series ordered by asset ID, then account bucket.
7775            ///
7776            /// Field 6: `series`
7777            #[must_use]
7778            pub fn series(
7779                &self,
7780            ) -> &::buffa::RepeatedView<
7781                '_,
7782                super::super::__buffa::view::BalanceSeriesView<'_>,
7783            > {
7784                &self.0.reborrow().series
7785            }
7786        }
7787        impl ::core::convert::From<
7788            ::buffa::OwnedView<GetBalanceHistoryResponseView<'static>>,
7789        > for GetBalanceHistoryResponseOwnedView {
7790            fn from(
7791                inner: ::buffa::OwnedView<GetBalanceHistoryResponseView<'static>>,
7792            ) -> Self {
7793                GetBalanceHistoryResponseOwnedView(inner)
7794            }
7795        }
7796        impl ::core::convert::From<GetBalanceHistoryResponseOwnedView>
7797        for ::buffa::OwnedView<GetBalanceHistoryResponseView<'static>> {
7798            fn from(wrapper: GetBalanceHistoryResponseOwnedView) -> Self {
7799                wrapper.0
7800            }
7801        }
7802        impl ::core::convert::AsRef<
7803            ::buffa::OwnedView<GetBalanceHistoryResponseView<'static>>,
7804        > for GetBalanceHistoryResponseOwnedView {
7805            fn as_ref(
7806                &self,
7807            ) -> &::buffa::OwnedView<GetBalanceHistoryResponseView<'static>> {
7808                &self.0
7809            }
7810        }
7811        impl ::buffa::HasMessageView for super::super::GetBalanceHistoryResponse {
7812            type View<'a> = GetBalanceHistoryResponseView<'a>;
7813            type ViewHandle = GetBalanceHistoryResponseOwnedView;
7814        }
7815        impl ::serde::Serialize for GetBalanceHistoryResponseOwnedView {
7816            fn serialize<__S: ::serde::Serializer>(
7817                &self,
7818                __s: __S,
7819            ) -> ::core::result::Result<__S::Ok, __S::Error> {
7820                ::serde::Serialize::serialize(&self.0, __s)
7821            }
7822        }
7823        /// Account grouping metadata (used when group_by = ACCOUNT).
7824        #[derive(Clone, Debug, Default)]
7825        pub struct AccountGroupingView<'a> {
7826            /// account bucket code
7827            ///
7828            /// Field 1: `account_code`
7829            pub account_code: u32,
7830            /// human-readable name ("funding", "trading")
7831            ///
7832            /// Field 2: `name`
7833            pub name: &'a str,
7834            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
7835        }
7836        impl<'a> ::buffa::MessageView<'a> for AccountGroupingView<'a> {
7837            type Owned = super::super::AccountGrouping;
7838            fn decode_view(
7839                buf: &'a [u8],
7840            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7841                let __limit = ::core::cell::Cell::new(
7842                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
7843                );
7844                <Self as ::buffa::MessageView>::decode_view_ctx(
7845                    buf,
7846                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
7847                )
7848            }
7849            fn decode_view_with_ctx(
7850                buf: &'a [u8],
7851                ctx: ::buffa::DecodeContext<'_>,
7852            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7853                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
7854            }
7855            fn merge_view_field(
7856                &mut self,
7857                tag: ::buffa::encoding::Tag,
7858                cur: &'a [u8],
7859                before_tag: &'a [u8],
7860                ctx: ::buffa::DecodeContext<'_>,
7861            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
7862                let _ = ctx;
7863                #[allow(unused_variables)]
7864                let view = self;
7865                let mut cur = cur;
7866                match tag.field_number() {
7867                    1u32 => {
7868                        ::buffa::encoding::check_wire_type(
7869                            tag,
7870                            ::buffa::encoding::WireType::Varint,
7871                        )?;
7872                        view.account_code = ::buffa::types::decode_uint32(&mut cur)?;
7873                    }
7874                    2u32 => {
7875                        ::buffa::encoding::check_wire_type(
7876                            tag,
7877                            ::buffa::encoding::WireType::LengthDelimited,
7878                        )?;
7879                        view.name = ::buffa::types::borrow_str(&mut cur)?;
7880                    }
7881                    _ => {
7882                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
7883                        let span_len = before_tag.len() - cur.len();
7884                        view.__buffa_unknown_fields
7885                            .push_record(before_tag, span_len, ctx)?;
7886                    }
7887                }
7888                ::core::result::Result::Ok(cur)
7889            }
7890            fn to_owned_message(
7891                &self,
7892            ) -> ::core::result::Result<
7893                super::super::AccountGrouping,
7894                ::buffa::DecodeError,
7895            > {
7896                self.to_owned_from_source(None)
7897            }
7898            #[allow(clippy::useless_conversion, clippy::needless_update)]
7899            fn to_owned_from_source(
7900                &self,
7901                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
7902            ) -> ::core::result::Result<
7903                super::super::AccountGrouping,
7904                ::buffa::DecodeError,
7905            > {
7906                #[allow(unused_imports)]
7907                use ::buffa::alloc::string::ToString as _;
7908                let _ = __buffa_src;
7909                ::core::result::Result::Ok(super::super::AccountGrouping {
7910                    account_code: self.account_code,
7911                    name: self.name.to_string(),
7912                    __buffa_unknown_fields: self
7913                        .__buffa_unknown_fields
7914                        .to_owned()?
7915                        .into(),
7916                    ..::core::default::Default::default()
7917                })
7918            }
7919        }
7920        impl<'a> ::buffa::ViewEncode<'a> for AccountGroupingView<'a> {
7921            #[allow(clippy::needless_borrow, clippy::let_and_return)]
7922            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7923                #[allow(unused_imports)]
7924                use ::buffa::Enumeration as _;
7925                let mut size = 0u32;
7926                if self.account_code != 0u32 {
7927                    size
7928                        += 1u32
7929                            + ::buffa::types::uint32_encoded_len(self.account_code)
7930                                as u32;
7931                }
7932                if !self.name.is_empty() {
7933                    size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
7934                }
7935                size += self.__buffa_unknown_fields.encoded_len() as u32;
7936                size
7937            }
7938            #[allow(clippy::needless_borrow)]
7939            fn write_to(
7940                &self,
7941                _cache: &mut ::buffa::SizeCache,
7942                buf: &mut impl ::buffa::bytes::BufMut,
7943            ) {
7944                #[allow(unused_imports)]
7945                use ::buffa::Enumeration as _;
7946                if self.account_code != 0u32 {
7947                    ::buffa::types::put_uint32_field(1u32, self.account_code, buf);
7948                }
7949                if !self.name.is_empty() {
7950                    ::buffa::types::put_string_field(2u32, &self.name, buf);
7951                }
7952                self.__buffa_unknown_fields.write_to(buf);
7953            }
7954        }
7955        /// Serializes this view as protobuf JSON.
7956        ///
7957        /// Implicit-presence fields with default values are omitted, `required`
7958        /// fields are always emitted, explicit-presence (`optional`) fields are
7959        /// emitted only when set, bytes fields are base64-encoded, and enum
7960        /// values are their proto name strings.
7961        ///
7962        /// This impl uses `serialize_map(None)` because the number of emitted
7963        /// fields depends on default-omission rules; serializers that require
7964        /// known map lengths (e.g. `bincode`) will return a runtime error.
7965        /// Use the owned message type for those formats.
7966        impl<'__a> ::serde::Serialize for AccountGroupingView<'__a> {
7967            fn serialize<__S: ::serde::Serializer>(
7968                &self,
7969                __s: __S,
7970            ) -> ::core::result::Result<__S::Ok, __S::Error> {
7971                use ::serde::ser::SerializeMap as _;
7972                let mut __map = __s.serialize_map(::core::option::Option::None)?;
7973                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.account_code) {
7974                    __map
7975                        .serialize_entry(
7976                            "accountCode",
7977                            &::buffa::json_helpers::ProtoJson(&self.account_code),
7978                        )?;
7979                }
7980                if !::buffa::json_helpers::skip_if::is_empty_str(self.name) {
7981                    __map.serialize_entry("name", self.name)?;
7982                }
7983                __map.end()
7984            }
7985        }
7986        impl<'a> ::buffa::MessageName for AccountGroupingView<'a> {
7987            const PACKAGE: &'static str = "ledger.read.v1";
7988            const NAME: &'static str = "AccountGrouping";
7989            const FULL_NAME: &'static str = "ledger.read.v1.AccountGrouping";
7990            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AccountGrouping";
7991        }
7992        ::buffa::impl_default_view_instance!(AccountGroupingView);
7993        ::buffa::impl_view_reborrow!(AccountGroupingView);
7994        /** Self-contained, `'static` owned view of a `AccountGrouping` message.
7995
7996 Wraps [`::buffa::OwnedView`]`<`[`AccountGroupingView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
7997
7998 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AccountGroupingView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
7999        #[derive(Clone, Debug)]
8000        pub struct AccountGroupingOwnedView(
8001            ::buffa::OwnedView<AccountGroupingView<'static>>,
8002        );
8003        impl AccountGroupingOwnedView {
8004            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
8005            ///
8006            /// The view borrows directly from the buffer's data; the buffer is
8007            /// retained inside the returned handle.
8008            ///
8009            /// # Errors
8010            ///
8011            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
8012            /// protobuf data.
8013            pub fn decode(
8014                bytes: ::buffa::bytes::Bytes,
8015            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8016                ::core::result::Result::Ok(
8017                    AccountGroupingOwnedView(::buffa::OwnedView::decode(bytes)?),
8018                )
8019            }
8020            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
8021            /// max message size).
8022            ///
8023            /// # Errors
8024            ///
8025            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
8026            /// exceeds the configured limits.
8027            pub fn decode_with_options(
8028                bytes: ::buffa::bytes::Bytes,
8029                opts: &::buffa::DecodeOptions,
8030            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8031                ::core::result::Result::Ok(
8032                    AccountGroupingOwnedView(
8033                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
8034                    ),
8035                )
8036            }
8037            /// Build from an owned message via an encode → decode round-trip.
8038            ///
8039            /// # Errors
8040            ///
8041            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
8042            /// somehow invalid (should not happen for well-formed messages).
8043            pub fn from_owned(
8044                msg: &super::super::AccountGrouping,
8045            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8046                ::core::result::Result::Ok(
8047                    AccountGroupingOwnedView(::buffa::OwnedView::from_owned(msg)?),
8048                )
8049            }
8050            /// Borrow the full [`AccountGroupingView`] with its lifetime tied to `&self`.
8051            #[must_use]
8052            pub fn view(&self) -> &AccountGroupingView<'_> {
8053                self.0.reborrow()
8054            }
8055            /// Convert to the owned message type.
8056            ///
8057            /// # Errors
8058            ///
8059            /// Returns an error if re-materializing preserved unknown fields
8060            /// fails (e.g. the unknown-field limit is exceeded).
8061            pub fn to_owned_message(
8062                &self,
8063            ) -> ::core::result::Result<
8064                super::super::AccountGrouping,
8065                ::buffa::DecodeError,
8066            > {
8067                self.0.to_owned_message()
8068            }
8069            /// The underlying bytes buffer.
8070            #[must_use]
8071            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
8072                self.0.bytes()
8073            }
8074            /// Consume the handle, returning the underlying bytes buffer.
8075            #[must_use]
8076            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
8077                self.0.into_bytes()
8078            }
8079            /// account bucket code
8080            ///
8081            /// Field 1: `account_code`
8082            #[must_use]
8083            pub fn account_code(&self) -> u32 {
8084                self.0.reborrow().account_code
8085            }
8086            /// human-readable name ("funding", "trading")
8087            ///
8088            /// Field 2: `name`
8089            #[must_use]
8090            pub fn name(&self) -> &'_ str {
8091                self.0.reborrow().name
8092            }
8093        }
8094        impl ::core::convert::From<::buffa::OwnedView<AccountGroupingView<'static>>>
8095        for AccountGroupingOwnedView {
8096            fn from(inner: ::buffa::OwnedView<AccountGroupingView<'static>>) -> Self {
8097                AccountGroupingOwnedView(inner)
8098            }
8099        }
8100        impl ::core::convert::From<AccountGroupingOwnedView>
8101        for ::buffa::OwnedView<AccountGroupingView<'static>> {
8102            fn from(wrapper: AccountGroupingOwnedView) -> Self {
8103                wrapper.0
8104            }
8105        }
8106        impl ::core::convert::AsRef<::buffa::OwnedView<AccountGroupingView<'static>>>
8107        for AccountGroupingOwnedView {
8108            fn as_ref(&self) -> &::buffa::OwnedView<AccountGroupingView<'static>> {
8109                &self.0
8110            }
8111        }
8112        impl ::buffa::HasMessageView for super::super::AccountGrouping {
8113            type View<'a> = AccountGroupingView<'a>;
8114            type ViewHandle = AccountGroupingOwnedView;
8115        }
8116        impl ::serde::Serialize for AccountGroupingOwnedView {
8117            fn serialize<__S: ::serde::Serializer>(
8118                &self,
8119                __s: __S,
8120            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8121                ::serde::Serialize::serialize(&self.0, __s)
8122            }
8123        }
8124        /// Asset grouping metadata (used when group_by = ASSET).
8125        #[derive(Clone, Debug, Default)]
8126        pub struct AssetGroupingView<'a> {
8127            /// public asset id (0 for "OTHER" bucket)
8128            ///
8129            /// Field 1: `id`
8130            pub id: u32,
8131            /// asset symbol ("BTC", "ETH", "OTHER")
8132            ///
8133            /// Field 2: `symbol`
8134            pub symbol: &'a str,
8135            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
8136        }
8137        impl<'a> ::buffa::MessageView<'a> for AssetGroupingView<'a> {
8138            type Owned = super::super::AssetGrouping;
8139            fn decode_view(
8140                buf: &'a [u8],
8141            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8142                let __limit = ::core::cell::Cell::new(
8143                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
8144                );
8145                <Self as ::buffa::MessageView>::decode_view_ctx(
8146                    buf,
8147                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
8148                )
8149            }
8150            fn decode_view_with_ctx(
8151                buf: &'a [u8],
8152                ctx: ::buffa::DecodeContext<'_>,
8153            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8154                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
8155            }
8156            fn merge_view_field(
8157                &mut self,
8158                tag: ::buffa::encoding::Tag,
8159                cur: &'a [u8],
8160                before_tag: &'a [u8],
8161                ctx: ::buffa::DecodeContext<'_>,
8162            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
8163                let _ = ctx;
8164                #[allow(unused_variables)]
8165                let view = self;
8166                let mut cur = cur;
8167                match tag.field_number() {
8168                    1u32 => {
8169                        ::buffa::encoding::check_wire_type(
8170                            tag,
8171                            ::buffa::encoding::WireType::Varint,
8172                        )?;
8173                        view.id = ::buffa::types::decode_uint32(&mut cur)?;
8174                    }
8175                    2u32 => {
8176                        ::buffa::encoding::check_wire_type(
8177                            tag,
8178                            ::buffa::encoding::WireType::LengthDelimited,
8179                        )?;
8180                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
8181                    }
8182                    _ => {
8183                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
8184                        let span_len = before_tag.len() - cur.len();
8185                        view.__buffa_unknown_fields
8186                            .push_record(before_tag, span_len, ctx)?;
8187                    }
8188                }
8189                ::core::result::Result::Ok(cur)
8190            }
8191            fn to_owned_message(
8192                &self,
8193            ) -> ::core::result::Result<
8194                super::super::AssetGrouping,
8195                ::buffa::DecodeError,
8196            > {
8197                self.to_owned_from_source(None)
8198            }
8199            #[allow(clippy::useless_conversion, clippy::needless_update)]
8200            fn to_owned_from_source(
8201                &self,
8202                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
8203            ) -> ::core::result::Result<
8204                super::super::AssetGrouping,
8205                ::buffa::DecodeError,
8206            > {
8207                #[allow(unused_imports)]
8208                use ::buffa::alloc::string::ToString as _;
8209                let _ = __buffa_src;
8210                ::core::result::Result::Ok(super::super::AssetGrouping {
8211                    id: self.id,
8212                    symbol: self.symbol.to_string(),
8213                    __buffa_unknown_fields: self
8214                        .__buffa_unknown_fields
8215                        .to_owned()?
8216                        .into(),
8217                    ..::core::default::Default::default()
8218                })
8219            }
8220        }
8221        impl<'a> ::buffa::ViewEncode<'a> for AssetGroupingView<'a> {
8222            #[allow(clippy::needless_borrow, clippy::let_and_return)]
8223            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8224                #[allow(unused_imports)]
8225                use ::buffa::Enumeration as _;
8226                let mut size = 0u32;
8227                if self.id != 0u32 {
8228                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.id) as u32;
8229                }
8230                if !self.symbol.is_empty() {
8231                    size
8232                        += 1u32
8233                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
8234                }
8235                size += self.__buffa_unknown_fields.encoded_len() as u32;
8236                size
8237            }
8238            #[allow(clippy::needless_borrow)]
8239            fn write_to(
8240                &self,
8241                _cache: &mut ::buffa::SizeCache,
8242                buf: &mut impl ::buffa::bytes::BufMut,
8243            ) {
8244                #[allow(unused_imports)]
8245                use ::buffa::Enumeration as _;
8246                if self.id != 0u32 {
8247                    ::buffa::types::put_uint32_field(1u32, self.id, buf);
8248                }
8249                if !self.symbol.is_empty() {
8250                    ::buffa::types::put_string_field(2u32, &self.symbol, buf);
8251                }
8252                self.__buffa_unknown_fields.write_to(buf);
8253            }
8254        }
8255        /// Serializes this view as protobuf JSON.
8256        ///
8257        /// Implicit-presence fields with default values are omitted, `required`
8258        /// fields are always emitted, explicit-presence (`optional`) fields are
8259        /// emitted only when set, bytes fields are base64-encoded, and enum
8260        /// values are their proto name strings.
8261        ///
8262        /// This impl uses `serialize_map(None)` because the number of emitted
8263        /// fields depends on default-omission rules; serializers that require
8264        /// known map lengths (e.g. `bincode`) will return a runtime error.
8265        /// Use the owned message type for those formats.
8266        impl<'__a> ::serde::Serialize for AssetGroupingView<'__a> {
8267            fn serialize<__S: ::serde::Serializer>(
8268                &self,
8269                __s: __S,
8270            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8271                use ::serde::ser::SerializeMap as _;
8272                let mut __map = __s.serialize_map(::core::option::Option::None)?;
8273                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.id) {
8274                    __map
8275                        .serialize_entry(
8276                            "id",
8277                            &::buffa::json_helpers::ProtoJson(&self.id),
8278                        )?;
8279                }
8280                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
8281                    __map.serialize_entry("symbol", self.symbol)?;
8282                }
8283                __map.end()
8284            }
8285        }
8286        impl<'a> ::buffa::MessageName for AssetGroupingView<'a> {
8287            const PACKAGE: &'static str = "ledger.read.v1";
8288            const NAME: &'static str = "AssetGrouping";
8289            const FULL_NAME: &'static str = "ledger.read.v1.AssetGrouping";
8290            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.AssetGrouping";
8291        }
8292        ::buffa::impl_default_view_instance!(AssetGroupingView);
8293        ::buffa::impl_view_reborrow!(AssetGroupingView);
8294        /** Self-contained, `'static` owned view of a `AssetGrouping` message.
8295
8296 Wraps [`::buffa::OwnedView`]`<`[`AssetGroupingView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
8297
8298 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AssetGroupingView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
8299        #[derive(Clone, Debug)]
8300        pub struct AssetGroupingOwnedView(
8301            ::buffa::OwnedView<AssetGroupingView<'static>>,
8302        );
8303        impl AssetGroupingOwnedView {
8304            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
8305            ///
8306            /// The view borrows directly from the buffer's data; the buffer is
8307            /// retained inside the returned handle.
8308            ///
8309            /// # Errors
8310            ///
8311            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
8312            /// protobuf data.
8313            pub fn decode(
8314                bytes: ::buffa::bytes::Bytes,
8315            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8316                ::core::result::Result::Ok(
8317                    AssetGroupingOwnedView(::buffa::OwnedView::decode(bytes)?),
8318                )
8319            }
8320            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
8321            /// max message size).
8322            ///
8323            /// # Errors
8324            ///
8325            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
8326            /// exceeds the configured limits.
8327            pub fn decode_with_options(
8328                bytes: ::buffa::bytes::Bytes,
8329                opts: &::buffa::DecodeOptions,
8330            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8331                ::core::result::Result::Ok(
8332                    AssetGroupingOwnedView(
8333                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
8334                    ),
8335                )
8336            }
8337            /// Build from an owned message via an encode → decode round-trip.
8338            ///
8339            /// # Errors
8340            ///
8341            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
8342            /// somehow invalid (should not happen for well-formed messages).
8343            pub fn from_owned(
8344                msg: &super::super::AssetGrouping,
8345            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8346                ::core::result::Result::Ok(
8347                    AssetGroupingOwnedView(::buffa::OwnedView::from_owned(msg)?),
8348                )
8349            }
8350            /// Borrow the full [`AssetGroupingView`] with its lifetime tied to `&self`.
8351            #[must_use]
8352            pub fn view(&self) -> &AssetGroupingView<'_> {
8353                self.0.reborrow()
8354            }
8355            /// Convert to the owned message type.
8356            ///
8357            /// # Errors
8358            ///
8359            /// Returns an error if re-materializing preserved unknown fields
8360            /// fails (e.g. the unknown-field limit is exceeded).
8361            pub fn to_owned_message(
8362                &self,
8363            ) -> ::core::result::Result<
8364                super::super::AssetGrouping,
8365                ::buffa::DecodeError,
8366            > {
8367                self.0.to_owned_message()
8368            }
8369            /// The underlying bytes buffer.
8370            #[must_use]
8371            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
8372                self.0.bytes()
8373            }
8374            /// Consume the handle, returning the underlying bytes buffer.
8375            #[must_use]
8376            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
8377                self.0.into_bytes()
8378            }
8379            /// public asset id (0 for "OTHER" bucket)
8380            ///
8381            /// Field 1: `id`
8382            #[must_use]
8383            pub fn id(&self) -> u32 {
8384                self.0.reborrow().id
8385            }
8386            /// asset symbol ("BTC", "ETH", "OTHER")
8387            ///
8388            /// Field 2: `symbol`
8389            #[must_use]
8390            pub fn symbol(&self) -> &'_ str {
8391                self.0.reborrow().symbol
8392            }
8393        }
8394        impl ::core::convert::From<::buffa::OwnedView<AssetGroupingView<'static>>>
8395        for AssetGroupingOwnedView {
8396            fn from(inner: ::buffa::OwnedView<AssetGroupingView<'static>>) -> Self {
8397                AssetGroupingOwnedView(inner)
8398            }
8399        }
8400        impl ::core::convert::From<AssetGroupingOwnedView>
8401        for ::buffa::OwnedView<AssetGroupingView<'static>> {
8402            fn from(wrapper: AssetGroupingOwnedView) -> Self {
8403                wrapper.0
8404            }
8405        }
8406        impl ::core::convert::AsRef<::buffa::OwnedView<AssetGroupingView<'static>>>
8407        for AssetGroupingOwnedView {
8408            fn as_ref(&self) -> &::buffa::OwnedView<AssetGroupingView<'static>> {
8409                &self.0
8410            }
8411        }
8412        impl ::buffa::HasMessageView for super::super::AssetGrouping {
8413            type View<'a> = AssetGroupingView<'a>;
8414            type ViewHandle = AssetGroupingOwnedView;
8415        }
8416        impl ::serde::Serialize for AssetGroupingOwnedView {
8417            fn serialize<__S: ::serde::Serializer>(
8418                &self,
8419                __s: __S,
8420            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8421                ::serde::Serialize::serialize(&self.0, __s)
8422            }
8423        }
8424        /// Equity history in USDT (or BTC via client-side conversion using btc_prices).
8425        /// Values are derived from per-asset balances and market prices (close ticks).
8426        #[derive(Clone, Debug, Default)]
8427        pub struct GetEquityHistorySeriesRequestView<'a> {
8428            /// Optional sub-account to scope equity to. If omitted, equity is returned for
8429            /// the authenticated root account derived from the JWT or API key.
8430            ///
8431            /// Field 1: `subaccount_id`
8432            pub subaccount_id: ::core::option::Option<u64>,
8433            /// History window to return. When unset/UNSPECIFIED, defaults to 1D.
8434            ///
8435            /// Field 2: `range`
8436            pub range: ::buffa::EnumValue<super::super::BalanceRange>,
8437            /// Optional subset of account buckets.
8438            /// When empty, server returns both funding and trading.
8439            /// Only used when group_by = ACCOUNT.
8440            ///
8441            /// Field 4: `account_codes`
8442            pub account_codes: ::buffa::RepeatedView<
8443                'a,
8444                ::buffa::EnumValue<super::super::super::super::v1::AccountCode>,
8445            >,
8446            /// How to group the equity series. Defaults to ACCOUNT if unspecified.
8447            ///
8448            /// Field 5: `group_by`
8449            pub group_by: ::buffa::EnumValue<super::super::EquityGroupBy>,
8450            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
8451        }
8452        impl<'a> ::buffa::MessageView<'a> for GetEquityHistorySeriesRequestView<'a> {
8453            type Owned = super::super::GetEquityHistorySeriesRequest;
8454            fn decode_view(
8455                buf: &'a [u8],
8456            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8457                let __limit = ::core::cell::Cell::new(
8458                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
8459                );
8460                <Self as ::buffa::MessageView>::decode_view_ctx(
8461                    buf,
8462                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
8463                )
8464            }
8465            fn decode_view_with_ctx(
8466                buf: &'a [u8],
8467                ctx: ::buffa::DecodeContext<'_>,
8468            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8469                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
8470            }
8471            fn merge_view_field(
8472                &mut self,
8473                tag: ::buffa::encoding::Tag,
8474                cur: &'a [u8],
8475                before_tag: &'a [u8],
8476                ctx: ::buffa::DecodeContext<'_>,
8477            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
8478                let _ = ctx;
8479                #[allow(unused_variables)]
8480                let view = self;
8481                let mut cur = cur;
8482                match tag.field_number() {
8483                    1u32 => {
8484                        ::buffa::encoding::check_wire_type(
8485                            tag,
8486                            ::buffa::encoding::WireType::Fixed64,
8487                        )?;
8488                        view.subaccount_id = Some(
8489                            ::buffa::types::decode_fixed64(&mut cur)?,
8490                        );
8491                    }
8492                    2u32 => {
8493                        ::buffa::encoding::check_wire_type(
8494                            tag,
8495                            ::buffa::encoding::WireType::Varint,
8496                        )?;
8497                        view.range = ::buffa::EnumValue::from(
8498                            ::buffa::types::decode_int32(&mut cur)?,
8499                        );
8500                    }
8501                    5u32 => {
8502                        ::buffa::encoding::check_wire_type(
8503                            tag,
8504                            ::buffa::encoding::WireType::Varint,
8505                        )?;
8506                        view.group_by = ::buffa::EnumValue::from(
8507                            ::buffa::types::decode_int32(&mut cur)?,
8508                        );
8509                    }
8510                    4u32 => {
8511                        if tag.wire_type()
8512                            == ::buffa::encoding::WireType::LengthDelimited
8513                        {
8514                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
8515                            view.account_codes
8516                                .reserve(::buffa::encoding::count_varints(payload));
8517                            let mut pcur: &[u8] = payload;
8518                            while !pcur.is_empty() {
8519                                view.account_codes
8520                                    .push(
8521                                        ::buffa::EnumValue::from(
8522                                            ::buffa::types::decode_int32(&mut pcur)?,
8523                                        ),
8524                                    );
8525                            }
8526                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
8527                        {
8528                            view.account_codes
8529                                .push(
8530                                    ::buffa::EnumValue::from(
8531                                        ::buffa::types::decode_int32(&mut cur)?,
8532                                    ),
8533                                );
8534                        } else {
8535                            return Err(
8536                                ::buffa::encoding::wire_type_mismatch(
8537                                    tag,
8538                                    ::buffa::encoding::WireType::LengthDelimited,
8539                                ),
8540                            );
8541                        }
8542                    }
8543                    _ => {
8544                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
8545                        let span_len = before_tag.len() - cur.len();
8546                        view.__buffa_unknown_fields
8547                            .push_record(before_tag, span_len, ctx)?;
8548                    }
8549                }
8550                ::core::result::Result::Ok(cur)
8551            }
8552            fn to_owned_message(
8553                &self,
8554            ) -> ::core::result::Result<
8555                super::super::GetEquityHistorySeriesRequest,
8556                ::buffa::DecodeError,
8557            > {
8558                self.to_owned_from_source(None)
8559            }
8560            #[allow(clippy::useless_conversion, clippy::needless_update)]
8561            fn to_owned_from_source(
8562                &self,
8563                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
8564            ) -> ::core::result::Result<
8565                super::super::GetEquityHistorySeriesRequest,
8566                ::buffa::DecodeError,
8567            > {
8568                #[allow(unused_imports)]
8569                use ::buffa::alloc::string::ToString as _;
8570                let _ = __buffa_src;
8571                ::core::result::Result::Ok(super::super::GetEquityHistorySeriesRequest {
8572                    subaccount_id: self.subaccount_id,
8573                    range: self.range,
8574                    account_codes: self.account_codes.to_vec(),
8575                    group_by: self.group_by,
8576                    __buffa_unknown_fields: self
8577                        .__buffa_unknown_fields
8578                        .to_owned()?
8579                        .into(),
8580                    ..::core::default::Default::default()
8581                })
8582            }
8583        }
8584        impl<'a> ::buffa::ViewEncode<'a> for GetEquityHistorySeriesRequestView<'a> {
8585            #[allow(clippy::needless_borrow, clippy::let_and_return)]
8586            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8587                #[allow(unused_imports)]
8588                use ::buffa::Enumeration as _;
8589                let mut size = 0u32;
8590                if self.subaccount_id.is_some() {
8591                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
8592                }
8593                {
8594                    let val = self.range.to_i32();
8595                    if val != 0 {
8596                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8597                    }
8598                }
8599                if !self.account_codes.is_empty() {
8600                    let payload: u32 = self
8601                        .account_codes
8602                        .iter()
8603                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
8604                        .sum::<u32>();
8605                    size
8606                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
8607                            + payload;
8608                }
8609                {
8610                    let val = self.group_by.to_i32();
8611                    if val != 0 {
8612                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8613                    }
8614                }
8615                size += self.__buffa_unknown_fields.encoded_len() as u32;
8616                size
8617            }
8618            #[allow(clippy::needless_borrow)]
8619            fn write_to(
8620                &self,
8621                _cache: &mut ::buffa::SizeCache,
8622                buf: &mut impl ::buffa::bytes::BufMut,
8623            ) {
8624                #[allow(unused_imports)]
8625                use ::buffa::Enumeration as _;
8626                if let Some(v) = self.subaccount_id {
8627                    ::buffa::types::put_fixed64_field(1u32, v, buf);
8628                }
8629                {
8630                    let val = self.range.to_i32();
8631                    if val != 0 {
8632                        ::buffa::types::put_int32_field(2u32, val, buf);
8633                    }
8634                }
8635                if !self.account_codes.is_empty() {
8636                    let payload: u32 = self
8637                        .account_codes
8638                        .iter()
8639                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
8640                        .sum::<u32>();
8641                    ::buffa::types::put_len_delimited_header(4u32, payload, buf);
8642                    for v in &self.account_codes {
8643                        ::buffa::types::encode_int32(v.to_i32(), buf);
8644                    }
8645                }
8646                {
8647                    let val = self.group_by.to_i32();
8648                    if val != 0 {
8649                        ::buffa::types::put_int32_field(5u32, val, buf);
8650                    }
8651                }
8652                self.__buffa_unknown_fields.write_to(buf);
8653            }
8654        }
8655        /// Serializes this view as protobuf JSON.
8656        ///
8657        /// Implicit-presence fields with default values are omitted, `required`
8658        /// fields are always emitted, explicit-presence (`optional`) fields are
8659        /// emitted only when set, bytes fields are base64-encoded, and enum
8660        /// values are their proto name strings.
8661        ///
8662        /// This impl uses `serialize_map(None)` because the number of emitted
8663        /// fields depends on default-omission rules; serializers that require
8664        /// known map lengths (e.g. `bincode`) will return a runtime error.
8665        /// Use the owned message type for those formats.
8666        impl<'__a> ::serde::Serialize for GetEquityHistorySeriesRequestView<'__a> {
8667            fn serialize<__S: ::serde::Serializer>(
8668                &self,
8669                __s: __S,
8670            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8671                use ::serde::ser::SerializeMap as _;
8672                let mut __map = __s.serialize_map(::core::option::Option::None)?;
8673                if let ::core::option::Option::Some(__v) = self.subaccount_id {
8674                    __map
8675                        .serialize_entry(
8676                            "subaccountId",
8677                            &::buffa::json_helpers::ProtoJson(&__v),
8678                        )?;
8679                }
8680                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.range) {
8681                    __map.serialize_entry("range", &self.range)?;
8682                }
8683                if !self.account_codes.is_empty() {
8684                    __map
8685                        .serialize_entry(
8686                            "accountCodes",
8687                            &::buffa::json_helpers::EnumSeqJson(&self.account_codes),
8688                        )?;
8689                }
8690                if !::buffa::json_helpers::skip_if::is_default_enum_value(
8691                    &self.group_by,
8692                ) {
8693                    __map.serialize_entry("groupBy", &self.group_by)?;
8694                }
8695                __map.end()
8696            }
8697        }
8698        impl<'a> ::buffa::MessageName for GetEquityHistorySeriesRequestView<'a> {
8699            const PACKAGE: &'static str = "ledger.read.v1";
8700            const NAME: &'static str = "GetEquityHistorySeriesRequest";
8701            const FULL_NAME: &'static str = "ledger.read.v1.GetEquityHistorySeriesRequest";
8702            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesRequest";
8703        }
8704        ::buffa::impl_default_view_instance!(GetEquityHistorySeriesRequestView);
8705        ::buffa::impl_view_reborrow!(GetEquityHistorySeriesRequestView);
8706        /** Self-contained, `'static` owned view of a `GetEquityHistorySeriesRequest` message.
8707
8708 Wraps [`::buffa::OwnedView`]`<`[`GetEquityHistorySeriesRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
8709
8710 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetEquityHistorySeriesRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
8711        #[derive(Clone, Debug)]
8712        pub struct GetEquityHistorySeriesRequestOwnedView(
8713            ::buffa::OwnedView<GetEquityHistorySeriesRequestView<'static>>,
8714        );
8715        impl GetEquityHistorySeriesRequestOwnedView {
8716            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
8717            ///
8718            /// The view borrows directly from the buffer's data; the buffer is
8719            /// retained inside the returned handle.
8720            ///
8721            /// # Errors
8722            ///
8723            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
8724            /// protobuf data.
8725            pub fn decode(
8726                bytes: ::buffa::bytes::Bytes,
8727            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8728                ::core::result::Result::Ok(
8729                    GetEquityHistorySeriesRequestOwnedView(
8730                        ::buffa::OwnedView::decode(bytes)?,
8731                    ),
8732                )
8733            }
8734            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
8735            /// max message size).
8736            ///
8737            /// # Errors
8738            ///
8739            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
8740            /// exceeds the configured limits.
8741            pub fn decode_with_options(
8742                bytes: ::buffa::bytes::Bytes,
8743                opts: &::buffa::DecodeOptions,
8744            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8745                ::core::result::Result::Ok(
8746                    GetEquityHistorySeriesRequestOwnedView(
8747                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
8748                    ),
8749                )
8750            }
8751            /// Build from an owned message via an encode → decode round-trip.
8752            ///
8753            /// # Errors
8754            ///
8755            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
8756            /// somehow invalid (should not happen for well-formed messages).
8757            pub fn from_owned(
8758                msg: &super::super::GetEquityHistorySeriesRequest,
8759            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8760                ::core::result::Result::Ok(
8761                    GetEquityHistorySeriesRequestOwnedView(
8762                        ::buffa::OwnedView::from_owned(msg)?,
8763                    ),
8764                )
8765            }
8766            /// Borrow the full [`GetEquityHistorySeriesRequestView`] with its lifetime tied to `&self`.
8767            #[must_use]
8768            pub fn view(&self) -> &GetEquityHistorySeriesRequestView<'_> {
8769                self.0.reborrow()
8770            }
8771            /// Convert to the owned message type.
8772            ///
8773            /// # Errors
8774            ///
8775            /// Returns an error if re-materializing preserved unknown fields
8776            /// fails (e.g. the unknown-field limit is exceeded).
8777            pub fn to_owned_message(
8778                &self,
8779            ) -> ::core::result::Result<
8780                super::super::GetEquityHistorySeriesRequest,
8781                ::buffa::DecodeError,
8782            > {
8783                self.0.to_owned_message()
8784            }
8785            /// The underlying bytes buffer.
8786            #[must_use]
8787            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
8788                self.0.bytes()
8789            }
8790            /// Consume the handle, returning the underlying bytes buffer.
8791            #[must_use]
8792            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
8793                self.0.into_bytes()
8794            }
8795            /// Optional sub-account to scope equity to. If omitted, equity is returned for
8796            /// the authenticated root account derived from the JWT or API key.
8797            ///
8798            /// Field 1: `subaccount_id`
8799            #[must_use]
8800            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
8801                self.0.reborrow().subaccount_id
8802            }
8803            /// History window to return. When unset/UNSPECIFIED, defaults to 1D.
8804            ///
8805            /// Field 2: `range`
8806            #[must_use]
8807            pub fn range(&self) -> ::buffa::EnumValue<super::super::BalanceRange> {
8808                self.0.reborrow().range
8809            }
8810            /// Optional subset of account buckets.
8811            /// When empty, server returns both funding and trading.
8812            /// Only used when group_by = ACCOUNT.
8813            ///
8814            /// Field 4: `account_codes`
8815            #[must_use]
8816            pub fn account_codes(
8817                &self,
8818            ) -> &::buffa::RepeatedView<
8819                '_,
8820                ::buffa::EnumValue<super::super::super::super::v1::AccountCode>,
8821            > {
8822                &self.0.reborrow().account_codes
8823            }
8824            /// How to group the equity series. Defaults to ACCOUNT if unspecified.
8825            ///
8826            /// Field 5: `group_by`
8827            #[must_use]
8828            pub fn group_by(&self) -> ::buffa::EnumValue<super::super::EquityGroupBy> {
8829                self.0.reborrow().group_by
8830            }
8831        }
8832        impl ::core::convert::From<
8833            ::buffa::OwnedView<GetEquityHistorySeriesRequestView<'static>>,
8834        > for GetEquityHistorySeriesRequestOwnedView {
8835            fn from(
8836                inner: ::buffa::OwnedView<GetEquityHistorySeriesRequestView<'static>>,
8837            ) -> Self {
8838                GetEquityHistorySeriesRequestOwnedView(inner)
8839            }
8840        }
8841        impl ::core::convert::From<GetEquityHistorySeriesRequestOwnedView>
8842        for ::buffa::OwnedView<GetEquityHistorySeriesRequestView<'static>> {
8843            fn from(wrapper: GetEquityHistorySeriesRequestOwnedView) -> Self {
8844                wrapper.0
8845            }
8846        }
8847        impl ::core::convert::AsRef<
8848            ::buffa::OwnedView<GetEquityHistorySeriesRequestView<'static>>,
8849        > for GetEquityHistorySeriesRequestOwnedView {
8850            fn as_ref(
8851                &self,
8852            ) -> &::buffa::OwnedView<GetEquityHistorySeriesRequestView<'static>> {
8853                &self.0
8854            }
8855        }
8856        impl ::buffa::HasMessageView for super::super::GetEquityHistorySeriesRequest {
8857            type View<'a> = GetEquityHistorySeriesRequestView<'a>;
8858            type ViewHandle = GetEquityHistorySeriesRequestOwnedView;
8859        }
8860        impl ::serde::Serialize for GetEquityHistorySeriesRequestOwnedView {
8861            fn serialize<__S: ::serde::Serializer>(
8862                &self,
8863                __s: __S,
8864            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8865                ::serde::Serialize::serialize(&self.0, __s)
8866            }
8867        }
8868        /// Columnar equity series payload (scaled integers).
8869        /// REST renders decimal strings from these values.
8870        #[derive(Clone, Debug, Default)]
8871        pub struct EquitySeriesView<'a> {
8872            /// Equity in quote currency (USDT) scaled by 1e4 (4 decimals).
8873            /// Values align 1:1 with timestamps.
8874            ///
8875            /// Field 2: `equity_q`
8876            pub equity_q: ::buffa::RepeatedView<'a, i64>,
8877            pub grouping: ::core::option::Option<
8878                super::super::__buffa::view::oneof::equity_series::Grouping<'a>,
8879            >,
8880            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
8881        }
8882        impl<'a> ::buffa::MessageView<'a> for EquitySeriesView<'a> {
8883            type Owned = super::super::EquitySeries;
8884            fn decode_view(
8885                buf: &'a [u8],
8886            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8887                let __limit = ::core::cell::Cell::new(
8888                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
8889                );
8890                <Self as ::buffa::MessageView>::decode_view_ctx(
8891                    buf,
8892                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
8893                )
8894            }
8895            fn decode_view_with_ctx(
8896                buf: &'a [u8],
8897                ctx: ::buffa::DecodeContext<'_>,
8898            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8899                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
8900            }
8901            fn merge_view_field(
8902                &mut self,
8903                tag: ::buffa::encoding::Tag,
8904                cur: &'a [u8],
8905                before_tag: &'a [u8],
8906                ctx: ::buffa::DecodeContext<'_>,
8907            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
8908                let _ = ctx;
8909                #[allow(unused_variables)]
8910                let view = self;
8911                let mut cur = cur;
8912                match tag.field_number() {
8913                    2u32 => {
8914                        if tag.wire_type()
8915                            == ::buffa::encoding::WireType::LengthDelimited
8916                        {
8917                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
8918                            view.equity_q
8919                                .reserve(::buffa::encoding::count_varints(payload));
8920                            let mut pcur: &[u8] = payload;
8921                            while !pcur.is_empty() {
8922                                view.equity_q
8923                                    .push(::buffa::types::decode_sint64(&mut pcur)?);
8924                            }
8925                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
8926                        {
8927                            view.equity_q.push(::buffa::types::decode_sint64(&mut cur)?);
8928                        } else {
8929                            return Err(
8930                                ::buffa::encoding::wire_type_mismatch(
8931                                    tag,
8932                                    ::buffa::encoding::WireType::LengthDelimited,
8933                                ),
8934                            );
8935                        }
8936                    }
8937                    1u32 => {
8938                        ::buffa::encoding::check_wire_type(
8939                            tag,
8940                            ::buffa::encoding::WireType::LengthDelimited,
8941                        )?;
8942                        let __sub_ctx = ctx.descend()?;
8943                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
8944                        if let Some(
8945                            super::super::__buffa::view::oneof::equity_series::Grouping::Account(
8946                                ref mut existing,
8947                            ),
8948                        ) = view.grouping
8949                        {
8950                            ::buffa::MessageView::merge_into_view(
8951                                &mut **existing,
8952                                sub,
8953                                __sub_ctx,
8954                            )?;
8955                        } else {
8956                            view.grouping = Some(
8957                                super::super::__buffa::view::oneof::equity_series::Grouping::Account(
8958                                    ::buffa::alloc::boxed::Box::new(
8959                                        <super::super::__buffa::view::AccountGroupingView as ::buffa::MessageView>::decode_view_ctx(
8960                                            sub,
8961                                            __sub_ctx,
8962                                        )?,
8963                                    ),
8964                                ),
8965                            );
8966                        }
8967                    }
8968                    3u32 => {
8969                        ::buffa::encoding::check_wire_type(
8970                            tag,
8971                            ::buffa::encoding::WireType::LengthDelimited,
8972                        )?;
8973                        let __sub_ctx = ctx.descend()?;
8974                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
8975                        if let Some(
8976                            super::super::__buffa::view::oneof::equity_series::Grouping::Asset(
8977                                ref mut existing,
8978                            ),
8979                        ) = view.grouping
8980                        {
8981                            ::buffa::MessageView::merge_into_view(
8982                                &mut **existing,
8983                                sub,
8984                                __sub_ctx,
8985                            )?;
8986                        } else {
8987                            view.grouping = Some(
8988                                super::super::__buffa::view::oneof::equity_series::Grouping::Asset(
8989                                    ::buffa::alloc::boxed::Box::new(
8990                                        <super::super::__buffa::view::AssetGroupingView as ::buffa::MessageView>::decode_view_ctx(
8991                                            sub,
8992                                            __sub_ctx,
8993                                        )?,
8994                                    ),
8995                                ),
8996                            );
8997                        }
8998                    }
8999                    _ => {
9000                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
9001                        let span_len = before_tag.len() - cur.len();
9002                        view.__buffa_unknown_fields
9003                            .push_record(before_tag, span_len, ctx)?;
9004                    }
9005                }
9006                ::core::result::Result::Ok(cur)
9007            }
9008            fn to_owned_message(
9009                &self,
9010            ) -> ::core::result::Result<
9011                super::super::EquitySeries,
9012                ::buffa::DecodeError,
9013            > {
9014                self.to_owned_from_source(None)
9015            }
9016            #[allow(clippy::useless_conversion, clippy::needless_update)]
9017            fn to_owned_from_source(
9018                &self,
9019                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
9020            ) -> ::core::result::Result<
9021                super::super::EquitySeries,
9022                ::buffa::DecodeError,
9023            > {
9024                #[allow(unused_imports)]
9025                use ::buffa::alloc::string::ToString as _;
9026                let _ = __buffa_src;
9027                ::core::result::Result::Ok(super::super::EquitySeries {
9028                    equity_q: self.equity_q.to_vec(),
9029                    grouping: match self.grouping.as_ref() {
9030                        ::core::option::Option::Some(v) => {
9031                            ::core::option::Option::Some(
9032                                match v {
9033                                    super::super::__buffa::view::oneof::equity_series::Grouping::Account(
9034                                        v,
9035                                    ) => {
9036                                        super::super::__buffa::oneof::equity_series::Grouping::Account(
9037                                            ::buffa::alloc::boxed::Box::new(
9038                                                v.to_owned_from_source(__buffa_src)?,
9039                                            ),
9040                                        )
9041                                    }
9042                                    super::super::__buffa::view::oneof::equity_series::Grouping::Asset(
9043                                        v,
9044                                    ) => {
9045                                        super::super::__buffa::oneof::equity_series::Grouping::Asset(
9046                                            ::buffa::alloc::boxed::Box::new(
9047                                                v.to_owned_from_source(__buffa_src)?,
9048                                            ),
9049                                        )
9050                                    }
9051                                },
9052                            )
9053                        }
9054                        ::core::option::Option::None => ::core::option::Option::None,
9055                    },
9056                    __buffa_unknown_fields: self
9057                        .__buffa_unknown_fields
9058                        .to_owned()?
9059                        .into(),
9060                    ..::core::default::Default::default()
9061                })
9062            }
9063        }
9064        impl<'a> ::buffa::ViewEncode<'a> for EquitySeriesView<'a> {
9065            #[allow(clippy::needless_borrow, clippy::let_and_return)]
9066            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
9067                #[allow(unused_imports)]
9068                use ::buffa::Enumeration as _;
9069                let mut size = 0u32;
9070                if let ::core::option::Option::Some(ref v) = self.grouping {
9071                    match v {
9072                        super::super::__buffa::view::oneof::equity_series::Grouping::Account(
9073                            x,
9074                        ) => {
9075                            let __slot = __cache.reserve();
9076                            let inner = x.compute_size(__cache);
9077                            __cache.set(__slot, inner);
9078                            size
9079                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9080                                    + inner;
9081                        }
9082                        super::super::__buffa::view::oneof::equity_series::Grouping::Asset(
9083                            x,
9084                        ) => {
9085                            let __slot = __cache.reserve();
9086                            let inner = x.compute_size(__cache);
9087                            __cache.set(__slot, inner);
9088                            size
9089                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9090                                    + inner;
9091                        }
9092                    }
9093                }
9094                if !self.equity_q.is_empty() {
9095                    let payload: u32 = self
9096                        .equity_q
9097                        .iter()
9098                        .map(|&v| ::buffa::types::sint64_encoded_len(v) as u32)
9099                        .sum::<u32>();
9100                    size
9101                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
9102                            + payload;
9103                }
9104                size += self.__buffa_unknown_fields.encoded_len() as u32;
9105                size
9106            }
9107            #[allow(clippy::needless_borrow)]
9108            fn write_to(
9109                &self,
9110                __cache: &mut ::buffa::SizeCache,
9111                buf: &mut impl ::buffa::bytes::BufMut,
9112            ) {
9113                #[allow(unused_imports)]
9114                use ::buffa::Enumeration as _;
9115                if let ::core::option::Option::Some(ref v) = self.grouping {
9116                    match v {
9117                        super::super::__buffa::view::oneof::equity_series::Grouping::Account(
9118                            x,
9119                        ) => {
9120                            ::buffa::types::put_len_delimited_header(
9121                                1u32,
9122                                __cache.consume_next(),
9123                                buf,
9124                            );
9125                            x.write_to(__cache, buf);
9126                        }
9127                        super::super::__buffa::view::oneof::equity_series::Grouping::Asset(
9128                            x,
9129                        ) => {
9130                            ::buffa::types::put_len_delimited_header(
9131                                3u32,
9132                                __cache.consume_next(),
9133                                buf,
9134                            );
9135                            x.write_to(__cache, buf);
9136                        }
9137                    }
9138                }
9139                if !self.equity_q.is_empty() {
9140                    let payload: u32 = self
9141                        .equity_q
9142                        .iter()
9143                        .map(|&v| ::buffa::types::sint64_encoded_len(v) as u32)
9144                        .sum::<u32>();
9145                    ::buffa::types::put_len_delimited_header(2u32, payload, buf);
9146                    for &v in &self.equity_q {
9147                        ::buffa::types::encode_sint64(v, buf);
9148                    }
9149                }
9150                self.__buffa_unknown_fields.write_to(buf);
9151            }
9152        }
9153        /// Serializes this view as protobuf JSON.
9154        ///
9155        /// Implicit-presence fields with default values are omitted, `required`
9156        /// fields are always emitted, explicit-presence (`optional`) fields are
9157        /// emitted only when set, bytes fields are base64-encoded, and enum
9158        /// values are their proto name strings.
9159        ///
9160        /// This impl uses `serialize_map(None)` because the number of emitted
9161        /// fields depends on default-omission rules; serializers that require
9162        /// known map lengths (e.g. `bincode`) will return a runtime error.
9163        /// Use the owned message type for those formats.
9164        impl<'__a> ::serde::Serialize for EquitySeriesView<'__a> {
9165            fn serialize<__S: ::serde::Serializer>(
9166                &self,
9167                __s: __S,
9168            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9169                use ::serde::ser::SerializeMap as _;
9170                let mut __map = __s.serialize_map(::core::option::Option::None)?;
9171                if !self.equity_q.is_empty() {
9172                    __map
9173                        .serialize_entry(
9174                            "equityQ",
9175                            &::buffa::json_helpers::RepeatedJson(&self.equity_q),
9176                        )?;
9177                }
9178                if let ::core::option::Option::Some(ref __ov) = self.grouping {
9179                    match __ov {
9180                        super::super::__buffa::view::oneof::equity_series::Grouping::Account(
9181                            v,
9182                        ) => {
9183                            __map.serialize_entry("account", v)?;
9184                        }
9185                        super::super::__buffa::view::oneof::equity_series::Grouping::Asset(
9186                            v,
9187                        ) => {
9188                            __map.serialize_entry("asset", v)?;
9189                        }
9190                    }
9191                }
9192                __map.end()
9193            }
9194        }
9195        impl<'a> ::buffa::MessageName for EquitySeriesView<'a> {
9196            const PACKAGE: &'static str = "ledger.read.v1";
9197            const NAME: &'static str = "EquitySeries";
9198            const FULL_NAME: &'static str = "ledger.read.v1.EquitySeries";
9199            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.EquitySeries";
9200        }
9201        ::buffa::impl_default_view_instance!(EquitySeriesView);
9202        ::buffa::impl_view_reborrow!(EquitySeriesView);
9203        /** Self-contained, `'static` owned view of a `EquitySeries` message.
9204
9205 Wraps [`::buffa::OwnedView`]`<`[`EquitySeriesView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
9206
9207 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`EquitySeriesView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
9208        #[derive(Clone, Debug)]
9209        pub struct EquitySeriesOwnedView(::buffa::OwnedView<EquitySeriesView<'static>>);
9210        impl EquitySeriesOwnedView {
9211            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
9212            ///
9213            /// The view borrows directly from the buffer's data; the buffer is
9214            /// retained inside the returned handle.
9215            ///
9216            /// # Errors
9217            ///
9218            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
9219            /// protobuf data.
9220            pub fn decode(
9221                bytes: ::buffa::bytes::Bytes,
9222            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9223                ::core::result::Result::Ok(
9224                    EquitySeriesOwnedView(::buffa::OwnedView::decode(bytes)?),
9225                )
9226            }
9227            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
9228            /// max message size).
9229            ///
9230            /// # Errors
9231            ///
9232            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
9233            /// exceeds the configured limits.
9234            pub fn decode_with_options(
9235                bytes: ::buffa::bytes::Bytes,
9236                opts: &::buffa::DecodeOptions,
9237            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9238                ::core::result::Result::Ok(
9239                    EquitySeriesOwnedView(
9240                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
9241                    ),
9242                )
9243            }
9244            /// Build from an owned message via an encode → decode round-trip.
9245            ///
9246            /// # Errors
9247            ///
9248            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
9249            /// somehow invalid (should not happen for well-formed messages).
9250            pub fn from_owned(
9251                msg: &super::super::EquitySeries,
9252            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9253                ::core::result::Result::Ok(
9254                    EquitySeriesOwnedView(::buffa::OwnedView::from_owned(msg)?),
9255                )
9256            }
9257            /// Borrow the full [`EquitySeriesView`] with its lifetime tied to `&self`.
9258            #[must_use]
9259            pub fn view(&self) -> &EquitySeriesView<'_> {
9260                self.0.reborrow()
9261            }
9262            /// Convert to the owned message type.
9263            ///
9264            /// # Errors
9265            ///
9266            /// Returns an error if re-materializing preserved unknown fields
9267            /// fails (e.g. the unknown-field limit is exceeded).
9268            pub fn to_owned_message(
9269                &self,
9270            ) -> ::core::result::Result<
9271                super::super::EquitySeries,
9272                ::buffa::DecodeError,
9273            > {
9274                self.0.to_owned_message()
9275            }
9276            /// The underlying bytes buffer.
9277            #[must_use]
9278            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
9279                self.0.bytes()
9280            }
9281            /// Consume the handle, returning the underlying bytes buffer.
9282            #[must_use]
9283            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
9284                self.0.into_bytes()
9285            }
9286            /// Equity in quote currency (USDT) scaled by 1e4 (4 decimals).
9287            /// Values align 1:1 with timestamps.
9288            ///
9289            /// Field 2: `equity_q`
9290            #[must_use]
9291            pub fn equity_q(&self) -> &::buffa::RepeatedView<'_, i64> {
9292                &self.0.reborrow().equity_q
9293            }
9294            /// Oneof `grouping`.
9295            #[must_use]
9296            pub fn grouping(
9297                &self,
9298            ) -> ::core::option::Option<
9299                &super::super::__buffa::view::oneof::equity_series::Grouping<'_>,
9300            > {
9301                self.0.reborrow().grouping.as_ref()
9302            }
9303        }
9304        impl ::core::convert::From<::buffa::OwnedView<EquitySeriesView<'static>>>
9305        for EquitySeriesOwnedView {
9306            fn from(inner: ::buffa::OwnedView<EquitySeriesView<'static>>) -> Self {
9307                EquitySeriesOwnedView(inner)
9308            }
9309        }
9310        impl ::core::convert::From<EquitySeriesOwnedView>
9311        for ::buffa::OwnedView<EquitySeriesView<'static>> {
9312            fn from(wrapper: EquitySeriesOwnedView) -> Self {
9313                wrapper.0
9314            }
9315        }
9316        impl ::core::convert::AsRef<::buffa::OwnedView<EquitySeriesView<'static>>>
9317        for EquitySeriesOwnedView {
9318            fn as_ref(&self) -> &::buffa::OwnedView<EquitySeriesView<'static>> {
9319                &self.0
9320            }
9321        }
9322        impl ::buffa::HasMessageView for super::super::EquitySeries {
9323            type View<'a> = EquitySeriesView<'a>;
9324            type ViewHandle = EquitySeriesOwnedView;
9325        }
9326        impl ::serde::Serialize for EquitySeriesOwnedView {
9327            fn serialize<__S: ::serde::Serializer>(
9328                &self,
9329                __s: __S,
9330            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9331                ::serde::Serialize::serialize(&self.0, __s)
9332            }
9333        }
9334        /// GetEquityHistorySeriesResponse returns aligned equity chart series.
9335        #[derive(Clone, Debug, Default)]
9336        pub struct GetEquityHistorySeriesResponseView<'a> {
9337            /// Resolved history window.
9338            ///
9339            /// Field 1: `range`
9340            pub range: ::buffa::EnumValue<super::super::BalanceRange>,
9341            /// Sampling interval between points, such as "5m" or "1h".
9342            ///
9343            /// Field 2: `bucket`
9344            pub bucket: &'a str,
9345            /// First point timestamp in seconds since epoch (UTC).
9346            ///
9347            /// Field 3: `start_ts_sec`
9348            pub start_ts_sec: u32,
9349            /// Last point timestamp in seconds since epoch (UTC).
9350            ///
9351            /// Field 4: `end_ts_sec`
9352            pub end_ts_sec: u32,
9353            /// Human-readable quote asset symbol (always "USDT").
9354            ///
9355            /// Field 6: `quote_asset`
9356            pub quote_asset: &'a str,
9357            /// Number of aligned points in each returned series.
9358            ///
9359            /// Field 7: `points`
9360            pub points: u32,
9361            /// Equity series ordered by grouping identifier ascending.
9362            ///
9363            /// Field 8: `series`
9364            pub series: ::buffa::RepeatedView<
9365                'a,
9366                super::super::__buffa::view::EquitySeriesView<'a>,
9367            >,
9368            /// BTC-USDT close price at each timestamp, scaled by 1e6 (same as price_ticks).
9369            /// Enables client-side conversion to BTC denomination without refetch.
9370            ///
9371            /// Field 10: `btc_prices_q`
9372            pub btc_prices_q: ::buffa::RepeatedView<'a, i64>,
9373            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
9374        }
9375        impl<'a> ::buffa::MessageView<'a> for GetEquityHistorySeriesResponseView<'a> {
9376            type Owned = super::super::GetEquityHistorySeriesResponse;
9377            fn decode_view(
9378                buf: &'a [u8],
9379            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9380                let __limit = ::core::cell::Cell::new(
9381                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
9382                );
9383                <Self as ::buffa::MessageView>::decode_view_ctx(
9384                    buf,
9385                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
9386                )
9387            }
9388            fn decode_view_with_ctx(
9389                buf: &'a [u8],
9390                ctx: ::buffa::DecodeContext<'_>,
9391            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9392                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
9393            }
9394            fn merge_view_field(
9395                &mut self,
9396                tag: ::buffa::encoding::Tag,
9397                cur: &'a [u8],
9398                before_tag: &'a [u8],
9399                ctx: ::buffa::DecodeContext<'_>,
9400            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
9401                let _ = ctx;
9402                #[allow(unused_variables)]
9403                let view = self;
9404                let mut cur = cur;
9405                match tag.field_number() {
9406                    1u32 => {
9407                        ::buffa::encoding::check_wire_type(
9408                            tag,
9409                            ::buffa::encoding::WireType::Varint,
9410                        )?;
9411                        view.range = ::buffa::EnumValue::from(
9412                            ::buffa::types::decode_int32(&mut cur)?,
9413                        );
9414                    }
9415                    2u32 => {
9416                        ::buffa::encoding::check_wire_type(
9417                            tag,
9418                            ::buffa::encoding::WireType::LengthDelimited,
9419                        )?;
9420                        view.bucket = ::buffa::types::borrow_str(&mut cur)?;
9421                    }
9422                    3u32 => {
9423                        ::buffa::encoding::check_wire_type(
9424                            tag,
9425                            ::buffa::encoding::WireType::Fixed32,
9426                        )?;
9427                        view.start_ts_sec = ::buffa::types::decode_fixed32(&mut cur)?;
9428                    }
9429                    4u32 => {
9430                        ::buffa::encoding::check_wire_type(
9431                            tag,
9432                            ::buffa::encoding::WireType::Fixed32,
9433                        )?;
9434                        view.end_ts_sec = ::buffa::types::decode_fixed32(&mut cur)?;
9435                    }
9436                    6u32 => {
9437                        ::buffa::encoding::check_wire_type(
9438                            tag,
9439                            ::buffa::encoding::WireType::LengthDelimited,
9440                        )?;
9441                        view.quote_asset = ::buffa::types::borrow_str(&mut cur)?;
9442                    }
9443                    7u32 => {
9444                        ::buffa::encoding::check_wire_type(
9445                            tag,
9446                            ::buffa::encoding::WireType::Varint,
9447                        )?;
9448                        view.points = ::buffa::types::decode_uint32(&mut cur)?;
9449                    }
9450                    8u32 => {
9451                        ::buffa::encoding::check_wire_type(
9452                            tag,
9453                            ::buffa::encoding::WireType::LengthDelimited,
9454                        )?;
9455                        let __sub_ctx = ctx.descend()?;
9456                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
9457                        view.series
9458                            .push(
9459                                <super::super::__buffa::view::EquitySeriesView as ::buffa::MessageView>::decode_view_ctx(
9460                                    sub,
9461                                    __sub_ctx,
9462                                )?,
9463                            );
9464                    }
9465                    10u32 => {
9466                        if tag.wire_type()
9467                            == ::buffa::encoding::WireType::LengthDelimited
9468                        {
9469                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
9470                            view.btc_prices_q
9471                                .reserve(::buffa::encoding::count_varints(payload));
9472                            let mut pcur: &[u8] = payload;
9473                            while !pcur.is_empty() {
9474                                view.btc_prices_q
9475                                    .push(::buffa::types::decode_int64(&mut pcur)?);
9476                            }
9477                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
9478                        {
9479                            view.btc_prices_q
9480                                .push(::buffa::types::decode_int64(&mut cur)?);
9481                        } else {
9482                            return Err(
9483                                ::buffa::encoding::wire_type_mismatch(
9484                                    tag,
9485                                    ::buffa::encoding::WireType::LengthDelimited,
9486                                ),
9487                            );
9488                        }
9489                    }
9490                    _ => {
9491                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
9492                        let span_len = before_tag.len() - cur.len();
9493                        view.__buffa_unknown_fields
9494                            .push_record(before_tag, span_len, ctx)?;
9495                    }
9496                }
9497                ::core::result::Result::Ok(cur)
9498            }
9499            fn to_owned_message(
9500                &self,
9501            ) -> ::core::result::Result<
9502                super::super::GetEquityHistorySeriesResponse,
9503                ::buffa::DecodeError,
9504            > {
9505                self.to_owned_from_source(None)
9506            }
9507            #[allow(clippy::useless_conversion, clippy::needless_update)]
9508            fn to_owned_from_source(
9509                &self,
9510                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
9511            ) -> ::core::result::Result<
9512                super::super::GetEquityHistorySeriesResponse,
9513                ::buffa::DecodeError,
9514            > {
9515                #[allow(unused_imports)]
9516                use ::buffa::alloc::string::ToString as _;
9517                let _ = __buffa_src;
9518                ::core::result::Result::Ok(super::super::GetEquityHistorySeriesResponse {
9519                    range: self.range,
9520                    bucket: self.bucket.to_string(),
9521                    start_ts_sec: self.start_ts_sec,
9522                    end_ts_sec: self.end_ts_sec,
9523                    quote_asset: self.quote_asset.to_string(),
9524                    points: self.points,
9525                    series: self
9526                        .series
9527                        .iter()
9528                        .map(|v| v.to_owned_from_source(__buffa_src))
9529                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
9530                    btc_prices_q: self.btc_prices_q.to_vec(),
9531                    __buffa_unknown_fields: self
9532                        .__buffa_unknown_fields
9533                        .to_owned()?
9534                        .into(),
9535                    ..::core::default::Default::default()
9536                })
9537            }
9538        }
9539        impl<'a> ::buffa::ViewEncode<'a> for GetEquityHistorySeriesResponseView<'a> {
9540            #[allow(clippy::needless_borrow, clippy::let_and_return)]
9541            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
9542                #[allow(unused_imports)]
9543                use ::buffa::Enumeration as _;
9544                let mut size = 0u32;
9545                {
9546                    let val = self.range.to_i32();
9547                    if val != 0 {
9548                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
9549                    }
9550                }
9551                if !self.bucket.is_empty() {
9552                    size
9553                        += 1u32
9554                            + ::buffa::types::string_encoded_len(&self.bucket) as u32;
9555                }
9556                if self.start_ts_sec != 0u32 {
9557                    size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
9558                }
9559                if self.end_ts_sec != 0u32 {
9560                    size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
9561                }
9562                if !self.quote_asset.is_empty() {
9563                    size
9564                        += 1u32
9565                            + ::buffa::types::string_encoded_len(&self.quote_asset)
9566                                as u32;
9567                }
9568                if self.points != 0u32 {
9569                    size
9570                        += 1u32 + ::buffa::types::uint32_encoded_len(self.points) as u32;
9571                }
9572                for v in &self.series {
9573                    let __slot = __cache.reserve();
9574                    let inner_size = v.compute_size(__cache);
9575                    __cache.set(__slot, inner_size);
9576                    size
9577                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9578                            + inner_size;
9579                }
9580                if !self.btc_prices_q.is_empty() {
9581                    let payload: u32 = self
9582                        .btc_prices_q
9583                        .iter()
9584                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9585                        .sum::<u32>();
9586                    size
9587                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
9588                            + payload;
9589                }
9590                size += self.__buffa_unknown_fields.encoded_len() as u32;
9591                size
9592            }
9593            #[allow(clippy::needless_borrow)]
9594            fn write_to(
9595                &self,
9596                __cache: &mut ::buffa::SizeCache,
9597                buf: &mut impl ::buffa::bytes::BufMut,
9598            ) {
9599                #[allow(unused_imports)]
9600                use ::buffa::Enumeration as _;
9601                {
9602                    let val = self.range.to_i32();
9603                    if val != 0 {
9604                        ::buffa::types::put_int32_field(1u32, val, buf);
9605                    }
9606                }
9607                if !self.bucket.is_empty() {
9608                    ::buffa::types::put_string_field(2u32, &self.bucket, buf);
9609                }
9610                if self.start_ts_sec != 0u32 {
9611                    ::buffa::types::put_fixed32_field(3u32, self.start_ts_sec, buf);
9612                }
9613                if self.end_ts_sec != 0u32 {
9614                    ::buffa::types::put_fixed32_field(4u32, self.end_ts_sec, buf);
9615                }
9616                if !self.quote_asset.is_empty() {
9617                    ::buffa::types::put_string_field(6u32, &self.quote_asset, buf);
9618                }
9619                if self.points != 0u32 {
9620                    ::buffa::types::put_uint32_field(7u32, self.points, buf);
9621                }
9622                for v in &self.series {
9623                    ::buffa::types::put_len_delimited_header(
9624                        8u32,
9625                        __cache.consume_next(),
9626                        buf,
9627                    );
9628                    v.write_to(__cache, buf);
9629                }
9630                if !self.btc_prices_q.is_empty() {
9631                    let payload: u32 = self
9632                        .btc_prices_q
9633                        .iter()
9634                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9635                        .sum::<u32>();
9636                    ::buffa::types::put_len_delimited_header(10u32, payload, buf);
9637                    for &v in &self.btc_prices_q {
9638                        ::buffa::types::encode_int64(v, buf);
9639                    }
9640                }
9641                self.__buffa_unknown_fields.write_to(buf);
9642            }
9643        }
9644        /// Serializes this view as protobuf JSON.
9645        ///
9646        /// Implicit-presence fields with default values are omitted, `required`
9647        /// fields are always emitted, explicit-presence (`optional`) fields are
9648        /// emitted only when set, bytes fields are base64-encoded, and enum
9649        /// values are their proto name strings.
9650        ///
9651        /// This impl uses `serialize_map(None)` because the number of emitted
9652        /// fields depends on default-omission rules; serializers that require
9653        /// known map lengths (e.g. `bincode`) will return a runtime error.
9654        /// Use the owned message type for those formats.
9655        impl<'__a> ::serde::Serialize for GetEquityHistorySeriesResponseView<'__a> {
9656            fn serialize<__S: ::serde::Serializer>(
9657                &self,
9658                __s: __S,
9659            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9660                use ::serde::ser::SerializeMap as _;
9661                let mut __map = __s.serialize_map(::core::option::Option::None)?;
9662                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.range) {
9663                    __map.serialize_entry("range", &self.range)?;
9664                }
9665                if !::buffa::json_helpers::skip_if::is_empty_str(self.bucket) {
9666                    __map.serialize_entry("bucket", self.bucket)?;
9667                }
9668                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.start_ts_sec) {
9669                    __map
9670                        .serialize_entry(
9671                            "startTsSec",
9672                            &::buffa::json_helpers::ProtoJson(&self.start_ts_sec),
9673                        )?;
9674                }
9675                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.end_ts_sec) {
9676                    __map
9677                        .serialize_entry(
9678                            "endTsSec",
9679                            &::buffa::json_helpers::ProtoJson(&self.end_ts_sec),
9680                        )?;
9681                }
9682                if !::buffa::json_helpers::skip_if::is_empty_str(self.quote_asset) {
9683                    __map.serialize_entry("quoteAsset", self.quote_asset)?;
9684                }
9685                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.points) {
9686                    __map
9687                        .serialize_entry(
9688                            "points",
9689                            &::buffa::json_helpers::ProtoJson(&self.points),
9690                        )?;
9691                }
9692                if !self.series.is_empty() {
9693                    __map.serialize_entry("series", &*self.series)?;
9694                }
9695                if !self.btc_prices_q.is_empty() {
9696                    __map
9697                        .serialize_entry(
9698                            "btcPricesQ",
9699                            &::buffa::json_helpers::RepeatedJson(&self.btc_prices_q),
9700                        )?;
9701                }
9702                __map.end()
9703            }
9704        }
9705        impl<'a> ::buffa::MessageName for GetEquityHistorySeriesResponseView<'a> {
9706            const PACKAGE: &'static str = "ledger.read.v1";
9707            const NAME: &'static str = "GetEquityHistorySeriesResponse";
9708            const FULL_NAME: &'static str = "ledger.read.v1.GetEquityHistorySeriesResponse";
9709            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.GetEquityHistorySeriesResponse";
9710        }
9711        ::buffa::impl_default_view_instance!(GetEquityHistorySeriesResponseView);
9712        ::buffa::impl_view_reborrow!(GetEquityHistorySeriesResponseView);
9713        /** Self-contained, `'static` owned view of a `GetEquityHistorySeriesResponse` message.
9714
9715 Wraps [`::buffa::OwnedView`]`<`[`GetEquityHistorySeriesResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
9716
9717 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetEquityHistorySeriesResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
9718        #[derive(Clone, Debug)]
9719        pub struct GetEquityHistorySeriesResponseOwnedView(
9720            ::buffa::OwnedView<GetEquityHistorySeriesResponseView<'static>>,
9721        );
9722        impl GetEquityHistorySeriesResponseOwnedView {
9723            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
9724            ///
9725            /// The view borrows directly from the buffer's data; the buffer is
9726            /// retained inside the returned handle.
9727            ///
9728            /// # Errors
9729            ///
9730            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
9731            /// protobuf data.
9732            pub fn decode(
9733                bytes: ::buffa::bytes::Bytes,
9734            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9735                ::core::result::Result::Ok(
9736                    GetEquityHistorySeriesResponseOwnedView(
9737                        ::buffa::OwnedView::decode(bytes)?,
9738                    ),
9739                )
9740            }
9741            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
9742            /// max message size).
9743            ///
9744            /// # Errors
9745            ///
9746            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
9747            /// exceeds the configured limits.
9748            pub fn decode_with_options(
9749                bytes: ::buffa::bytes::Bytes,
9750                opts: &::buffa::DecodeOptions,
9751            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9752                ::core::result::Result::Ok(
9753                    GetEquityHistorySeriesResponseOwnedView(
9754                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
9755                    ),
9756                )
9757            }
9758            /// Build from an owned message via an encode → decode round-trip.
9759            ///
9760            /// # Errors
9761            ///
9762            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
9763            /// somehow invalid (should not happen for well-formed messages).
9764            pub fn from_owned(
9765                msg: &super::super::GetEquityHistorySeriesResponse,
9766            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9767                ::core::result::Result::Ok(
9768                    GetEquityHistorySeriesResponseOwnedView(
9769                        ::buffa::OwnedView::from_owned(msg)?,
9770                    ),
9771                )
9772            }
9773            /// Borrow the full [`GetEquityHistorySeriesResponseView`] with its lifetime tied to `&self`.
9774            #[must_use]
9775            pub fn view(&self) -> &GetEquityHistorySeriesResponseView<'_> {
9776                self.0.reborrow()
9777            }
9778            /// Convert to the owned message type.
9779            ///
9780            /// # Errors
9781            ///
9782            /// Returns an error if re-materializing preserved unknown fields
9783            /// fails (e.g. the unknown-field limit is exceeded).
9784            pub fn to_owned_message(
9785                &self,
9786            ) -> ::core::result::Result<
9787                super::super::GetEquityHistorySeriesResponse,
9788                ::buffa::DecodeError,
9789            > {
9790                self.0.to_owned_message()
9791            }
9792            /// The underlying bytes buffer.
9793            #[must_use]
9794            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
9795                self.0.bytes()
9796            }
9797            /// Consume the handle, returning the underlying bytes buffer.
9798            #[must_use]
9799            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
9800                self.0.into_bytes()
9801            }
9802            /// Resolved history window.
9803            ///
9804            /// Field 1: `range`
9805            #[must_use]
9806            pub fn range(&self) -> ::buffa::EnumValue<super::super::BalanceRange> {
9807                self.0.reborrow().range
9808            }
9809            /// Sampling interval between points, such as "5m" or "1h".
9810            ///
9811            /// Field 2: `bucket`
9812            #[must_use]
9813            pub fn bucket(&self) -> &'_ str {
9814                self.0.reborrow().bucket
9815            }
9816            /// First point timestamp in seconds since epoch (UTC).
9817            ///
9818            /// Field 3: `start_ts_sec`
9819            #[must_use]
9820            pub fn start_ts_sec(&self) -> u32 {
9821                self.0.reborrow().start_ts_sec
9822            }
9823            /// Last point timestamp in seconds since epoch (UTC).
9824            ///
9825            /// Field 4: `end_ts_sec`
9826            #[must_use]
9827            pub fn end_ts_sec(&self) -> u32 {
9828                self.0.reborrow().end_ts_sec
9829            }
9830            /// Human-readable quote asset symbol (always "USDT").
9831            ///
9832            /// Field 6: `quote_asset`
9833            #[must_use]
9834            pub fn quote_asset(&self) -> &'_ str {
9835                self.0.reborrow().quote_asset
9836            }
9837            /// Number of aligned points in each returned series.
9838            ///
9839            /// Field 7: `points`
9840            #[must_use]
9841            pub fn points(&self) -> u32 {
9842                self.0.reborrow().points
9843            }
9844            /// Equity series ordered by grouping identifier ascending.
9845            ///
9846            /// Field 8: `series`
9847            #[must_use]
9848            pub fn series(
9849                &self,
9850            ) -> &::buffa::RepeatedView<
9851                '_,
9852                super::super::__buffa::view::EquitySeriesView<'_>,
9853            > {
9854                &self.0.reborrow().series
9855            }
9856            /// BTC-USDT close price at each timestamp, scaled by 1e6 (same as price_ticks).
9857            /// Enables client-side conversion to BTC denomination without refetch.
9858            ///
9859            /// Field 10: `btc_prices_q`
9860            #[must_use]
9861            pub fn btc_prices_q(&self) -> &::buffa::RepeatedView<'_, i64> {
9862                &self.0.reborrow().btc_prices_q
9863            }
9864        }
9865        impl ::core::convert::From<
9866            ::buffa::OwnedView<GetEquityHistorySeriesResponseView<'static>>,
9867        > for GetEquityHistorySeriesResponseOwnedView {
9868            fn from(
9869                inner: ::buffa::OwnedView<GetEquityHistorySeriesResponseView<'static>>,
9870            ) -> Self {
9871                GetEquityHistorySeriesResponseOwnedView(inner)
9872            }
9873        }
9874        impl ::core::convert::From<GetEquityHistorySeriesResponseOwnedView>
9875        for ::buffa::OwnedView<GetEquityHistorySeriesResponseView<'static>> {
9876            fn from(wrapper: GetEquityHistorySeriesResponseOwnedView) -> Self {
9877                wrapper.0
9878            }
9879        }
9880        impl ::core::convert::AsRef<
9881            ::buffa::OwnedView<GetEquityHistorySeriesResponseView<'static>>,
9882        > for GetEquityHistorySeriesResponseOwnedView {
9883            fn as_ref(
9884                &self,
9885            ) -> &::buffa::OwnedView<GetEquityHistorySeriesResponseView<'static>> {
9886                &self.0
9887            }
9888        }
9889        impl ::buffa::HasMessageView for super::super::GetEquityHistorySeriesResponse {
9890            type View<'a> = GetEquityHistorySeriesResponseView<'a>;
9891            type ViewHandle = GetEquityHistorySeriesResponseOwnedView;
9892        }
9893        impl ::serde::Serialize for GetEquityHistorySeriesResponseOwnedView {
9894            fn serialize<__S: ::serde::Serializer>(
9895                &self,
9896                __s: __S,
9897            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9898                ::serde::Serialize::serialize(&self.0, __s)
9899            }
9900        }
9901        #[derive(Clone, Debug, Default)]
9902        pub struct ListTransfersRequestView<'a> {
9903            /// Optional sub-account to scope transfers to. If omitted, transfers are
9904            /// listed for the authenticated root account derived from the JWT or API key.
9905            ///
9906            /// Field 1: `subaccount_id`
9907            pub subaccount_id: ::core::option::Option<u64>,
9908            /// Maximum number of transfer rows to return. Defaults to 100 when omitted;
9909            /// maximum is 1000.
9910            ///
9911            /// Field 2: `limit`
9912            pub limit: u32,
9913            /// Sort direction. When true, rows are returned newest first; when false,
9914            /// rows are returned oldest first.
9915            ///
9916            /// Field 3: `reversed`
9917            pub reversed: bool,
9918            /// Optional lower transfer timestamp bound in microseconds since epoch (UTC),
9919            /// inclusive.
9920            ///
9921            /// Field 4: `ts_min_us`
9922            pub ts_min_us: u64,
9923            /// Optional upper transfer timestamp bound in microseconds since epoch (UTC),
9924            /// inclusive.
9925            ///
9926            /// Field 5: `ts_max_us`
9927            pub ts_max_us: u64,
9928            /// Optional filter by transfer reason.
9929            ///
9930            /// Field 6: `transfer_code`
9931            pub transfer_code: ::buffa::EnumValue<
9932                super::super::super::super::v1::TransferCode,
9933            >,
9934            /// Optional filter by asset ledger.
9935            ///
9936            /// Field 7: `ledger`
9937            pub ledger: u32,
9938            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
9939            /// bound to the authenticated account, sub-account scope, filters, timestamp
9940            /// bounds, and sort direction.
9941            ///
9942            /// Field 9: `page_token`
9943            pub page_token: &'a str,
9944            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
9945        }
9946        impl<'a> ::buffa::MessageView<'a> for ListTransfersRequestView<'a> {
9947            type Owned = super::super::ListTransfersRequest;
9948            fn decode_view(
9949                buf: &'a [u8],
9950            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9951                let __limit = ::core::cell::Cell::new(
9952                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
9953                );
9954                <Self as ::buffa::MessageView>::decode_view_ctx(
9955                    buf,
9956                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
9957                )
9958            }
9959            fn decode_view_with_ctx(
9960                buf: &'a [u8],
9961                ctx: ::buffa::DecodeContext<'_>,
9962            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9963                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
9964            }
9965            fn merge_view_field(
9966                &mut self,
9967                tag: ::buffa::encoding::Tag,
9968                cur: &'a [u8],
9969                before_tag: &'a [u8],
9970                ctx: ::buffa::DecodeContext<'_>,
9971            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
9972                let _ = ctx;
9973                #[allow(unused_variables)]
9974                let view = self;
9975                let mut cur = cur;
9976                match tag.field_number() {
9977                    1u32 => {
9978                        ::buffa::encoding::check_wire_type(
9979                            tag,
9980                            ::buffa::encoding::WireType::Fixed64,
9981                        )?;
9982                        view.subaccount_id = Some(
9983                            ::buffa::types::decode_fixed64(&mut cur)?,
9984                        );
9985                    }
9986                    2u32 => {
9987                        ::buffa::encoding::check_wire_type(
9988                            tag,
9989                            ::buffa::encoding::WireType::Varint,
9990                        )?;
9991                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
9992                    }
9993                    3u32 => {
9994                        ::buffa::encoding::check_wire_type(
9995                            tag,
9996                            ::buffa::encoding::WireType::Varint,
9997                        )?;
9998                        view.reversed = ::buffa::types::decode_bool(&mut cur)?;
9999                    }
10000                    4u32 => {
10001                        ::buffa::encoding::check_wire_type(
10002                            tag,
10003                            ::buffa::encoding::WireType::Varint,
10004                        )?;
10005                        view.ts_min_us = ::buffa::types::decode_uint64(&mut cur)?;
10006                    }
10007                    5u32 => {
10008                        ::buffa::encoding::check_wire_type(
10009                            tag,
10010                            ::buffa::encoding::WireType::Varint,
10011                        )?;
10012                        view.ts_max_us = ::buffa::types::decode_uint64(&mut cur)?;
10013                    }
10014                    6u32 => {
10015                        ::buffa::encoding::check_wire_type(
10016                            tag,
10017                            ::buffa::encoding::WireType::Varint,
10018                        )?;
10019                        view.transfer_code = ::buffa::EnumValue::from(
10020                            ::buffa::types::decode_int32(&mut cur)?,
10021                        );
10022                    }
10023                    7u32 => {
10024                        ::buffa::encoding::check_wire_type(
10025                            tag,
10026                            ::buffa::encoding::WireType::Varint,
10027                        )?;
10028                        view.ledger = ::buffa::types::decode_uint32(&mut cur)?;
10029                    }
10030                    9u32 => {
10031                        ::buffa::encoding::check_wire_type(
10032                            tag,
10033                            ::buffa::encoding::WireType::LengthDelimited,
10034                        )?;
10035                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
10036                    }
10037                    _ => {
10038                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10039                        let span_len = before_tag.len() - cur.len();
10040                        view.__buffa_unknown_fields
10041                            .push_record(before_tag, span_len, ctx)?;
10042                    }
10043                }
10044                ::core::result::Result::Ok(cur)
10045            }
10046            fn to_owned_message(
10047                &self,
10048            ) -> ::core::result::Result<
10049                super::super::ListTransfersRequest,
10050                ::buffa::DecodeError,
10051            > {
10052                self.to_owned_from_source(None)
10053            }
10054            #[allow(clippy::useless_conversion, clippy::needless_update)]
10055            fn to_owned_from_source(
10056                &self,
10057                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10058            ) -> ::core::result::Result<
10059                super::super::ListTransfersRequest,
10060                ::buffa::DecodeError,
10061            > {
10062                #[allow(unused_imports)]
10063                use ::buffa::alloc::string::ToString as _;
10064                let _ = __buffa_src;
10065                ::core::result::Result::Ok(super::super::ListTransfersRequest {
10066                    subaccount_id: self.subaccount_id,
10067                    limit: self.limit,
10068                    reversed: self.reversed,
10069                    ts_min_us: self.ts_min_us,
10070                    ts_max_us: self.ts_max_us,
10071                    transfer_code: self.transfer_code,
10072                    ledger: self.ledger,
10073                    page_token: self.page_token.to_string(),
10074                    __buffa_unknown_fields: self
10075                        .__buffa_unknown_fields
10076                        .to_owned()?
10077                        .into(),
10078                    ..::core::default::Default::default()
10079                })
10080            }
10081        }
10082        impl<'a> ::buffa::ViewEncode<'a> for ListTransfersRequestView<'a> {
10083            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10084            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10085                #[allow(unused_imports)]
10086                use ::buffa::Enumeration as _;
10087                let mut size = 0u32;
10088                if self.subaccount_id.is_some() {
10089                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
10090                }
10091                if self.limit != 0u32 {
10092                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
10093                }
10094                if self.reversed {
10095                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10096                }
10097                if self.ts_min_us != 0u64 {
10098                    size
10099                        += 1u32
10100                            + ::buffa::types::uint64_encoded_len(self.ts_min_us) as u32;
10101                }
10102                if self.ts_max_us != 0u64 {
10103                    size
10104                        += 1u32
10105                            + ::buffa::types::uint64_encoded_len(self.ts_max_us) as u32;
10106                }
10107                {
10108                    let val = self.transfer_code.to_i32();
10109                    if val != 0 {
10110                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
10111                    }
10112                }
10113                if self.ledger != 0u32 {
10114                    size
10115                        += 1u32 + ::buffa::types::uint32_encoded_len(self.ledger) as u32;
10116                }
10117                if !self.page_token.is_empty() {
10118                    size
10119                        += 1u32
10120                            + ::buffa::types::string_encoded_len(&self.page_token)
10121                                as u32;
10122                }
10123                size += self.__buffa_unknown_fields.encoded_len() as u32;
10124                size
10125            }
10126            #[allow(clippy::needless_borrow)]
10127            fn write_to(
10128                &self,
10129                _cache: &mut ::buffa::SizeCache,
10130                buf: &mut impl ::buffa::bytes::BufMut,
10131            ) {
10132                #[allow(unused_imports)]
10133                use ::buffa::Enumeration as _;
10134                if let Some(v) = self.subaccount_id {
10135                    ::buffa::types::put_fixed64_field(1u32, v, buf);
10136                }
10137                if self.limit != 0u32 {
10138                    ::buffa::types::put_uint32_field(2u32, self.limit, buf);
10139                }
10140                if self.reversed {
10141                    ::buffa::types::put_bool_field(3u32, self.reversed, buf);
10142                }
10143                if self.ts_min_us != 0u64 {
10144                    ::buffa::types::put_uint64_field(4u32, self.ts_min_us, buf);
10145                }
10146                if self.ts_max_us != 0u64 {
10147                    ::buffa::types::put_uint64_field(5u32, self.ts_max_us, buf);
10148                }
10149                {
10150                    let val = self.transfer_code.to_i32();
10151                    if val != 0 {
10152                        ::buffa::types::put_int32_field(6u32, val, buf);
10153                    }
10154                }
10155                if self.ledger != 0u32 {
10156                    ::buffa::types::put_uint32_field(7u32, self.ledger, buf);
10157                }
10158                if !self.page_token.is_empty() {
10159                    ::buffa::types::put_string_field(9u32, &self.page_token, buf);
10160                }
10161                self.__buffa_unknown_fields.write_to(buf);
10162            }
10163        }
10164        /// Serializes this view as protobuf JSON.
10165        ///
10166        /// Implicit-presence fields with default values are omitted, `required`
10167        /// fields are always emitted, explicit-presence (`optional`) fields are
10168        /// emitted only when set, bytes fields are base64-encoded, and enum
10169        /// values are their proto name strings.
10170        ///
10171        /// This impl uses `serialize_map(None)` because the number of emitted
10172        /// fields depends on default-omission rules; serializers that require
10173        /// known map lengths (e.g. `bincode`) will return a runtime error.
10174        /// Use the owned message type for those formats.
10175        impl<'__a> ::serde::Serialize for ListTransfersRequestView<'__a> {
10176            fn serialize<__S: ::serde::Serializer>(
10177                &self,
10178                __s: __S,
10179            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10180                use ::serde::ser::SerializeMap as _;
10181                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10182                if let ::core::option::Option::Some(__v) = self.subaccount_id {
10183                    __map
10184                        .serialize_entry(
10185                            "subaccountId",
10186                            &::buffa::json_helpers::ProtoJson(&__v),
10187                        )?;
10188                }
10189                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
10190                    __map
10191                        .serialize_entry(
10192                            "limit",
10193                            &::buffa::json_helpers::ProtoJson(&self.limit),
10194                        )?;
10195                }
10196                if self.reversed {
10197                    __map.serialize_entry("reversed", &self.reversed)?;
10198                }
10199                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_min_us) {
10200                    __map
10201                        .serialize_entry(
10202                            "tsMinUs",
10203                            &::buffa::json_helpers::ProtoJson(&self.ts_min_us),
10204                        )?;
10205                }
10206                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_max_us) {
10207                    __map
10208                        .serialize_entry(
10209                            "tsMaxUs",
10210                            &::buffa::json_helpers::ProtoJson(&self.ts_max_us),
10211                        )?;
10212                }
10213                if !::buffa::json_helpers::skip_if::is_default_enum_value(
10214                    &self.transfer_code,
10215                ) {
10216                    __map.serialize_entry("transferCode", &self.transfer_code)?;
10217                }
10218                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.ledger) {
10219                    __map
10220                        .serialize_entry(
10221                            "ledger",
10222                            &::buffa::json_helpers::ProtoJson(&self.ledger),
10223                        )?;
10224                }
10225                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
10226                    __map.serialize_entry("pageToken", self.page_token)?;
10227                }
10228                __map.end()
10229            }
10230        }
10231        impl<'a> ::buffa::MessageName for ListTransfersRequestView<'a> {
10232            const PACKAGE: &'static str = "ledger.read.v1";
10233            const NAME: &'static str = "ListTransfersRequest";
10234            const FULL_NAME: &'static str = "ledger.read.v1.ListTransfersRequest";
10235            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListTransfersRequest";
10236        }
10237        ::buffa::impl_default_view_instance!(ListTransfersRequestView);
10238        ::buffa::impl_view_reborrow!(ListTransfersRequestView);
10239        /** Self-contained, `'static` owned view of a `ListTransfersRequest` message.
10240
10241 Wraps [`::buffa::OwnedView`]`<`[`ListTransfersRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
10242
10243 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListTransfersRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
10244        #[derive(Clone, Debug)]
10245        pub struct ListTransfersRequestOwnedView(
10246            ::buffa::OwnedView<ListTransfersRequestView<'static>>,
10247        );
10248        impl ListTransfersRequestOwnedView {
10249            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10250            ///
10251            /// The view borrows directly from the buffer's data; the buffer is
10252            /// retained inside the returned handle.
10253            ///
10254            /// # Errors
10255            ///
10256            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10257            /// protobuf data.
10258            pub fn decode(
10259                bytes: ::buffa::bytes::Bytes,
10260            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10261                ::core::result::Result::Ok(
10262                    ListTransfersRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
10263                )
10264            }
10265            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10266            /// max message size).
10267            ///
10268            /// # Errors
10269            ///
10270            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10271            /// exceeds the configured limits.
10272            pub fn decode_with_options(
10273                bytes: ::buffa::bytes::Bytes,
10274                opts: &::buffa::DecodeOptions,
10275            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10276                ::core::result::Result::Ok(
10277                    ListTransfersRequestOwnedView(
10278                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10279                    ),
10280                )
10281            }
10282            /// Build from an owned message via an encode → decode round-trip.
10283            ///
10284            /// # Errors
10285            ///
10286            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10287            /// somehow invalid (should not happen for well-formed messages).
10288            pub fn from_owned(
10289                msg: &super::super::ListTransfersRequest,
10290            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10291                ::core::result::Result::Ok(
10292                    ListTransfersRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
10293                )
10294            }
10295            /// Borrow the full [`ListTransfersRequestView`] with its lifetime tied to `&self`.
10296            #[must_use]
10297            pub fn view(&self) -> &ListTransfersRequestView<'_> {
10298                self.0.reborrow()
10299            }
10300            /// Convert to the owned message type.
10301            ///
10302            /// # Errors
10303            ///
10304            /// Returns an error if re-materializing preserved unknown fields
10305            /// fails (e.g. the unknown-field limit is exceeded).
10306            pub fn to_owned_message(
10307                &self,
10308            ) -> ::core::result::Result<
10309                super::super::ListTransfersRequest,
10310                ::buffa::DecodeError,
10311            > {
10312                self.0.to_owned_message()
10313            }
10314            /// The underlying bytes buffer.
10315            #[must_use]
10316            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10317                self.0.bytes()
10318            }
10319            /// Consume the handle, returning the underlying bytes buffer.
10320            #[must_use]
10321            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10322                self.0.into_bytes()
10323            }
10324            /// Optional sub-account to scope transfers to. If omitted, transfers are
10325            /// listed for the authenticated root account derived from the JWT or API key.
10326            ///
10327            /// Field 1: `subaccount_id`
10328            #[must_use]
10329            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
10330                self.0.reborrow().subaccount_id
10331            }
10332            /// Maximum number of transfer rows to return. Defaults to 100 when omitted;
10333            /// maximum is 1000.
10334            ///
10335            /// Field 2: `limit`
10336            #[must_use]
10337            pub fn limit(&self) -> u32 {
10338                self.0.reborrow().limit
10339            }
10340            /// Sort direction. When true, rows are returned newest first; when false,
10341            /// rows are returned oldest first.
10342            ///
10343            /// Field 3: `reversed`
10344            #[must_use]
10345            pub fn reversed(&self) -> bool {
10346                self.0.reborrow().reversed
10347            }
10348            /// Optional lower transfer timestamp bound in microseconds since epoch (UTC),
10349            /// inclusive.
10350            ///
10351            /// Field 4: `ts_min_us`
10352            #[must_use]
10353            pub fn ts_min_us(&self) -> u64 {
10354                self.0.reborrow().ts_min_us
10355            }
10356            /// Optional upper transfer timestamp bound in microseconds since epoch (UTC),
10357            /// inclusive.
10358            ///
10359            /// Field 5: `ts_max_us`
10360            #[must_use]
10361            pub fn ts_max_us(&self) -> u64 {
10362                self.0.reborrow().ts_max_us
10363            }
10364            /// Optional filter by transfer reason.
10365            ///
10366            /// Field 6: `transfer_code`
10367            #[must_use]
10368            pub fn transfer_code(
10369                &self,
10370            ) -> ::buffa::EnumValue<super::super::super::super::v1::TransferCode> {
10371                self.0.reborrow().transfer_code
10372            }
10373            /// Optional filter by asset ledger.
10374            ///
10375            /// Field 7: `ledger`
10376            #[must_use]
10377            pub fn ledger(&self) -> u32 {
10378                self.0.reborrow().ledger
10379            }
10380            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
10381            /// bound to the authenticated account, sub-account scope, filters, timestamp
10382            /// bounds, and sort direction.
10383            ///
10384            /// Field 9: `page_token`
10385            #[must_use]
10386            pub fn page_token(&self) -> &'_ str {
10387                self.0.reborrow().page_token
10388            }
10389        }
10390        impl ::core::convert::From<::buffa::OwnedView<ListTransfersRequestView<'static>>>
10391        for ListTransfersRequestOwnedView {
10392            fn from(
10393                inner: ::buffa::OwnedView<ListTransfersRequestView<'static>>,
10394            ) -> Self {
10395                ListTransfersRequestOwnedView(inner)
10396            }
10397        }
10398        impl ::core::convert::From<ListTransfersRequestOwnedView>
10399        for ::buffa::OwnedView<ListTransfersRequestView<'static>> {
10400            fn from(wrapper: ListTransfersRequestOwnedView) -> Self {
10401                wrapper.0
10402            }
10403        }
10404        impl ::core::convert::AsRef<
10405            ::buffa::OwnedView<ListTransfersRequestView<'static>>,
10406        > for ListTransfersRequestOwnedView {
10407            fn as_ref(&self) -> &::buffa::OwnedView<ListTransfersRequestView<'static>> {
10408                &self.0
10409            }
10410        }
10411        impl ::buffa::HasMessageView for super::super::ListTransfersRequest {
10412            type View<'a> = ListTransfersRequestView<'a>;
10413            type ViewHandle = ListTransfersRequestOwnedView;
10414        }
10415        impl ::serde::Serialize for ListTransfersRequestOwnedView {
10416            fn serialize<__S: ::serde::Serializer>(
10417                &self,
10418                __s: __S,
10419            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10420                ::serde::Serialize::serialize(&self.0, __s)
10421            }
10422        }
10423        /// TransferSide describes one side of a ledger transfer for display.
10424        #[derive(Clone, Debug, Default)]
10425        pub struct TransferSideView<'a> {
10426            /// Display classification for this transfer side.
10427            ///
10428            /// Field 1: `kind`
10429            pub kind: ::buffa::EnumValue<super::super::TransferSideKind>,
10430            /// Public root account or subaccount ID when this side is safe to identify. Never
10431            /// populated for private counterparties or non-user ledger accounts.
10432            ///
10433            /// Field 2: `account_id`
10434            pub account_id: ::core::option::Option<u64>,
10435            /// Address for this side when known. For EXTERNAL_ADDRESS this is an
10436            /// external-chain wallet address from lifecycle correlation; for identifiable
10437            /// Polyester accounts this is a Polyester smart-account address.
10438            /// May be empty until the corresponding lifecycle details are available.
10439            ///
10440            /// Field 3: `address`
10441            pub address: &'a str,
10442            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10443        }
10444        impl<'a> ::buffa::MessageView<'a> for TransferSideView<'a> {
10445            type Owned = super::super::TransferSide;
10446            fn decode_view(
10447                buf: &'a [u8],
10448            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10449                let __limit = ::core::cell::Cell::new(
10450                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10451                );
10452                <Self as ::buffa::MessageView>::decode_view_ctx(
10453                    buf,
10454                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10455                )
10456            }
10457            fn decode_view_with_ctx(
10458                buf: &'a [u8],
10459                ctx: ::buffa::DecodeContext<'_>,
10460            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10461                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10462            }
10463            fn merge_view_field(
10464                &mut self,
10465                tag: ::buffa::encoding::Tag,
10466                cur: &'a [u8],
10467                before_tag: &'a [u8],
10468                ctx: ::buffa::DecodeContext<'_>,
10469            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10470                let _ = ctx;
10471                #[allow(unused_variables)]
10472                let view = self;
10473                let mut cur = cur;
10474                match tag.field_number() {
10475                    1u32 => {
10476                        ::buffa::encoding::check_wire_type(
10477                            tag,
10478                            ::buffa::encoding::WireType::Varint,
10479                        )?;
10480                        view.kind = ::buffa::EnumValue::from(
10481                            ::buffa::types::decode_int32(&mut cur)?,
10482                        );
10483                    }
10484                    2u32 => {
10485                        ::buffa::encoding::check_wire_type(
10486                            tag,
10487                            ::buffa::encoding::WireType::Fixed64,
10488                        )?;
10489                        view.account_id = Some(
10490                            ::buffa::types::decode_fixed64(&mut cur)?,
10491                        );
10492                    }
10493                    3u32 => {
10494                        ::buffa::encoding::check_wire_type(
10495                            tag,
10496                            ::buffa::encoding::WireType::LengthDelimited,
10497                        )?;
10498                        view.address = ::buffa::types::borrow_str(&mut cur)?;
10499                    }
10500                    _ => {
10501                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10502                        let span_len = before_tag.len() - cur.len();
10503                        view.__buffa_unknown_fields
10504                            .push_record(before_tag, span_len, ctx)?;
10505                    }
10506                }
10507                ::core::result::Result::Ok(cur)
10508            }
10509            fn to_owned_message(
10510                &self,
10511            ) -> ::core::result::Result<
10512                super::super::TransferSide,
10513                ::buffa::DecodeError,
10514            > {
10515                self.to_owned_from_source(None)
10516            }
10517            #[allow(clippy::useless_conversion, clippy::needless_update)]
10518            fn to_owned_from_source(
10519                &self,
10520                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10521            ) -> ::core::result::Result<
10522                super::super::TransferSide,
10523                ::buffa::DecodeError,
10524            > {
10525                #[allow(unused_imports)]
10526                use ::buffa::alloc::string::ToString as _;
10527                let _ = __buffa_src;
10528                ::core::result::Result::Ok(super::super::TransferSide {
10529                    kind: self.kind,
10530                    account_id: self.account_id,
10531                    address: self.address.to_string(),
10532                    __buffa_unknown_fields: self
10533                        .__buffa_unknown_fields
10534                        .to_owned()?
10535                        .into(),
10536                    ..::core::default::Default::default()
10537                })
10538            }
10539        }
10540        impl<'a> ::buffa::ViewEncode<'a> for TransferSideView<'a> {
10541            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10542            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10543                #[allow(unused_imports)]
10544                use ::buffa::Enumeration as _;
10545                let mut size = 0u32;
10546                {
10547                    let val = self.kind.to_i32();
10548                    if val != 0 {
10549                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
10550                    }
10551                }
10552                if self.account_id.is_some() {
10553                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
10554                }
10555                if !self.address.is_empty() {
10556                    size
10557                        += 1u32
10558                            + ::buffa::types::string_encoded_len(&self.address) as u32;
10559                }
10560                size += self.__buffa_unknown_fields.encoded_len() as u32;
10561                size
10562            }
10563            #[allow(clippy::needless_borrow)]
10564            fn write_to(
10565                &self,
10566                _cache: &mut ::buffa::SizeCache,
10567                buf: &mut impl ::buffa::bytes::BufMut,
10568            ) {
10569                #[allow(unused_imports)]
10570                use ::buffa::Enumeration as _;
10571                {
10572                    let val = self.kind.to_i32();
10573                    if val != 0 {
10574                        ::buffa::types::put_int32_field(1u32, val, buf);
10575                    }
10576                }
10577                if let Some(v) = self.account_id {
10578                    ::buffa::types::put_fixed64_field(2u32, v, buf);
10579                }
10580                if !self.address.is_empty() {
10581                    ::buffa::types::put_string_field(3u32, &self.address, buf);
10582                }
10583                self.__buffa_unknown_fields.write_to(buf);
10584            }
10585        }
10586        /// Serializes this view as protobuf JSON.
10587        ///
10588        /// Implicit-presence fields with default values are omitted, `required`
10589        /// fields are always emitted, explicit-presence (`optional`) fields are
10590        /// emitted only when set, bytes fields are base64-encoded, and enum
10591        /// values are their proto name strings.
10592        ///
10593        /// This impl uses `serialize_map(None)` because the number of emitted
10594        /// fields depends on default-omission rules; serializers that require
10595        /// known map lengths (e.g. `bincode`) will return a runtime error.
10596        /// Use the owned message type for those formats.
10597        impl<'__a> ::serde::Serialize for TransferSideView<'__a> {
10598            fn serialize<__S: ::serde::Serializer>(
10599                &self,
10600                __s: __S,
10601            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10602                use ::serde::ser::SerializeMap as _;
10603                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10604                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.kind) {
10605                    __map.serialize_entry("kind", &self.kind)?;
10606                }
10607                if let ::core::option::Option::Some(__v) = self.account_id {
10608                    __map
10609                        .serialize_entry(
10610                            "accountId",
10611                            &::buffa::json_helpers::ProtoJson(&__v),
10612                        )?;
10613                }
10614                if !::buffa::json_helpers::skip_if::is_empty_str(self.address) {
10615                    __map.serialize_entry("address", self.address)?;
10616                }
10617                __map.end()
10618            }
10619        }
10620        impl<'a> ::buffa::MessageName for TransferSideView<'a> {
10621            const PACKAGE: &'static str = "ledger.read.v1";
10622            const NAME: &'static str = "TransferSide";
10623            const FULL_NAME: &'static str = "ledger.read.v1.TransferSide";
10624            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.TransferSide";
10625        }
10626        ::buffa::impl_default_view_instance!(TransferSideView);
10627        ::buffa::impl_view_reborrow!(TransferSideView);
10628        /** Self-contained, `'static` owned view of a `TransferSide` message.
10629
10630 Wraps [`::buffa::OwnedView`]`<`[`TransferSideView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
10631
10632 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TransferSideView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
10633        #[derive(Clone, Debug)]
10634        pub struct TransferSideOwnedView(::buffa::OwnedView<TransferSideView<'static>>);
10635        impl TransferSideOwnedView {
10636            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10637            ///
10638            /// The view borrows directly from the buffer's data; the buffer is
10639            /// retained inside the returned handle.
10640            ///
10641            /// # Errors
10642            ///
10643            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10644            /// protobuf data.
10645            pub fn decode(
10646                bytes: ::buffa::bytes::Bytes,
10647            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10648                ::core::result::Result::Ok(
10649                    TransferSideOwnedView(::buffa::OwnedView::decode(bytes)?),
10650                )
10651            }
10652            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10653            /// max message size).
10654            ///
10655            /// # Errors
10656            ///
10657            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10658            /// exceeds the configured limits.
10659            pub fn decode_with_options(
10660                bytes: ::buffa::bytes::Bytes,
10661                opts: &::buffa::DecodeOptions,
10662            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10663                ::core::result::Result::Ok(
10664                    TransferSideOwnedView(
10665                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10666                    ),
10667                )
10668            }
10669            /// Build from an owned message via an encode → decode round-trip.
10670            ///
10671            /// # Errors
10672            ///
10673            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10674            /// somehow invalid (should not happen for well-formed messages).
10675            pub fn from_owned(
10676                msg: &super::super::TransferSide,
10677            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10678                ::core::result::Result::Ok(
10679                    TransferSideOwnedView(::buffa::OwnedView::from_owned(msg)?),
10680                )
10681            }
10682            /// Borrow the full [`TransferSideView`] with its lifetime tied to `&self`.
10683            #[must_use]
10684            pub fn view(&self) -> &TransferSideView<'_> {
10685                self.0.reborrow()
10686            }
10687            /// Convert to the owned message type.
10688            ///
10689            /// # Errors
10690            ///
10691            /// Returns an error if re-materializing preserved unknown fields
10692            /// fails (e.g. the unknown-field limit is exceeded).
10693            pub fn to_owned_message(
10694                &self,
10695            ) -> ::core::result::Result<
10696                super::super::TransferSide,
10697                ::buffa::DecodeError,
10698            > {
10699                self.0.to_owned_message()
10700            }
10701            /// The underlying bytes buffer.
10702            #[must_use]
10703            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10704                self.0.bytes()
10705            }
10706            /// Consume the handle, returning the underlying bytes buffer.
10707            #[must_use]
10708            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10709                self.0.into_bytes()
10710            }
10711            /// Display classification for this transfer side.
10712            ///
10713            /// Field 1: `kind`
10714            #[must_use]
10715            pub fn kind(&self) -> ::buffa::EnumValue<super::super::TransferSideKind> {
10716                self.0.reborrow().kind
10717            }
10718            /// Public root account or subaccount ID when this side is safe to identify. Never
10719            /// populated for private counterparties or non-user ledger accounts.
10720            ///
10721            /// Field 2: `account_id`
10722            #[must_use]
10723            pub fn account_id(&self) -> ::core::option::Option<u64> {
10724                self.0.reborrow().account_id
10725            }
10726            /// Address for this side when known. For EXTERNAL_ADDRESS this is an
10727            /// external-chain wallet address from lifecycle correlation; for identifiable
10728            /// Polyester accounts this is a Polyester smart-account address.
10729            /// May be empty until the corresponding lifecycle details are available.
10730            ///
10731            /// Field 3: `address`
10732            #[must_use]
10733            pub fn address(&self) -> &'_ str {
10734                self.0.reborrow().address
10735            }
10736        }
10737        impl ::core::convert::From<::buffa::OwnedView<TransferSideView<'static>>>
10738        for TransferSideOwnedView {
10739            fn from(inner: ::buffa::OwnedView<TransferSideView<'static>>) -> Self {
10740                TransferSideOwnedView(inner)
10741            }
10742        }
10743        impl ::core::convert::From<TransferSideOwnedView>
10744        for ::buffa::OwnedView<TransferSideView<'static>> {
10745            fn from(wrapper: TransferSideOwnedView) -> Self {
10746                wrapper.0
10747            }
10748        }
10749        impl ::core::convert::AsRef<::buffa::OwnedView<TransferSideView<'static>>>
10750        for TransferSideOwnedView {
10751            fn as_ref(&self) -> &::buffa::OwnedView<TransferSideView<'static>> {
10752                &self.0
10753            }
10754        }
10755        impl ::buffa::HasMessageView for super::super::TransferSide {
10756            type View<'a> = TransferSideView<'a>;
10757            type ViewHandle = TransferSideOwnedView;
10758        }
10759        impl ::serde::Serialize for TransferSideOwnedView {
10760            fn serialize<__S: ::serde::Serializer>(
10761                &self,
10762                __s: __S,
10763            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10764                ::serde::Serialize::serialize(&self.0, __s)
10765            }
10766        }
10767        /// TransferRow describes one debit or credit leg of a ledger transfer.
10768        #[derive(Clone, Debug, Default)]
10769        pub struct TransferRowView<'a> {
10770            /// Public unified asset ID. Resolve its symbol through the spot configuration
10771            /// API. U128 amounts in this row always use a fixed 18-decimal ledger scale.
10772            ///
10773            /// Field 1: `asset_id`
10774            pub asset_id: u32,
10775            /// Transfer amount at fixed 18-decimal ledger scale.
10776            ///
10777            /// Field 2: `amount_e18`
10778            pub amount_e18: ::buffa::MessageFieldView<
10779                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
10780                    'a,
10781                >,
10782            >,
10783            /// Product reason for this transfer.
10784            ///
10785            /// Field 3: `transfer_code`
10786            pub transfer_code: ::buffa::EnumValue<
10787                super::super::super::super::v1::TransferCode,
10788            >,
10789            /// Account bucket affected by this transfer.
10790            ///
10791            /// Field 4: `account_code`
10792            pub account_code: ::buffa::EnumValue<
10793                super::super::super::super::v1::AccountCode,
10794            >,
10795            /// Transfer timestamp in microseconds since epoch (UTC).
10796            ///
10797            /// Field 5: `ts_us`
10798            pub ts_us: u64,
10799            /// Post-transfer balance at fixed 18-decimal ledger scale.
10800            ///
10801            /// Field 9: `balance_after_e18`
10802            pub balance_after_e18: ::buffa::MessageFieldView<
10803                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
10804                    'a,
10805                >,
10806            >,
10807            /// True when this row is the debit leg; false when it is the credit leg.
10808            ///
10809            /// Field 10: `is_debit`
10810            pub is_debit: bool,
10811            /// Correlation ID used to group related transfer legs. Zero when unavailable.
10812            ///
10813            /// Field 11: `link_id`
10814            pub link_id: u64,
10815            /// Public lifecycle flow ID when this transfer belongs to a chain lifecycle flow.
10816            ///
10817            /// Field 12: `flow_id`
10818            pub flow_id: &'a str,
10819            /// Debit side of the transfer. This relationship is debit-to-credit rather
10820            /// than row-relative; use is_debit to determine whether this row is the debit leg.
10821            ///
10822            /// Field 13: `source`
10823            pub source: ::buffa::MessageFieldView<
10824                super::super::__buffa::view::TransferSideView<'a>,
10825            >,
10826            /// Credit side of the transfer. This relationship is debit-to-credit rather
10827            /// than row-relative; use is_debit to determine whether this row is the credit leg.
10828            ///
10829            /// Field 14: `destination`
10830            pub destination: ::buffa::MessageFieldView<
10831                super::super::__buffa::view::TransferSideView<'a>,
10832            >,
10833            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10834        }
10835        impl<'a> ::buffa::MessageView<'a> for TransferRowView<'a> {
10836            type Owned = super::super::TransferRow;
10837            fn decode_view(
10838                buf: &'a [u8],
10839            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10840                let __limit = ::core::cell::Cell::new(
10841                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10842                );
10843                <Self as ::buffa::MessageView>::decode_view_ctx(
10844                    buf,
10845                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10846                )
10847            }
10848            fn decode_view_with_ctx(
10849                buf: &'a [u8],
10850                ctx: ::buffa::DecodeContext<'_>,
10851            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10852                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10853            }
10854            fn merge_view_field(
10855                &mut self,
10856                tag: ::buffa::encoding::Tag,
10857                cur: &'a [u8],
10858                before_tag: &'a [u8],
10859                ctx: ::buffa::DecodeContext<'_>,
10860            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10861                let _ = ctx;
10862                #[allow(unused_variables)]
10863                let view = self;
10864                let mut cur = cur;
10865                match tag.field_number() {
10866                    1u32 => {
10867                        ::buffa::encoding::check_wire_type(
10868                            tag,
10869                            ::buffa::encoding::WireType::Varint,
10870                        )?;
10871                        view.asset_id = ::buffa::types::decode_uint32(&mut cur)?;
10872                    }
10873                    2u32 => {
10874                        ::buffa::encoding::check_wire_type(
10875                            tag,
10876                            ::buffa::encoding::WireType::LengthDelimited,
10877                        )?;
10878                        let __sub_ctx = ctx.descend()?;
10879                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
10880                        match view.amount_e18.as_mut() {
10881                            Some(existing) => {
10882                                ::buffa::MessageView::merge_into_view(
10883                                    existing,
10884                                    sub,
10885                                    __sub_ctx,
10886                                )?
10887                            }
10888                            None => {
10889                                view.amount_e18 = ::buffa::MessageFieldView::set(
10890                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
10891                                        sub,
10892                                        __sub_ctx,
10893                                    )?,
10894                                );
10895                            }
10896                        }
10897                    }
10898                    3u32 => {
10899                        ::buffa::encoding::check_wire_type(
10900                            tag,
10901                            ::buffa::encoding::WireType::Varint,
10902                        )?;
10903                        view.transfer_code = ::buffa::EnumValue::from(
10904                            ::buffa::types::decode_int32(&mut cur)?,
10905                        );
10906                    }
10907                    4u32 => {
10908                        ::buffa::encoding::check_wire_type(
10909                            tag,
10910                            ::buffa::encoding::WireType::Varint,
10911                        )?;
10912                        view.account_code = ::buffa::EnumValue::from(
10913                            ::buffa::types::decode_int32(&mut cur)?,
10914                        );
10915                    }
10916                    5u32 => {
10917                        ::buffa::encoding::check_wire_type(
10918                            tag,
10919                            ::buffa::encoding::WireType::Varint,
10920                        )?;
10921                        view.ts_us = ::buffa::types::decode_uint64(&mut cur)?;
10922                    }
10923                    9u32 => {
10924                        ::buffa::encoding::check_wire_type(
10925                            tag,
10926                            ::buffa::encoding::WireType::LengthDelimited,
10927                        )?;
10928                        let __sub_ctx = ctx.descend()?;
10929                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
10930                        match view.balance_after_e18.as_mut() {
10931                            Some(existing) => {
10932                                ::buffa::MessageView::merge_into_view(
10933                                    existing,
10934                                    sub,
10935                                    __sub_ctx,
10936                                )?
10937                            }
10938                            None => {
10939                                view.balance_after_e18 = ::buffa::MessageFieldView::set(
10940                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
10941                                        sub,
10942                                        __sub_ctx,
10943                                    )?,
10944                                );
10945                            }
10946                        }
10947                    }
10948                    10u32 => {
10949                        ::buffa::encoding::check_wire_type(
10950                            tag,
10951                            ::buffa::encoding::WireType::Varint,
10952                        )?;
10953                        view.is_debit = ::buffa::types::decode_bool(&mut cur)?;
10954                    }
10955                    11u32 => {
10956                        ::buffa::encoding::check_wire_type(
10957                            tag,
10958                            ::buffa::encoding::WireType::Varint,
10959                        )?;
10960                        view.link_id = ::buffa::types::decode_uint64(&mut cur)?;
10961                    }
10962                    12u32 => {
10963                        ::buffa::encoding::check_wire_type(
10964                            tag,
10965                            ::buffa::encoding::WireType::LengthDelimited,
10966                        )?;
10967                        view.flow_id = ::buffa::types::borrow_str(&mut cur)?;
10968                    }
10969                    13u32 => {
10970                        ::buffa::encoding::check_wire_type(
10971                            tag,
10972                            ::buffa::encoding::WireType::LengthDelimited,
10973                        )?;
10974                        let __sub_ctx = ctx.descend()?;
10975                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
10976                        match view.source.as_mut() {
10977                            Some(existing) => {
10978                                ::buffa::MessageView::merge_into_view(
10979                                    existing,
10980                                    sub,
10981                                    __sub_ctx,
10982                                )?
10983                            }
10984                            None => {
10985                                view.source = ::buffa::MessageFieldView::set(
10986                                    <super::super::__buffa::view::TransferSideView as ::buffa::MessageView>::decode_view_ctx(
10987                                        sub,
10988                                        __sub_ctx,
10989                                    )?,
10990                                );
10991                            }
10992                        }
10993                    }
10994                    14u32 => {
10995                        ::buffa::encoding::check_wire_type(
10996                            tag,
10997                            ::buffa::encoding::WireType::LengthDelimited,
10998                        )?;
10999                        let __sub_ctx = ctx.descend()?;
11000                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11001                        match view.destination.as_mut() {
11002                            Some(existing) => {
11003                                ::buffa::MessageView::merge_into_view(
11004                                    existing,
11005                                    sub,
11006                                    __sub_ctx,
11007                                )?
11008                            }
11009                            None => {
11010                                view.destination = ::buffa::MessageFieldView::set(
11011                                    <super::super::__buffa::view::TransferSideView as ::buffa::MessageView>::decode_view_ctx(
11012                                        sub,
11013                                        __sub_ctx,
11014                                    )?,
11015                                );
11016                            }
11017                        }
11018                    }
11019                    _ => {
11020                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11021                        let span_len = before_tag.len() - cur.len();
11022                        view.__buffa_unknown_fields
11023                            .push_record(before_tag, span_len, ctx)?;
11024                    }
11025                }
11026                ::core::result::Result::Ok(cur)
11027            }
11028            fn to_owned_message(
11029                &self,
11030            ) -> ::core::result::Result<
11031                super::super::TransferRow,
11032                ::buffa::DecodeError,
11033            > {
11034                self.to_owned_from_source(None)
11035            }
11036            #[allow(clippy::useless_conversion, clippy::needless_update)]
11037            fn to_owned_from_source(
11038                &self,
11039                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11040            ) -> ::core::result::Result<
11041                super::super::TransferRow,
11042                ::buffa::DecodeError,
11043            > {
11044                #[allow(unused_imports)]
11045                use ::buffa::alloc::string::ToString as _;
11046                let _ = __buffa_src;
11047                ::core::result::Result::Ok(super::super::TransferRow {
11048                    asset_id: self.asset_id,
11049                    amount_e18: match self.amount_e18.as_option() {
11050                        Some(v) => {
11051                            ::buffa::MessageField::<
11052                                super::super::super::super::super::polyester::r#type::v1::U128,
11053                            >::some(v.to_owned_from_source(__buffa_src)?)
11054                        }
11055                        None => ::buffa::MessageField::none(),
11056                    },
11057                    transfer_code: self.transfer_code,
11058                    account_code: self.account_code,
11059                    ts_us: self.ts_us,
11060                    balance_after_e18: match self.balance_after_e18.as_option() {
11061                        Some(v) => {
11062                            ::buffa::MessageField::<
11063                                super::super::super::super::super::polyester::r#type::v1::U128,
11064                            >::some(v.to_owned_from_source(__buffa_src)?)
11065                        }
11066                        None => ::buffa::MessageField::none(),
11067                    },
11068                    is_debit: self.is_debit,
11069                    link_id: self.link_id,
11070                    flow_id: self.flow_id.to_string(),
11071                    source: match self.source.as_option() {
11072                        Some(v) => {
11073                            ::buffa::MessageField::<
11074                                super::super::TransferSide,
11075                            >::some(v.to_owned_from_source(__buffa_src)?)
11076                        }
11077                        None => ::buffa::MessageField::none(),
11078                    },
11079                    destination: match self.destination.as_option() {
11080                        Some(v) => {
11081                            ::buffa::MessageField::<
11082                                super::super::TransferSide,
11083                            >::some(v.to_owned_from_source(__buffa_src)?)
11084                        }
11085                        None => ::buffa::MessageField::none(),
11086                    },
11087                    __buffa_unknown_fields: self
11088                        .__buffa_unknown_fields
11089                        .to_owned()?
11090                        .into(),
11091                    ..::core::default::Default::default()
11092                })
11093            }
11094        }
11095        impl<'a> ::buffa::ViewEncode<'a> for TransferRowView<'a> {
11096            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11097            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
11098                #[allow(unused_imports)]
11099                use ::buffa::Enumeration as _;
11100                let mut size = 0u32;
11101                if self.asset_id != 0u32 {
11102                    size
11103                        += 1u32
11104                            + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
11105                }
11106                if self.amount_e18.is_set() {
11107                    let __slot = __cache.reserve();
11108                    let inner_size = self.amount_e18.compute_size(__cache);
11109                    __cache.set(__slot, inner_size);
11110                    size
11111                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11112                            + inner_size;
11113                }
11114                {
11115                    let val = self.transfer_code.to_i32();
11116                    if val != 0 {
11117                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
11118                    }
11119                }
11120                {
11121                    let val = self.account_code.to_i32();
11122                    if val != 0 {
11123                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
11124                    }
11125                }
11126                if self.ts_us != 0u64 {
11127                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_us) as u32;
11128                }
11129                if self.balance_after_e18.is_set() {
11130                    let __slot = __cache.reserve();
11131                    let inner_size = self.balance_after_e18.compute_size(__cache);
11132                    __cache.set(__slot, inner_size);
11133                    size
11134                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11135                            + inner_size;
11136                }
11137                if self.is_debit {
11138                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
11139                }
11140                if self.link_id != 0u64 {
11141                    size
11142                        += 1u32
11143                            + ::buffa::types::uint64_encoded_len(self.link_id) as u32;
11144                }
11145                if !self.flow_id.is_empty() {
11146                    size
11147                        += 1u32
11148                            + ::buffa::types::string_encoded_len(&self.flow_id) as u32;
11149                }
11150                if self.source.is_set() {
11151                    let __slot = __cache.reserve();
11152                    let inner_size = self.source.compute_size(__cache);
11153                    __cache.set(__slot, inner_size);
11154                    size
11155                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11156                            + inner_size;
11157                }
11158                if self.destination.is_set() {
11159                    let __slot = __cache.reserve();
11160                    let inner_size = self.destination.compute_size(__cache);
11161                    __cache.set(__slot, inner_size);
11162                    size
11163                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11164                            + inner_size;
11165                }
11166                size += self.__buffa_unknown_fields.encoded_len() as u32;
11167                size
11168            }
11169            #[allow(clippy::needless_borrow)]
11170            fn write_to(
11171                &self,
11172                __cache: &mut ::buffa::SizeCache,
11173                buf: &mut impl ::buffa::bytes::BufMut,
11174            ) {
11175                #[allow(unused_imports)]
11176                use ::buffa::Enumeration as _;
11177                if self.asset_id != 0u32 {
11178                    ::buffa::types::put_uint32_field(1u32, self.asset_id, buf);
11179                }
11180                if self.amount_e18.is_set() {
11181                    ::buffa::types::put_len_delimited_header(
11182                        2u32,
11183                        __cache.consume_next(),
11184                        buf,
11185                    );
11186                    self.amount_e18.write_to(__cache, buf);
11187                }
11188                {
11189                    let val = self.transfer_code.to_i32();
11190                    if val != 0 {
11191                        ::buffa::types::put_int32_field(3u32, val, buf);
11192                    }
11193                }
11194                {
11195                    let val = self.account_code.to_i32();
11196                    if val != 0 {
11197                        ::buffa::types::put_int32_field(4u32, val, buf);
11198                    }
11199                }
11200                if self.ts_us != 0u64 {
11201                    ::buffa::types::put_uint64_field(5u32, self.ts_us, buf);
11202                }
11203                if self.balance_after_e18.is_set() {
11204                    ::buffa::types::put_len_delimited_header(
11205                        9u32,
11206                        __cache.consume_next(),
11207                        buf,
11208                    );
11209                    self.balance_after_e18.write_to(__cache, buf);
11210                }
11211                if self.is_debit {
11212                    ::buffa::types::put_bool_field(10u32, self.is_debit, buf);
11213                }
11214                if self.link_id != 0u64 {
11215                    ::buffa::types::put_uint64_field(11u32, self.link_id, buf);
11216                }
11217                if !self.flow_id.is_empty() {
11218                    ::buffa::types::put_string_field(12u32, &self.flow_id, buf);
11219                }
11220                if self.source.is_set() {
11221                    ::buffa::types::put_len_delimited_header(
11222                        13u32,
11223                        __cache.consume_next(),
11224                        buf,
11225                    );
11226                    self.source.write_to(__cache, buf);
11227                }
11228                if self.destination.is_set() {
11229                    ::buffa::types::put_len_delimited_header(
11230                        14u32,
11231                        __cache.consume_next(),
11232                        buf,
11233                    );
11234                    self.destination.write_to(__cache, buf);
11235                }
11236                self.__buffa_unknown_fields.write_to(buf);
11237            }
11238        }
11239        /// Serializes this view as protobuf JSON.
11240        ///
11241        /// Implicit-presence fields with default values are omitted, `required`
11242        /// fields are always emitted, explicit-presence (`optional`) fields are
11243        /// emitted only when set, bytes fields are base64-encoded, and enum
11244        /// values are their proto name strings.
11245        ///
11246        /// This impl uses `serialize_map(None)` because the number of emitted
11247        /// fields depends on default-omission rules; serializers that require
11248        /// known map lengths (e.g. `bincode`) will return a runtime error.
11249        /// Use the owned message type for those formats.
11250        impl<'__a> ::serde::Serialize for TransferRowView<'__a> {
11251            fn serialize<__S: ::serde::Serializer>(
11252                &self,
11253                __s: __S,
11254            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11255                use ::serde::ser::SerializeMap as _;
11256                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11257                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.asset_id) {
11258                    __map
11259                        .serialize_entry(
11260                            "assetId",
11261                            &::buffa::json_helpers::ProtoJson(&self.asset_id),
11262                        )?;
11263                }
11264                {
11265                    if let ::core::option::Option::Some(__v) = self
11266                        .amount_e18
11267                        .as_option()
11268                    {
11269                        __map.serialize_entry("amountE18", __v)?;
11270                    }
11271                }
11272                if !::buffa::json_helpers::skip_if::is_default_enum_value(
11273                    &self.transfer_code,
11274                ) {
11275                    __map.serialize_entry("transferCode", &self.transfer_code)?;
11276                }
11277                if !::buffa::json_helpers::skip_if::is_default_enum_value(
11278                    &self.account_code,
11279                ) {
11280                    __map.serialize_entry("accountCode", &self.account_code)?;
11281                }
11282                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_us) {
11283                    __map
11284                        .serialize_entry(
11285                            "tsUs",
11286                            &::buffa::json_helpers::ProtoJson(&self.ts_us),
11287                        )?;
11288                }
11289                {
11290                    if let ::core::option::Option::Some(__v) = self
11291                        .balance_after_e18
11292                        .as_option()
11293                    {
11294                        __map.serialize_entry("balanceAfterE18", __v)?;
11295                    }
11296                }
11297                if self.is_debit {
11298                    __map.serialize_entry("isDebit", &self.is_debit)?;
11299                }
11300                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.link_id) {
11301                    __map
11302                        .serialize_entry(
11303                            "linkId",
11304                            &::buffa::json_helpers::ProtoJson(&self.link_id),
11305                        )?;
11306                }
11307                if !::buffa::json_helpers::skip_if::is_empty_str(self.flow_id) {
11308                    __map.serialize_entry("flowId", self.flow_id)?;
11309                }
11310                {
11311                    if let ::core::option::Option::Some(__v) = self.source.as_option() {
11312                        __map.serialize_entry("source", __v)?;
11313                    }
11314                }
11315                {
11316                    if let ::core::option::Option::Some(__v) = self
11317                        .destination
11318                        .as_option()
11319                    {
11320                        __map.serialize_entry("destination", __v)?;
11321                    }
11322                }
11323                __map.end()
11324            }
11325        }
11326        impl<'a> ::buffa::MessageName for TransferRowView<'a> {
11327            const PACKAGE: &'static str = "ledger.read.v1";
11328            const NAME: &'static str = "TransferRow";
11329            const FULL_NAME: &'static str = "ledger.read.v1.TransferRow";
11330            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.TransferRow";
11331        }
11332        ::buffa::impl_default_view_instance!(TransferRowView);
11333        ::buffa::impl_view_reborrow!(TransferRowView);
11334        /** Self-contained, `'static` owned view of a `TransferRow` message.
11335
11336 Wraps [`::buffa::OwnedView`]`<`[`TransferRowView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
11337
11338 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TransferRowView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
11339        #[derive(Clone, Debug)]
11340        pub struct TransferRowOwnedView(::buffa::OwnedView<TransferRowView<'static>>);
11341        impl TransferRowOwnedView {
11342            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11343            ///
11344            /// The view borrows directly from the buffer's data; the buffer is
11345            /// retained inside the returned handle.
11346            ///
11347            /// # Errors
11348            ///
11349            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11350            /// protobuf data.
11351            pub fn decode(
11352                bytes: ::buffa::bytes::Bytes,
11353            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11354                ::core::result::Result::Ok(
11355                    TransferRowOwnedView(::buffa::OwnedView::decode(bytes)?),
11356                )
11357            }
11358            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11359            /// max message size).
11360            ///
11361            /// # Errors
11362            ///
11363            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11364            /// exceeds the configured limits.
11365            pub fn decode_with_options(
11366                bytes: ::buffa::bytes::Bytes,
11367                opts: &::buffa::DecodeOptions,
11368            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11369                ::core::result::Result::Ok(
11370                    TransferRowOwnedView(
11371                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11372                    ),
11373                )
11374            }
11375            /// Build from an owned message via an encode → decode round-trip.
11376            ///
11377            /// # Errors
11378            ///
11379            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11380            /// somehow invalid (should not happen for well-formed messages).
11381            pub fn from_owned(
11382                msg: &super::super::TransferRow,
11383            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11384                ::core::result::Result::Ok(
11385                    TransferRowOwnedView(::buffa::OwnedView::from_owned(msg)?),
11386                )
11387            }
11388            /// Borrow the full [`TransferRowView`] with its lifetime tied to `&self`.
11389            #[must_use]
11390            pub fn view(&self) -> &TransferRowView<'_> {
11391                self.0.reborrow()
11392            }
11393            /// Convert to the owned message type.
11394            ///
11395            /// # Errors
11396            ///
11397            /// Returns an error if re-materializing preserved unknown fields
11398            /// fails (e.g. the unknown-field limit is exceeded).
11399            pub fn to_owned_message(
11400                &self,
11401            ) -> ::core::result::Result<
11402                super::super::TransferRow,
11403                ::buffa::DecodeError,
11404            > {
11405                self.0.to_owned_message()
11406            }
11407            /// The underlying bytes buffer.
11408            #[must_use]
11409            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11410                self.0.bytes()
11411            }
11412            /// Consume the handle, returning the underlying bytes buffer.
11413            #[must_use]
11414            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11415                self.0.into_bytes()
11416            }
11417            /// Public unified asset ID. Resolve its symbol through the spot configuration
11418            /// API. U128 amounts in this row always use a fixed 18-decimal ledger scale.
11419            ///
11420            /// Field 1: `asset_id`
11421            #[must_use]
11422            pub fn asset_id(&self) -> u32 {
11423                self.0.reborrow().asset_id
11424            }
11425            /// Transfer amount at fixed 18-decimal ledger scale.
11426            ///
11427            /// Field 2: `amount_e18`
11428            #[must_use]
11429            pub fn amount_e18(
11430                &self,
11431            ) -> &::buffa::MessageFieldView<
11432                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
11433                    '_,
11434                >,
11435            > {
11436                &self.0.reborrow().amount_e18
11437            }
11438            /// Product reason for this transfer.
11439            ///
11440            /// Field 3: `transfer_code`
11441            #[must_use]
11442            pub fn transfer_code(
11443                &self,
11444            ) -> ::buffa::EnumValue<super::super::super::super::v1::TransferCode> {
11445                self.0.reborrow().transfer_code
11446            }
11447            /// Account bucket affected by this transfer.
11448            ///
11449            /// Field 4: `account_code`
11450            #[must_use]
11451            pub fn account_code(
11452                &self,
11453            ) -> ::buffa::EnumValue<super::super::super::super::v1::AccountCode> {
11454                self.0.reborrow().account_code
11455            }
11456            /// Transfer timestamp in microseconds since epoch (UTC).
11457            ///
11458            /// Field 5: `ts_us`
11459            #[must_use]
11460            pub fn ts_us(&self) -> u64 {
11461                self.0.reborrow().ts_us
11462            }
11463            /// Post-transfer balance at fixed 18-decimal ledger scale.
11464            ///
11465            /// Field 9: `balance_after_e18`
11466            #[must_use]
11467            pub fn balance_after_e18(
11468                &self,
11469            ) -> &::buffa::MessageFieldView<
11470                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
11471                    '_,
11472                >,
11473            > {
11474                &self.0.reborrow().balance_after_e18
11475            }
11476            /// True when this row is the debit leg; false when it is the credit leg.
11477            ///
11478            /// Field 10: `is_debit`
11479            #[must_use]
11480            pub fn is_debit(&self) -> bool {
11481                self.0.reborrow().is_debit
11482            }
11483            /// Correlation ID used to group related transfer legs. Zero when unavailable.
11484            ///
11485            /// Field 11: `link_id`
11486            #[must_use]
11487            pub fn link_id(&self) -> u64 {
11488                self.0.reborrow().link_id
11489            }
11490            /// Public lifecycle flow ID when this transfer belongs to a chain lifecycle flow.
11491            ///
11492            /// Field 12: `flow_id`
11493            #[must_use]
11494            pub fn flow_id(&self) -> &'_ str {
11495                self.0.reborrow().flow_id
11496            }
11497            /// Debit side of the transfer. This relationship is debit-to-credit rather
11498            /// than row-relative; use is_debit to determine whether this row is the debit leg.
11499            ///
11500            /// Field 13: `source`
11501            #[must_use]
11502            pub fn source(
11503                &self,
11504            ) -> &::buffa::MessageFieldView<
11505                super::super::__buffa::view::TransferSideView<'_>,
11506            > {
11507                &self.0.reborrow().source
11508            }
11509            /// Credit side of the transfer. This relationship is debit-to-credit rather
11510            /// than row-relative; use is_debit to determine whether this row is the credit leg.
11511            ///
11512            /// Field 14: `destination`
11513            #[must_use]
11514            pub fn destination(
11515                &self,
11516            ) -> &::buffa::MessageFieldView<
11517                super::super::__buffa::view::TransferSideView<'_>,
11518            > {
11519                &self.0.reborrow().destination
11520            }
11521        }
11522        impl ::core::convert::From<::buffa::OwnedView<TransferRowView<'static>>>
11523        for TransferRowOwnedView {
11524            fn from(inner: ::buffa::OwnedView<TransferRowView<'static>>) -> Self {
11525                TransferRowOwnedView(inner)
11526            }
11527        }
11528        impl ::core::convert::From<TransferRowOwnedView>
11529        for ::buffa::OwnedView<TransferRowView<'static>> {
11530            fn from(wrapper: TransferRowOwnedView) -> Self {
11531                wrapper.0
11532            }
11533        }
11534        impl ::core::convert::AsRef<::buffa::OwnedView<TransferRowView<'static>>>
11535        for TransferRowOwnedView {
11536            fn as_ref(&self) -> &::buffa::OwnedView<TransferRowView<'static>> {
11537                &self.0
11538            }
11539        }
11540        impl ::buffa::HasMessageView for super::super::TransferRow {
11541            type View<'a> = TransferRowView<'a>;
11542            type ViewHandle = TransferRowOwnedView;
11543        }
11544        impl ::serde::Serialize for TransferRowOwnedView {
11545            fn serialize<__S: ::serde::Serializer>(
11546                &self,
11547                __s: __S,
11548            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11549                ::serde::Serialize::serialize(&self.0, __s)
11550            }
11551        }
11552        /// ListTransfersResponse contains transfer rows and an optional continuation cursor.
11553        #[derive(Clone, Debug, Default)]
11554        pub struct ListTransfersResponseView<'a> {
11555            /// Transfer rows in requested order.
11556            ///
11557            /// Field 1: `transfers`
11558            pub transfers: ::buffa::RepeatedView<
11559                'a,
11560                super::super::__buffa::view::TransferRowView<'a>,
11561            >,
11562            /// Opaque cursor for the next page. Empty when no more results exist.
11563            ///
11564            /// Field 3: `next_page_token`
11565            pub next_page_token: &'a str,
11566            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11567        }
11568        impl<'a> ::buffa::MessageView<'a> for ListTransfersResponseView<'a> {
11569            type Owned = super::super::ListTransfersResponse;
11570            fn decode_view(
11571                buf: &'a [u8],
11572            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11573                let __limit = ::core::cell::Cell::new(
11574                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11575                );
11576                <Self as ::buffa::MessageView>::decode_view_ctx(
11577                    buf,
11578                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11579                )
11580            }
11581            fn decode_view_with_ctx(
11582                buf: &'a [u8],
11583                ctx: ::buffa::DecodeContext<'_>,
11584            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11585                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11586            }
11587            fn merge_view_field(
11588                &mut self,
11589                tag: ::buffa::encoding::Tag,
11590                cur: &'a [u8],
11591                before_tag: &'a [u8],
11592                ctx: ::buffa::DecodeContext<'_>,
11593            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11594                let _ = ctx;
11595                #[allow(unused_variables)]
11596                let view = self;
11597                let mut cur = cur;
11598                match tag.field_number() {
11599                    3u32 => {
11600                        ::buffa::encoding::check_wire_type(
11601                            tag,
11602                            ::buffa::encoding::WireType::LengthDelimited,
11603                        )?;
11604                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
11605                    }
11606                    1u32 => {
11607                        ::buffa::encoding::check_wire_type(
11608                            tag,
11609                            ::buffa::encoding::WireType::LengthDelimited,
11610                        )?;
11611                        let __sub_ctx = ctx.descend()?;
11612                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11613                        view.transfers
11614                            .push(
11615                                <super::super::__buffa::view::TransferRowView as ::buffa::MessageView>::decode_view_ctx(
11616                                    sub,
11617                                    __sub_ctx,
11618                                )?,
11619                            );
11620                    }
11621                    _ => {
11622                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11623                        let span_len = before_tag.len() - cur.len();
11624                        view.__buffa_unknown_fields
11625                            .push_record(before_tag, span_len, ctx)?;
11626                    }
11627                }
11628                ::core::result::Result::Ok(cur)
11629            }
11630            fn to_owned_message(
11631                &self,
11632            ) -> ::core::result::Result<
11633                super::super::ListTransfersResponse,
11634                ::buffa::DecodeError,
11635            > {
11636                self.to_owned_from_source(None)
11637            }
11638            #[allow(clippy::useless_conversion, clippy::needless_update)]
11639            fn to_owned_from_source(
11640                &self,
11641                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11642            ) -> ::core::result::Result<
11643                super::super::ListTransfersResponse,
11644                ::buffa::DecodeError,
11645            > {
11646                #[allow(unused_imports)]
11647                use ::buffa::alloc::string::ToString as _;
11648                let _ = __buffa_src;
11649                ::core::result::Result::Ok(super::super::ListTransfersResponse {
11650                    transfers: self
11651                        .transfers
11652                        .iter()
11653                        .map(|v| v.to_owned_from_source(__buffa_src))
11654                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
11655                    next_page_token: self.next_page_token.to_string(),
11656                    __buffa_unknown_fields: self
11657                        .__buffa_unknown_fields
11658                        .to_owned()?
11659                        .into(),
11660                    ..::core::default::Default::default()
11661                })
11662            }
11663        }
11664        impl<'a> ::buffa::ViewEncode<'a> for ListTransfersResponseView<'a> {
11665            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11666            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
11667                #[allow(unused_imports)]
11668                use ::buffa::Enumeration as _;
11669                let mut size = 0u32;
11670                for v in &self.transfers {
11671                    let __slot = __cache.reserve();
11672                    let inner_size = v.compute_size(__cache);
11673                    __cache.set(__slot, inner_size);
11674                    size
11675                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11676                            + inner_size;
11677                }
11678                if !self.next_page_token.is_empty() {
11679                    size
11680                        += 1u32
11681                            + ::buffa::types::string_encoded_len(&self.next_page_token)
11682                                as u32;
11683                }
11684                size += self.__buffa_unknown_fields.encoded_len() as u32;
11685                size
11686            }
11687            #[allow(clippy::needless_borrow)]
11688            fn write_to(
11689                &self,
11690                __cache: &mut ::buffa::SizeCache,
11691                buf: &mut impl ::buffa::bytes::BufMut,
11692            ) {
11693                #[allow(unused_imports)]
11694                use ::buffa::Enumeration as _;
11695                for v in &self.transfers {
11696                    ::buffa::types::put_len_delimited_header(
11697                        1u32,
11698                        __cache.consume_next(),
11699                        buf,
11700                    );
11701                    v.write_to(__cache, buf);
11702                }
11703                if !self.next_page_token.is_empty() {
11704                    ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
11705                }
11706                self.__buffa_unknown_fields.write_to(buf);
11707            }
11708        }
11709        /// Serializes this view as protobuf JSON.
11710        ///
11711        /// Implicit-presence fields with default values are omitted, `required`
11712        /// fields are always emitted, explicit-presence (`optional`) fields are
11713        /// emitted only when set, bytes fields are base64-encoded, and enum
11714        /// values are their proto name strings.
11715        ///
11716        /// This impl uses `serialize_map(None)` because the number of emitted
11717        /// fields depends on default-omission rules; serializers that require
11718        /// known map lengths (e.g. `bincode`) will return a runtime error.
11719        /// Use the owned message type for those formats.
11720        impl<'__a> ::serde::Serialize for ListTransfersResponseView<'__a> {
11721            fn serialize<__S: ::serde::Serializer>(
11722                &self,
11723                __s: __S,
11724            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11725                use ::serde::ser::SerializeMap as _;
11726                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11727                if !self.transfers.is_empty() {
11728                    __map.serialize_entry("transfers", &*self.transfers)?;
11729                }
11730                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
11731                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
11732                }
11733                __map.end()
11734            }
11735        }
11736        impl<'a> ::buffa::MessageName for ListTransfersResponseView<'a> {
11737            const PACKAGE: &'static str = "ledger.read.v1";
11738            const NAME: &'static str = "ListTransfersResponse";
11739            const FULL_NAME: &'static str = "ledger.read.v1.ListTransfersResponse";
11740            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListTransfersResponse";
11741        }
11742        ::buffa::impl_default_view_instance!(ListTransfersResponseView);
11743        ::buffa::impl_view_reborrow!(ListTransfersResponseView);
11744        /** Self-contained, `'static` owned view of a `ListTransfersResponse` message.
11745
11746 Wraps [`::buffa::OwnedView`]`<`[`ListTransfersResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
11747
11748 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListTransfersResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
11749        #[derive(Clone, Debug)]
11750        pub struct ListTransfersResponseOwnedView(
11751            ::buffa::OwnedView<ListTransfersResponseView<'static>>,
11752        );
11753        impl ListTransfersResponseOwnedView {
11754            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11755            ///
11756            /// The view borrows directly from the buffer's data; the buffer is
11757            /// retained inside the returned handle.
11758            ///
11759            /// # Errors
11760            ///
11761            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11762            /// protobuf data.
11763            pub fn decode(
11764                bytes: ::buffa::bytes::Bytes,
11765            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11766                ::core::result::Result::Ok(
11767                    ListTransfersResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
11768                )
11769            }
11770            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11771            /// max message size).
11772            ///
11773            /// # Errors
11774            ///
11775            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11776            /// exceeds the configured limits.
11777            pub fn decode_with_options(
11778                bytes: ::buffa::bytes::Bytes,
11779                opts: &::buffa::DecodeOptions,
11780            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11781                ::core::result::Result::Ok(
11782                    ListTransfersResponseOwnedView(
11783                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11784                    ),
11785                )
11786            }
11787            /// Build from an owned message via an encode → decode round-trip.
11788            ///
11789            /// # Errors
11790            ///
11791            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11792            /// somehow invalid (should not happen for well-formed messages).
11793            pub fn from_owned(
11794                msg: &super::super::ListTransfersResponse,
11795            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11796                ::core::result::Result::Ok(
11797                    ListTransfersResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
11798                )
11799            }
11800            /// Borrow the full [`ListTransfersResponseView`] with its lifetime tied to `&self`.
11801            #[must_use]
11802            pub fn view(&self) -> &ListTransfersResponseView<'_> {
11803                self.0.reborrow()
11804            }
11805            /// Convert to the owned message type.
11806            ///
11807            /// # Errors
11808            ///
11809            /// Returns an error if re-materializing preserved unknown fields
11810            /// fails (e.g. the unknown-field limit is exceeded).
11811            pub fn to_owned_message(
11812                &self,
11813            ) -> ::core::result::Result<
11814                super::super::ListTransfersResponse,
11815                ::buffa::DecodeError,
11816            > {
11817                self.0.to_owned_message()
11818            }
11819            /// The underlying bytes buffer.
11820            #[must_use]
11821            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11822                self.0.bytes()
11823            }
11824            /// Consume the handle, returning the underlying bytes buffer.
11825            #[must_use]
11826            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11827                self.0.into_bytes()
11828            }
11829            /// Transfer rows in requested order.
11830            ///
11831            /// Field 1: `transfers`
11832            #[must_use]
11833            pub fn transfers(
11834                &self,
11835            ) -> &::buffa::RepeatedView<
11836                '_,
11837                super::super::__buffa::view::TransferRowView<'_>,
11838            > {
11839                &self.0.reborrow().transfers
11840            }
11841            /// Opaque cursor for the next page. Empty when no more results exist.
11842            ///
11843            /// Field 3: `next_page_token`
11844            #[must_use]
11845            pub fn next_page_token(&self) -> &'_ str {
11846                self.0.reborrow().next_page_token
11847            }
11848        }
11849        impl ::core::convert::From<
11850            ::buffa::OwnedView<ListTransfersResponseView<'static>>,
11851        > for ListTransfersResponseOwnedView {
11852            fn from(
11853                inner: ::buffa::OwnedView<ListTransfersResponseView<'static>>,
11854            ) -> Self {
11855                ListTransfersResponseOwnedView(inner)
11856            }
11857        }
11858        impl ::core::convert::From<ListTransfersResponseOwnedView>
11859        for ::buffa::OwnedView<ListTransfersResponseView<'static>> {
11860            fn from(wrapper: ListTransfersResponseOwnedView) -> Self {
11861                wrapper.0
11862            }
11863        }
11864        impl ::core::convert::AsRef<
11865            ::buffa::OwnedView<ListTransfersResponseView<'static>>,
11866        > for ListTransfersResponseOwnedView {
11867            fn as_ref(&self) -> &::buffa::OwnedView<ListTransfersResponseView<'static>> {
11868                &self.0
11869            }
11870        }
11871        impl ::buffa::HasMessageView for super::super::ListTransfersResponse {
11872            type View<'a> = ListTransfersResponseView<'a>;
11873            type ViewHandle = ListTransfersResponseOwnedView;
11874        }
11875        impl ::serde::Serialize for ListTransfersResponseOwnedView {
11876            fn serialize<__S: ::serde::Serializer>(
11877                &self,
11878                __s: __S,
11879            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11880                ::serde::Serialize::serialize(&self.0, __s)
11881            }
11882        }
11883        #[derive(Clone, Debug, Default)]
11884        pub struct ListHoldsRequestView<'a> {
11885            /// Optional sub-account to scope holds to. If omitted, holds are listed for
11886            /// the authenticated root account derived from the JWT or API key.
11887            ///
11888            /// Field 1: `subaccount_id`
11889            pub subaccount_id: ::core::option::Option<u64>,
11890            /// Maximum number of holds to return. Defaults to 100 when omitted; maximum is
11891            /// 1000.
11892            ///
11893            /// Field 2: `limit`
11894            pub limit: u32,
11895            /// true=newest first; false=oldest first.
11896            ///
11897            /// Field 3: `reversed`
11898            pub reversed: bool,
11899            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
11900            /// bound to account, sub-account scope, and sort direction.
11901            ///
11902            /// Field 4: `page_token`
11903            pub page_token: &'a str,
11904            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11905        }
11906        impl<'a> ::buffa::MessageView<'a> for ListHoldsRequestView<'a> {
11907            type Owned = super::super::ListHoldsRequest;
11908            fn decode_view(
11909                buf: &'a [u8],
11910            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11911                let __limit = ::core::cell::Cell::new(
11912                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11913                );
11914                <Self as ::buffa::MessageView>::decode_view_ctx(
11915                    buf,
11916                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11917                )
11918            }
11919            fn decode_view_with_ctx(
11920                buf: &'a [u8],
11921                ctx: ::buffa::DecodeContext<'_>,
11922            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11923                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11924            }
11925            fn merge_view_field(
11926                &mut self,
11927                tag: ::buffa::encoding::Tag,
11928                cur: &'a [u8],
11929                before_tag: &'a [u8],
11930                ctx: ::buffa::DecodeContext<'_>,
11931            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11932                let _ = ctx;
11933                #[allow(unused_variables)]
11934                let view = self;
11935                let mut cur = cur;
11936                match tag.field_number() {
11937                    1u32 => {
11938                        ::buffa::encoding::check_wire_type(
11939                            tag,
11940                            ::buffa::encoding::WireType::Fixed64,
11941                        )?;
11942                        view.subaccount_id = Some(
11943                            ::buffa::types::decode_fixed64(&mut cur)?,
11944                        );
11945                    }
11946                    2u32 => {
11947                        ::buffa::encoding::check_wire_type(
11948                            tag,
11949                            ::buffa::encoding::WireType::Varint,
11950                        )?;
11951                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
11952                    }
11953                    3u32 => {
11954                        ::buffa::encoding::check_wire_type(
11955                            tag,
11956                            ::buffa::encoding::WireType::Varint,
11957                        )?;
11958                        view.reversed = ::buffa::types::decode_bool(&mut cur)?;
11959                    }
11960                    4u32 => {
11961                        ::buffa::encoding::check_wire_type(
11962                            tag,
11963                            ::buffa::encoding::WireType::LengthDelimited,
11964                        )?;
11965                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
11966                    }
11967                    _ => {
11968                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11969                        let span_len = before_tag.len() - cur.len();
11970                        view.__buffa_unknown_fields
11971                            .push_record(before_tag, span_len, ctx)?;
11972                    }
11973                }
11974                ::core::result::Result::Ok(cur)
11975            }
11976            fn to_owned_message(
11977                &self,
11978            ) -> ::core::result::Result<
11979                super::super::ListHoldsRequest,
11980                ::buffa::DecodeError,
11981            > {
11982                self.to_owned_from_source(None)
11983            }
11984            #[allow(clippy::useless_conversion, clippy::needless_update)]
11985            fn to_owned_from_source(
11986                &self,
11987                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11988            ) -> ::core::result::Result<
11989                super::super::ListHoldsRequest,
11990                ::buffa::DecodeError,
11991            > {
11992                #[allow(unused_imports)]
11993                use ::buffa::alloc::string::ToString as _;
11994                let _ = __buffa_src;
11995                ::core::result::Result::Ok(super::super::ListHoldsRequest {
11996                    subaccount_id: self.subaccount_id,
11997                    limit: self.limit,
11998                    reversed: self.reversed,
11999                    page_token: self.page_token.to_string(),
12000                    __buffa_unknown_fields: self
12001                        .__buffa_unknown_fields
12002                        .to_owned()?
12003                        .into(),
12004                    ..::core::default::Default::default()
12005                })
12006            }
12007        }
12008        impl<'a> ::buffa::ViewEncode<'a> for ListHoldsRequestView<'a> {
12009            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12010            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
12011                #[allow(unused_imports)]
12012                use ::buffa::Enumeration as _;
12013                let mut size = 0u32;
12014                if self.subaccount_id.is_some() {
12015                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
12016                }
12017                if self.limit != 0u32 {
12018                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
12019                }
12020                if self.reversed {
12021                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
12022                }
12023                if !self.page_token.is_empty() {
12024                    size
12025                        += 1u32
12026                            + ::buffa::types::string_encoded_len(&self.page_token)
12027                                as u32;
12028                }
12029                size += self.__buffa_unknown_fields.encoded_len() as u32;
12030                size
12031            }
12032            #[allow(clippy::needless_borrow)]
12033            fn write_to(
12034                &self,
12035                _cache: &mut ::buffa::SizeCache,
12036                buf: &mut impl ::buffa::bytes::BufMut,
12037            ) {
12038                #[allow(unused_imports)]
12039                use ::buffa::Enumeration as _;
12040                if let Some(v) = self.subaccount_id {
12041                    ::buffa::types::put_fixed64_field(1u32, v, buf);
12042                }
12043                if self.limit != 0u32 {
12044                    ::buffa::types::put_uint32_field(2u32, self.limit, buf);
12045                }
12046                if self.reversed {
12047                    ::buffa::types::put_bool_field(3u32, self.reversed, buf);
12048                }
12049                if !self.page_token.is_empty() {
12050                    ::buffa::types::put_string_field(4u32, &self.page_token, buf);
12051                }
12052                self.__buffa_unknown_fields.write_to(buf);
12053            }
12054        }
12055        /// Serializes this view as protobuf JSON.
12056        ///
12057        /// Implicit-presence fields with default values are omitted, `required`
12058        /// fields are always emitted, explicit-presence (`optional`) fields are
12059        /// emitted only when set, bytes fields are base64-encoded, and enum
12060        /// values are their proto name strings.
12061        ///
12062        /// This impl uses `serialize_map(None)` because the number of emitted
12063        /// fields depends on default-omission rules; serializers that require
12064        /// known map lengths (e.g. `bincode`) will return a runtime error.
12065        /// Use the owned message type for those formats.
12066        impl<'__a> ::serde::Serialize for ListHoldsRequestView<'__a> {
12067            fn serialize<__S: ::serde::Serializer>(
12068                &self,
12069                __s: __S,
12070            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12071                use ::serde::ser::SerializeMap as _;
12072                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12073                if let ::core::option::Option::Some(__v) = self.subaccount_id {
12074                    __map
12075                        .serialize_entry(
12076                            "subaccountId",
12077                            &::buffa::json_helpers::ProtoJson(&__v),
12078                        )?;
12079                }
12080                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
12081                    __map
12082                        .serialize_entry(
12083                            "limit",
12084                            &::buffa::json_helpers::ProtoJson(&self.limit),
12085                        )?;
12086                }
12087                if self.reversed {
12088                    __map.serialize_entry("reversed", &self.reversed)?;
12089                }
12090                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
12091                    __map.serialize_entry("pageToken", self.page_token)?;
12092                }
12093                __map.end()
12094            }
12095        }
12096        impl<'a> ::buffa::MessageName for ListHoldsRequestView<'a> {
12097            const PACKAGE: &'static str = "ledger.read.v1";
12098            const NAME: &'static str = "ListHoldsRequest";
12099            const FULL_NAME: &'static str = "ledger.read.v1.ListHoldsRequest";
12100            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListHoldsRequest";
12101        }
12102        ::buffa::impl_default_view_instance!(ListHoldsRequestView);
12103        ::buffa::impl_view_reborrow!(ListHoldsRequestView);
12104        /** Self-contained, `'static` owned view of a `ListHoldsRequest` message.
12105
12106 Wraps [`::buffa::OwnedView`]`<`[`ListHoldsRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
12107
12108 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListHoldsRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
12109        #[derive(Clone, Debug)]
12110        pub struct ListHoldsRequestOwnedView(
12111            ::buffa::OwnedView<ListHoldsRequestView<'static>>,
12112        );
12113        impl ListHoldsRequestOwnedView {
12114            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12115            ///
12116            /// The view borrows directly from the buffer's data; the buffer is
12117            /// retained inside the returned handle.
12118            ///
12119            /// # Errors
12120            ///
12121            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12122            /// protobuf data.
12123            pub fn decode(
12124                bytes: ::buffa::bytes::Bytes,
12125            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12126                ::core::result::Result::Ok(
12127                    ListHoldsRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
12128                )
12129            }
12130            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12131            /// max message size).
12132            ///
12133            /// # Errors
12134            ///
12135            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12136            /// exceeds the configured limits.
12137            pub fn decode_with_options(
12138                bytes: ::buffa::bytes::Bytes,
12139                opts: &::buffa::DecodeOptions,
12140            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12141                ::core::result::Result::Ok(
12142                    ListHoldsRequestOwnedView(
12143                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12144                    ),
12145                )
12146            }
12147            /// Build from an owned message via an encode → decode round-trip.
12148            ///
12149            /// # Errors
12150            ///
12151            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12152            /// somehow invalid (should not happen for well-formed messages).
12153            pub fn from_owned(
12154                msg: &super::super::ListHoldsRequest,
12155            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12156                ::core::result::Result::Ok(
12157                    ListHoldsRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
12158                )
12159            }
12160            /// Borrow the full [`ListHoldsRequestView`] with its lifetime tied to `&self`.
12161            #[must_use]
12162            pub fn view(&self) -> &ListHoldsRequestView<'_> {
12163                self.0.reborrow()
12164            }
12165            /// Convert to the owned message type.
12166            ///
12167            /// # Errors
12168            ///
12169            /// Returns an error if re-materializing preserved unknown fields
12170            /// fails (e.g. the unknown-field limit is exceeded).
12171            pub fn to_owned_message(
12172                &self,
12173            ) -> ::core::result::Result<
12174                super::super::ListHoldsRequest,
12175                ::buffa::DecodeError,
12176            > {
12177                self.0.to_owned_message()
12178            }
12179            /// The underlying bytes buffer.
12180            #[must_use]
12181            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12182                self.0.bytes()
12183            }
12184            /// Consume the handle, returning the underlying bytes buffer.
12185            #[must_use]
12186            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12187                self.0.into_bytes()
12188            }
12189            /// Optional sub-account to scope holds to. If omitted, holds are listed for
12190            /// the authenticated root account derived from the JWT or API key.
12191            ///
12192            /// Field 1: `subaccount_id`
12193            #[must_use]
12194            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
12195                self.0.reborrow().subaccount_id
12196            }
12197            /// Maximum number of holds to return. Defaults to 100 when omitted; maximum is
12198            /// 1000.
12199            ///
12200            /// Field 2: `limit`
12201            #[must_use]
12202            pub fn limit(&self) -> u32 {
12203                self.0.reborrow().limit
12204            }
12205            /// true=newest first; false=oldest first.
12206            ///
12207            /// Field 3: `reversed`
12208            #[must_use]
12209            pub fn reversed(&self) -> bool {
12210                self.0.reborrow().reversed
12211            }
12212            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
12213            /// bound to account, sub-account scope, and sort direction.
12214            ///
12215            /// Field 4: `page_token`
12216            #[must_use]
12217            pub fn page_token(&self) -> &'_ str {
12218                self.0.reborrow().page_token
12219            }
12220        }
12221        impl ::core::convert::From<::buffa::OwnedView<ListHoldsRequestView<'static>>>
12222        for ListHoldsRequestOwnedView {
12223            fn from(inner: ::buffa::OwnedView<ListHoldsRequestView<'static>>) -> Self {
12224                ListHoldsRequestOwnedView(inner)
12225            }
12226        }
12227        impl ::core::convert::From<ListHoldsRequestOwnedView>
12228        for ::buffa::OwnedView<ListHoldsRequestView<'static>> {
12229            fn from(wrapper: ListHoldsRequestOwnedView) -> Self {
12230                wrapper.0
12231            }
12232        }
12233        impl ::core::convert::AsRef<::buffa::OwnedView<ListHoldsRequestView<'static>>>
12234        for ListHoldsRequestOwnedView {
12235            fn as_ref(&self) -> &::buffa::OwnedView<ListHoldsRequestView<'static>> {
12236                &self.0
12237            }
12238        }
12239        impl ::buffa::HasMessageView for super::super::ListHoldsRequest {
12240            type View<'a> = ListHoldsRequestView<'a>;
12241            type ViewHandle = ListHoldsRequestOwnedView;
12242        }
12243        impl ::serde::Serialize for ListHoldsRequestOwnedView {
12244            fn serialize<__S: ::serde::Serializer>(
12245                &self,
12246                __s: __S,
12247            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12248                ::serde::Serialize::serialize(&self.0, __s)
12249            }
12250        }
12251        /// Hold row with compact integers and client-side resolution.
12252        #[derive(Clone, Debug, Default)]
12253        pub struct HoldRowView<'a> {
12254            /// pending transfer id (numeric)
12255            ///
12256            /// Field 1: `hold_id`
12257            pub hold_id: u64,
12258            /// Reserved amount at fixed 18-decimal ledger scale.
12259            ///
12260            /// Field 2: `amount_reserved_e18`
12261            pub amount_reserved_e18: ::buffa::MessageFieldView<
12262                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
12263                    'a,
12264                >,
12265            >,
12266            /// Public unified asset id.
12267            ///
12268            /// Field 3: `asset_id`
12269            pub asset_id: u32,
12270            /// Expiration time in nanoseconds since epoch (UTC).
12271            ///
12272            /// Field 4: `expires_at_ns`
12273            pub expires_at_ns: u64,
12274            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12275        }
12276        impl<'a> ::buffa::MessageView<'a> for HoldRowView<'a> {
12277            type Owned = super::super::HoldRow;
12278            fn decode_view(
12279                buf: &'a [u8],
12280            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12281                let __limit = ::core::cell::Cell::new(
12282                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12283                );
12284                <Self as ::buffa::MessageView>::decode_view_ctx(
12285                    buf,
12286                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12287                )
12288            }
12289            fn decode_view_with_ctx(
12290                buf: &'a [u8],
12291                ctx: ::buffa::DecodeContext<'_>,
12292            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12293                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12294            }
12295            fn merge_view_field(
12296                &mut self,
12297                tag: ::buffa::encoding::Tag,
12298                cur: &'a [u8],
12299                before_tag: &'a [u8],
12300                ctx: ::buffa::DecodeContext<'_>,
12301            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12302                let _ = ctx;
12303                #[allow(unused_variables)]
12304                let view = self;
12305                let mut cur = cur;
12306                match tag.field_number() {
12307                    1u32 => {
12308                        ::buffa::encoding::check_wire_type(
12309                            tag,
12310                            ::buffa::encoding::WireType::Fixed64,
12311                        )?;
12312                        view.hold_id = ::buffa::types::decode_fixed64(&mut cur)?;
12313                    }
12314                    2u32 => {
12315                        ::buffa::encoding::check_wire_type(
12316                            tag,
12317                            ::buffa::encoding::WireType::LengthDelimited,
12318                        )?;
12319                        let __sub_ctx = ctx.descend()?;
12320                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12321                        match view.amount_reserved_e18.as_mut() {
12322                            Some(existing) => {
12323                                ::buffa::MessageView::merge_into_view(
12324                                    existing,
12325                                    sub,
12326                                    __sub_ctx,
12327                                )?
12328                            }
12329                            None => {
12330                                view.amount_reserved_e18 = ::buffa::MessageFieldView::set(
12331                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
12332                                        sub,
12333                                        __sub_ctx,
12334                                    )?,
12335                                );
12336                            }
12337                        }
12338                    }
12339                    3u32 => {
12340                        ::buffa::encoding::check_wire_type(
12341                            tag,
12342                            ::buffa::encoding::WireType::Varint,
12343                        )?;
12344                        view.asset_id = ::buffa::types::decode_uint32(&mut cur)?;
12345                    }
12346                    4u32 => {
12347                        ::buffa::encoding::check_wire_type(
12348                            tag,
12349                            ::buffa::encoding::WireType::Varint,
12350                        )?;
12351                        view.expires_at_ns = ::buffa::types::decode_uint64(&mut cur)?;
12352                    }
12353                    _ => {
12354                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12355                        let span_len = before_tag.len() - cur.len();
12356                        view.__buffa_unknown_fields
12357                            .push_record(before_tag, span_len, ctx)?;
12358                    }
12359                }
12360                ::core::result::Result::Ok(cur)
12361            }
12362            fn to_owned_message(
12363                &self,
12364            ) -> ::core::result::Result<super::super::HoldRow, ::buffa::DecodeError> {
12365                self.to_owned_from_source(None)
12366            }
12367            #[allow(clippy::useless_conversion, clippy::needless_update)]
12368            fn to_owned_from_source(
12369                &self,
12370                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12371            ) -> ::core::result::Result<super::super::HoldRow, ::buffa::DecodeError> {
12372                #[allow(unused_imports)]
12373                use ::buffa::alloc::string::ToString as _;
12374                let _ = __buffa_src;
12375                ::core::result::Result::Ok(super::super::HoldRow {
12376                    hold_id: self.hold_id,
12377                    amount_reserved_e18: match self.amount_reserved_e18.as_option() {
12378                        Some(v) => {
12379                            ::buffa::MessageField::<
12380                                super::super::super::super::super::polyester::r#type::v1::U128,
12381                            >::some(v.to_owned_from_source(__buffa_src)?)
12382                        }
12383                        None => ::buffa::MessageField::none(),
12384                    },
12385                    asset_id: self.asset_id,
12386                    expires_at_ns: self.expires_at_ns,
12387                    __buffa_unknown_fields: self
12388                        .__buffa_unknown_fields
12389                        .to_owned()?
12390                        .into(),
12391                    ..::core::default::Default::default()
12392                })
12393            }
12394        }
12395        impl<'a> ::buffa::ViewEncode<'a> for HoldRowView<'a> {
12396            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12397            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12398                #[allow(unused_imports)]
12399                use ::buffa::Enumeration as _;
12400                let mut size = 0u32;
12401                if self.hold_id != 0u64 {
12402                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
12403                }
12404                if self.amount_reserved_e18.is_set() {
12405                    let __slot = __cache.reserve();
12406                    let inner_size = self.amount_reserved_e18.compute_size(__cache);
12407                    __cache.set(__slot, inner_size);
12408                    size
12409                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12410                            + inner_size;
12411                }
12412                if self.asset_id != 0u32 {
12413                    size
12414                        += 1u32
12415                            + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
12416                }
12417                if self.expires_at_ns != 0u64 {
12418                    size
12419                        += 1u32
12420                            + ::buffa::types::uint64_encoded_len(self.expires_at_ns)
12421                                as u32;
12422                }
12423                size += self.__buffa_unknown_fields.encoded_len() as u32;
12424                size
12425            }
12426            #[allow(clippy::needless_borrow)]
12427            fn write_to(
12428                &self,
12429                __cache: &mut ::buffa::SizeCache,
12430                buf: &mut impl ::buffa::bytes::BufMut,
12431            ) {
12432                #[allow(unused_imports)]
12433                use ::buffa::Enumeration as _;
12434                if self.hold_id != 0u64 {
12435                    ::buffa::types::put_fixed64_field(1u32, self.hold_id, buf);
12436                }
12437                if self.amount_reserved_e18.is_set() {
12438                    ::buffa::types::put_len_delimited_header(
12439                        2u32,
12440                        __cache.consume_next(),
12441                        buf,
12442                    );
12443                    self.amount_reserved_e18.write_to(__cache, buf);
12444                }
12445                if self.asset_id != 0u32 {
12446                    ::buffa::types::put_uint32_field(3u32, self.asset_id, buf);
12447                }
12448                if self.expires_at_ns != 0u64 {
12449                    ::buffa::types::put_uint64_field(4u32, self.expires_at_ns, buf);
12450                }
12451                self.__buffa_unknown_fields.write_to(buf);
12452            }
12453        }
12454        /// Serializes this view as protobuf JSON.
12455        ///
12456        /// Implicit-presence fields with default values are omitted, `required`
12457        /// fields are always emitted, explicit-presence (`optional`) fields are
12458        /// emitted only when set, bytes fields are base64-encoded, and enum
12459        /// values are their proto name strings.
12460        ///
12461        /// This impl uses `serialize_map(None)` because the number of emitted
12462        /// fields depends on default-omission rules; serializers that require
12463        /// known map lengths (e.g. `bincode`) will return a runtime error.
12464        /// Use the owned message type for those formats.
12465        impl<'__a> ::serde::Serialize for HoldRowView<'__a> {
12466            fn serialize<__S: ::serde::Serializer>(
12467                &self,
12468                __s: __S,
12469            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12470                use ::serde::ser::SerializeMap as _;
12471                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12472                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.hold_id) {
12473                    __map
12474                        .serialize_entry(
12475                            "holdId",
12476                            &::buffa::json_helpers::ProtoJson(&self.hold_id),
12477                        )?;
12478                }
12479                {
12480                    if let ::core::option::Option::Some(__v) = self
12481                        .amount_reserved_e18
12482                        .as_option()
12483                    {
12484                        __map.serialize_entry("amountReservedE18", __v)?;
12485                    }
12486                }
12487                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.asset_id) {
12488                    __map
12489                        .serialize_entry(
12490                            "assetId",
12491                            &::buffa::json_helpers::ProtoJson(&self.asset_id),
12492                        )?;
12493                }
12494                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.expires_at_ns) {
12495                    __map
12496                        .serialize_entry(
12497                            "expiresAtNs",
12498                            &::buffa::json_helpers::ProtoJson(&self.expires_at_ns),
12499                        )?;
12500                }
12501                __map.end()
12502            }
12503        }
12504        impl<'a> ::buffa::MessageName for HoldRowView<'a> {
12505            const PACKAGE: &'static str = "ledger.read.v1";
12506            const NAME: &'static str = "HoldRow";
12507            const FULL_NAME: &'static str = "ledger.read.v1.HoldRow";
12508            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.HoldRow";
12509        }
12510        ::buffa::impl_default_view_instance!(HoldRowView);
12511        ::buffa::impl_view_reborrow!(HoldRowView);
12512        /** Self-contained, `'static` owned view of a `HoldRow` message.
12513
12514 Wraps [`::buffa::OwnedView`]`<`[`HoldRowView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
12515
12516 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HoldRowView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
12517        #[derive(Clone, Debug)]
12518        pub struct HoldRowOwnedView(::buffa::OwnedView<HoldRowView<'static>>);
12519        impl HoldRowOwnedView {
12520            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12521            ///
12522            /// The view borrows directly from the buffer's data; the buffer is
12523            /// retained inside the returned handle.
12524            ///
12525            /// # Errors
12526            ///
12527            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12528            /// protobuf data.
12529            pub fn decode(
12530                bytes: ::buffa::bytes::Bytes,
12531            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12532                ::core::result::Result::Ok(
12533                    HoldRowOwnedView(::buffa::OwnedView::decode(bytes)?),
12534                )
12535            }
12536            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12537            /// max message size).
12538            ///
12539            /// # Errors
12540            ///
12541            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12542            /// exceeds the configured limits.
12543            pub fn decode_with_options(
12544                bytes: ::buffa::bytes::Bytes,
12545                opts: &::buffa::DecodeOptions,
12546            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12547                ::core::result::Result::Ok(
12548                    HoldRowOwnedView(
12549                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12550                    ),
12551                )
12552            }
12553            /// Build from an owned message via an encode → decode round-trip.
12554            ///
12555            /// # Errors
12556            ///
12557            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12558            /// somehow invalid (should not happen for well-formed messages).
12559            pub fn from_owned(
12560                msg: &super::super::HoldRow,
12561            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12562                ::core::result::Result::Ok(
12563                    HoldRowOwnedView(::buffa::OwnedView::from_owned(msg)?),
12564                )
12565            }
12566            /// Borrow the full [`HoldRowView`] with its lifetime tied to `&self`.
12567            #[must_use]
12568            pub fn view(&self) -> &HoldRowView<'_> {
12569                self.0.reborrow()
12570            }
12571            /// Convert to the owned message type.
12572            ///
12573            /// # Errors
12574            ///
12575            /// Returns an error if re-materializing preserved unknown fields
12576            /// fails (e.g. the unknown-field limit is exceeded).
12577            pub fn to_owned_message(
12578                &self,
12579            ) -> ::core::result::Result<super::super::HoldRow, ::buffa::DecodeError> {
12580                self.0.to_owned_message()
12581            }
12582            /// The underlying bytes buffer.
12583            #[must_use]
12584            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12585                self.0.bytes()
12586            }
12587            /// Consume the handle, returning the underlying bytes buffer.
12588            #[must_use]
12589            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12590                self.0.into_bytes()
12591            }
12592            /// pending transfer id (numeric)
12593            ///
12594            /// Field 1: `hold_id`
12595            #[must_use]
12596            pub fn hold_id(&self) -> u64 {
12597                self.0.reborrow().hold_id
12598            }
12599            /// Reserved amount at fixed 18-decimal ledger scale.
12600            ///
12601            /// Field 2: `amount_reserved_e18`
12602            #[must_use]
12603            pub fn amount_reserved_e18(
12604                &self,
12605            ) -> &::buffa::MessageFieldView<
12606                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
12607                    '_,
12608                >,
12609            > {
12610                &self.0.reborrow().amount_reserved_e18
12611            }
12612            /// Public unified asset id.
12613            ///
12614            /// Field 3: `asset_id`
12615            #[must_use]
12616            pub fn asset_id(&self) -> u32 {
12617                self.0.reborrow().asset_id
12618            }
12619            /// Expiration time in nanoseconds since epoch (UTC).
12620            ///
12621            /// Field 4: `expires_at_ns`
12622            #[must_use]
12623            pub fn expires_at_ns(&self) -> u64 {
12624                self.0.reborrow().expires_at_ns
12625            }
12626        }
12627        impl ::core::convert::From<::buffa::OwnedView<HoldRowView<'static>>>
12628        for HoldRowOwnedView {
12629            fn from(inner: ::buffa::OwnedView<HoldRowView<'static>>) -> Self {
12630                HoldRowOwnedView(inner)
12631            }
12632        }
12633        impl ::core::convert::From<HoldRowOwnedView>
12634        for ::buffa::OwnedView<HoldRowView<'static>> {
12635            fn from(wrapper: HoldRowOwnedView) -> Self {
12636                wrapper.0
12637            }
12638        }
12639        impl ::core::convert::AsRef<::buffa::OwnedView<HoldRowView<'static>>>
12640        for HoldRowOwnedView {
12641            fn as_ref(&self) -> &::buffa::OwnedView<HoldRowView<'static>> {
12642                &self.0
12643            }
12644        }
12645        impl ::buffa::HasMessageView for super::super::HoldRow {
12646            type View<'a> = HoldRowView<'a>;
12647            type ViewHandle = HoldRowOwnedView;
12648        }
12649        impl ::serde::Serialize for HoldRowOwnedView {
12650            fn serialize<__S: ::serde::Serializer>(
12651                &self,
12652                __s: __S,
12653            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12654                ::serde::Serialize::serialize(&self.0, __s)
12655            }
12656        }
12657        #[derive(Clone, Debug, Default)]
12658        pub struct ListHoldsResponseView<'a> {
12659            /// Hold rows in the sort direction requested by the caller.
12660            ///
12661            /// Field 1: `holds`
12662            pub holds: ::buffa::RepeatedView<
12663                'a,
12664                super::super::__buffa::view::HoldRowView<'a>,
12665            >,
12666            /// Opaque cursor for the next page. Empty when no more results exist.
12667            ///
12668            /// Field 2: `next_page_token`
12669            pub next_page_token: &'a str,
12670            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12671        }
12672        impl<'a> ::buffa::MessageView<'a> for ListHoldsResponseView<'a> {
12673            type Owned = super::super::ListHoldsResponse;
12674            fn decode_view(
12675                buf: &'a [u8],
12676            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12677                let __limit = ::core::cell::Cell::new(
12678                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12679                );
12680                <Self as ::buffa::MessageView>::decode_view_ctx(
12681                    buf,
12682                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12683                )
12684            }
12685            fn decode_view_with_ctx(
12686                buf: &'a [u8],
12687                ctx: ::buffa::DecodeContext<'_>,
12688            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12689                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12690            }
12691            fn merge_view_field(
12692                &mut self,
12693                tag: ::buffa::encoding::Tag,
12694                cur: &'a [u8],
12695                before_tag: &'a [u8],
12696                ctx: ::buffa::DecodeContext<'_>,
12697            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12698                let _ = ctx;
12699                #[allow(unused_variables)]
12700                let view = self;
12701                let mut cur = cur;
12702                match tag.field_number() {
12703                    2u32 => {
12704                        ::buffa::encoding::check_wire_type(
12705                            tag,
12706                            ::buffa::encoding::WireType::LengthDelimited,
12707                        )?;
12708                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
12709                    }
12710                    1u32 => {
12711                        ::buffa::encoding::check_wire_type(
12712                            tag,
12713                            ::buffa::encoding::WireType::LengthDelimited,
12714                        )?;
12715                        let __sub_ctx = ctx.descend()?;
12716                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12717                        view.holds
12718                            .push(
12719                                <super::super::__buffa::view::HoldRowView as ::buffa::MessageView>::decode_view_ctx(
12720                                    sub,
12721                                    __sub_ctx,
12722                                )?,
12723                            );
12724                    }
12725                    _ => {
12726                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12727                        let span_len = before_tag.len() - cur.len();
12728                        view.__buffa_unknown_fields
12729                            .push_record(before_tag, span_len, ctx)?;
12730                    }
12731                }
12732                ::core::result::Result::Ok(cur)
12733            }
12734            fn to_owned_message(
12735                &self,
12736            ) -> ::core::result::Result<
12737                super::super::ListHoldsResponse,
12738                ::buffa::DecodeError,
12739            > {
12740                self.to_owned_from_source(None)
12741            }
12742            #[allow(clippy::useless_conversion, clippy::needless_update)]
12743            fn to_owned_from_source(
12744                &self,
12745                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12746            ) -> ::core::result::Result<
12747                super::super::ListHoldsResponse,
12748                ::buffa::DecodeError,
12749            > {
12750                #[allow(unused_imports)]
12751                use ::buffa::alloc::string::ToString as _;
12752                let _ = __buffa_src;
12753                ::core::result::Result::Ok(super::super::ListHoldsResponse {
12754                    holds: self
12755                        .holds
12756                        .iter()
12757                        .map(|v| v.to_owned_from_source(__buffa_src))
12758                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
12759                    next_page_token: self.next_page_token.to_string(),
12760                    __buffa_unknown_fields: self
12761                        .__buffa_unknown_fields
12762                        .to_owned()?
12763                        .into(),
12764                    ..::core::default::Default::default()
12765                })
12766            }
12767        }
12768        impl<'a> ::buffa::ViewEncode<'a> for ListHoldsResponseView<'a> {
12769            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12770            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12771                #[allow(unused_imports)]
12772                use ::buffa::Enumeration as _;
12773                let mut size = 0u32;
12774                for v in &self.holds {
12775                    let __slot = __cache.reserve();
12776                    let inner_size = v.compute_size(__cache);
12777                    __cache.set(__slot, inner_size);
12778                    size
12779                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12780                            + inner_size;
12781                }
12782                if !self.next_page_token.is_empty() {
12783                    size
12784                        += 1u32
12785                            + ::buffa::types::string_encoded_len(&self.next_page_token)
12786                                as u32;
12787                }
12788                size += self.__buffa_unknown_fields.encoded_len() as u32;
12789                size
12790            }
12791            #[allow(clippy::needless_borrow)]
12792            fn write_to(
12793                &self,
12794                __cache: &mut ::buffa::SizeCache,
12795                buf: &mut impl ::buffa::bytes::BufMut,
12796            ) {
12797                #[allow(unused_imports)]
12798                use ::buffa::Enumeration as _;
12799                for v in &self.holds {
12800                    ::buffa::types::put_len_delimited_header(
12801                        1u32,
12802                        __cache.consume_next(),
12803                        buf,
12804                    );
12805                    v.write_to(__cache, buf);
12806                }
12807                if !self.next_page_token.is_empty() {
12808                    ::buffa::types::put_string_field(2u32, &self.next_page_token, buf);
12809                }
12810                self.__buffa_unknown_fields.write_to(buf);
12811            }
12812        }
12813        /// Serializes this view as protobuf JSON.
12814        ///
12815        /// Implicit-presence fields with default values are omitted, `required`
12816        /// fields are always emitted, explicit-presence (`optional`) fields are
12817        /// emitted only when set, bytes fields are base64-encoded, and enum
12818        /// values are their proto name strings.
12819        ///
12820        /// This impl uses `serialize_map(None)` because the number of emitted
12821        /// fields depends on default-omission rules; serializers that require
12822        /// known map lengths (e.g. `bincode`) will return a runtime error.
12823        /// Use the owned message type for those formats.
12824        impl<'__a> ::serde::Serialize for ListHoldsResponseView<'__a> {
12825            fn serialize<__S: ::serde::Serializer>(
12826                &self,
12827                __s: __S,
12828            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12829                use ::serde::ser::SerializeMap as _;
12830                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12831                if !self.holds.is_empty() {
12832                    __map.serialize_entry("holds", &*self.holds)?;
12833                }
12834                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
12835                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
12836                }
12837                __map.end()
12838            }
12839        }
12840        impl<'a> ::buffa::MessageName for ListHoldsResponseView<'a> {
12841            const PACKAGE: &'static str = "ledger.read.v1";
12842            const NAME: &'static str = "ListHoldsResponse";
12843            const FULL_NAME: &'static str = "ledger.read.v1.ListHoldsResponse";
12844            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ListHoldsResponse";
12845        }
12846        ::buffa::impl_default_view_instance!(ListHoldsResponseView);
12847        ::buffa::impl_view_reborrow!(ListHoldsResponseView);
12848        /** Self-contained, `'static` owned view of a `ListHoldsResponse` message.
12849
12850 Wraps [`::buffa::OwnedView`]`<`[`ListHoldsResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
12851
12852 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListHoldsResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
12853        #[derive(Clone, Debug)]
12854        pub struct ListHoldsResponseOwnedView(
12855            ::buffa::OwnedView<ListHoldsResponseView<'static>>,
12856        );
12857        impl ListHoldsResponseOwnedView {
12858            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12859            ///
12860            /// The view borrows directly from the buffer's data; the buffer is
12861            /// retained inside the returned handle.
12862            ///
12863            /// # Errors
12864            ///
12865            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12866            /// protobuf data.
12867            pub fn decode(
12868                bytes: ::buffa::bytes::Bytes,
12869            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12870                ::core::result::Result::Ok(
12871                    ListHoldsResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
12872                )
12873            }
12874            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12875            /// max message size).
12876            ///
12877            /// # Errors
12878            ///
12879            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12880            /// exceeds the configured limits.
12881            pub fn decode_with_options(
12882                bytes: ::buffa::bytes::Bytes,
12883                opts: &::buffa::DecodeOptions,
12884            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12885                ::core::result::Result::Ok(
12886                    ListHoldsResponseOwnedView(
12887                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12888                    ),
12889                )
12890            }
12891            /// Build from an owned message via an encode → decode round-trip.
12892            ///
12893            /// # Errors
12894            ///
12895            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12896            /// somehow invalid (should not happen for well-formed messages).
12897            pub fn from_owned(
12898                msg: &super::super::ListHoldsResponse,
12899            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12900                ::core::result::Result::Ok(
12901                    ListHoldsResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
12902                )
12903            }
12904            /// Borrow the full [`ListHoldsResponseView`] with its lifetime tied to `&self`.
12905            #[must_use]
12906            pub fn view(&self) -> &ListHoldsResponseView<'_> {
12907                self.0.reborrow()
12908            }
12909            /// Convert to the owned message type.
12910            ///
12911            /// # Errors
12912            ///
12913            /// Returns an error if re-materializing preserved unknown fields
12914            /// fails (e.g. the unknown-field limit is exceeded).
12915            pub fn to_owned_message(
12916                &self,
12917            ) -> ::core::result::Result<
12918                super::super::ListHoldsResponse,
12919                ::buffa::DecodeError,
12920            > {
12921                self.0.to_owned_message()
12922            }
12923            /// The underlying bytes buffer.
12924            #[must_use]
12925            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12926                self.0.bytes()
12927            }
12928            /// Consume the handle, returning the underlying bytes buffer.
12929            #[must_use]
12930            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12931                self.0.into_bytes()
12932            }
12933            /// Hold rows in the sort direction requested by the caller.
12934            ///
12935            /// Field 1: `holds`
12936            #[must_use]
12937            pub fn holds(
12938                &self,
12939            ) -> &::buffa::RepeatedView<
12940                '_,
12941                super::super::__buffa::view::HoldRowView<'_>,
12942            > {
12943                &self.0.reborrow().holds
12944            }
12945            /// Opaque cursor for the next page. Empty when no more results exist.
12946            ///
12947            /// Field 2: `next_page_token`
12948            #[must_use]
12949            pub fn next_page_token(&self) -> &'_ str {
12950                self.0.reborrow().next_page_token
12951            }
12952        }
12953        impl ::core::convert::From<::buffa::OwnedView<ListHoldsResponseView<'static>>>
12954        for ListHoldsResponseOwnedView {
12955            fn from(inner: ::buffa::OwnedView<ListHoldsResponseView<'static>>) -> Self {
12956                ListHoldsResponseOwnedView(inner)
12957            }
12958        }
12959        impl ::core::convert::From<ListHoldsResponseOwnedView>
12960        for ::buffa::OwnedView<ListHoldsResponseView<'static>> {
12961            fn from(wrapper: ListHoldsResponseOwnedView) -> Self {
12962                wrapper.0
12963            }
12964        }
12965        impl ::core::convert::AsRef<::buffa::OwnedView<ListHoldsResponseView<'static>>>
12966        for ListHoldsResponseOwnedView {
12967            fn as_ref(&self) -> &::buffa::OwnedView<ListHoldsResponseView<'static>> {
12968                &self.0
12969            }
12970        }
12971        impl ::buffa::HasMessageView for super::super::ListHoldsResponse {
12972            type View<'a> = ListHoldsResponseView<'a>;
12973            type ViewHandle = ListHoldsResponseOwnedView;
12974        }
12975        impl ::serde::Serialize for ListHoldsResponseOwnedView {
12976            fn serialize<__S: ::serde::Serializer>(
12977                &self,
12978                __s: __S,
12979            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12980                ::serde::Serialize::serialize(&self.0, __s)
12981            }
12982        }
12983        /// ErrorDetail is attached to ConnectRPC errors for structured error handling.
12984        /// Clients can inspect this to get a stable machine-readable error code.
12985        #[derive(Clone, Debug, Default)]
12986        pub struct ErrorDetailView<'a> {
12987            /// Stable error code matching the REST problem+json "code" field.
12988            ///
12989            /// Field 1: `code`
12990            pub code: ::buffa::EnumValue<super::super::ErrorCode>,
12991            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12992        }
12993        impl<'a> ::buffa::MessageView<'a> for ErrorDetailView<'a> {
12994            type Owned = super::super::ErrorDetail;
12995            fn decode_view(
12996                buf: &'a [u8],
12997            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12998                let __limit = ::core::cell::Cell::new(
12999                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13000                );
13001                <Self as ::buffa::MessageView>::decode_view_ctx(
13002                    buf,
13003                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13004                )
13005            }
13006            fn decode_view_with_ctx(
13007                buf: &'a [u8],
13008                ctx: ::buffa::DecodeContext<'_>,
13009            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13010                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13011            }
13012            fn merge_view_field(
13013                &mut self,
13014                tag: ::buffa::encoding::Tag,
13015                cur: &'a [u8],
13016                before_tag: &'a [u8],
13017                ctx: ::buffa::DecodeContext<'_>,
13018            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13019                let _ = ctx;
13020                #[allow(unused_variables)]
13021                let view = self;
13022                let mut cur = cur;
13023                match tag.field_number() {
13024                    1u32 => {
13025                        ::buffa::encoding::check_wire_type(
13026                            tag,
13027                            ::buffa::encoding::WireType::Varint,
13028                        )?;
13029                        view.code = ::buffa::EnumValue::from(
13030                            ::buffa::types::decode_int32(&mut cur)?,
13031                        );
13032                    }
13033                    _ => {
13034                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13035                        let span_len = before_tag.len() - cur.len();
13036                        view.__buffa_unknown_fields
13037                            .push_record(before_tag, span_len, ctx)?;
13038                    }
13039                }
13040                ::core::result::Result::Ok(cur)
13041            }
13042            fn to_owned_message(
13043                &self,
13044            ) -> ::core::result::Result<
13045                super::super::ErrorDetail,
13046                ::buffa::DecodeError,
13047            > {
13048                self.to_owned_from_source(None)
13049            }
13050            #[allow(clippy::useless_conversion, clippy::needless_update)]
13051            fn to_owned_from_source(
13052                &self,
13053                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13054            ) -> ::core::result::Result<
13055                super::super::ErrorDetail,
13056                ::buffa::DecodeError,
13057            > {
13058                #[allow(unused_imports)]
13059                use ::buffa::alloc::string::ToString as _;
13060                let _ = __buffa_src;
13061                ::core::result::Result::Ok(super::super::ErrorDetail {
13062                    code: self.code,
13063                    __buffa_unknown_fields: self
13064                        .__buffa_unknown_fields
13065                        .to_owned()?
13066                        .into(),
13067                    ..::core::default::Default::default()
13068                })
13069            }
13070        }
13071        impl<'a> ::buffa::ViewEncode<'a> for ErrorDetailView<'a> {
13072            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13073            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13074                #[allow(unused_imports)]
13075                use ::buffa::Enumeration as _;
13076                let mut size = 0u32;
13077                {
13078                    let val = self.code.to_i32();
13079                    if val != 0 {
13080                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
13081                    }
13082                }
13083                size += self.__buffa_unknown_fields.encoded_len() as u32;
13084                size
13085            }
13086            #[allow(clippy::needless_borrow)]
13087            fn write_to(
13088                &self,
13089                _cache: &mut ::buffa::SizeCache,
13090                buf: &mut impl ::buffa::bytes::BufMut,
13091            ) {
13092                #[allow(unused_imports)]
13093                use ::buffa::Enumeration as _;
13094                {
13095                    let val = self.code.to_i32();
13096                    if val != 0 {
13097                        ::buffa::types::put_int32_field(1u32, val, buf);
13098                    }
13099                }
13100                self.__buffa_unknown_fields.write_to(buf);
13101            }
13102        }
13103        /// Serializes this view as protobuf JSON.
13104        ///
13105        /// Implicit-presence fields with default values are omitted, `required`
13106        /// fields are always emitted, explicit-presence (`optional`) fields are
13107        /// emitted only when set, bytes fields are base64-encoded, and enum
13108        /// values are their proto name strings.
13109        ///
13110        /// This impl uses `serialize_map(None)` because the number of emitted
13111        /// fields depends on default-omission rules; serializers that require
13112        /// known map lengths (e.g. `bincode`) will return a runtime error.
13113        /// Use the owned message type for those formats.
13114        impl<'__a> ::serde::Serialize for ErrorDetailView<'__a> {
13115            fn serialize<__S: ::serde::Serializer>(
13116                &self,
13117                __s: __S,
13118            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13119                use ::serde::ser::SerializeMap as _;
13120                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13121                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.code) {
13122                    __map.serialize_entry("code", &self.code)?;
13123                }
13124                __map.end()
13125            }
13126        }
13127        impl<'a> ::buffa::MessageName for ErrorDetailView<'a> {
13128            const PACKAGE: &'static str = "ledger.read.v1";
13129            const NAME: &'static str = "ErrorDetail";
13130            const FULL_NAME: &'static str = "ledger.read.v1.ErrorDetail";
13131            const TYPE_URL: &'static str = "type.googleapis.com/ledger.read.v1.ErrorDetail";
13132        }
13133        ::buffa::impl_default_view_instance!(ErrorDetailView);
13134        ::buffa::impl_view_reborrow!(ErrorDetailView);
13135        /** Self-contained, `'static` owned view of a `ErrorDetail` message.
13136
13137 Wraps [`::buffa::OwnedView`]`<`[`ErrorDetailView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
13138
13139 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ErrorDetailView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
13140        #[derive(Clone, Debug)]
13141        pub struct ErrorDetailOwnedView(::buffa::OwnedView<ErrorDetailView<'static>>);
13142        impl ErrorDetailOwnedView {
13143            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13144            ///
13145            /// The view borrows directly from the buffer's data; the buffer is
13146            /// retained inside the returned handle.
13147            ///
13148            /// # Errors
13149            ///
13150            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13151            /// protobuf data.
13152            pub fn decode(
13153                bytes: ::buffa::bytes::Bytes,
13154            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13155                ::core::result::Result::Ok(
13156                    ErrorDetailOwnedView(::buffa::OwnedView::decode(bytes)?),
13157                )
13158            }
13159            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13160            /// max message size).
13161            ///
13162            /// # Errors
13163            ///
13164            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13165            /// exceeds the configured limits.
13166            pub fn decode_with_options(
13167                bytes: ::buffa::bytes::Bytes,
13168                opts: &::buffa::DecodeOptions,
13169            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13170                ::core::result::Result::Ok(
13171                    ErrorDetailOwnedView(
13172                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13173                    ),
13174                )
13175            }
13176            /// Build from an owned message via an encode → decode round-trip.
13177            ///
13178            /// # Errors
13179            ///
13180            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13181            /// somehow invalid (should not happen for well-formed messages).
13182            pub fn from_owned(
13183                msg: &super::super::ErrorDetail,
13184            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13185                ::core::result::Result::Ok(
13186                    ErrorDetailOwnedView(::buffa::OwnedView::from_owned(msg)?),
13187                )
13188            }
13189            /// Borrow the full [`ErrorDetailView`] with its lifetime tied to `&self`.
13190            #[must_use]
13191            pub fn view(&self) -> &ErrorDetailView<'_> {
13192                self.0.reborrow()
13193            }
13194            /// Convert to the owned message type.
13195            ///
13196            /// # Errors
13197            ///
13198            /// Returns an error if re-materializing preserved unknown fields
13199            /// fails (e.g. the unknown-field limit is exceeded).
13200            pub fn to_owned_message(
13201                &self,
13202            ) -> ::core::result::Result<
13203                super::super::ErrorDetail,
13204                ::buffa::DecodeError,
13205            > {
13206                self.0.to_owned_message()
13207            }
13208            /// The underlying bytes buffer.
13209            #[must_use]
13210            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13211                self.0.bytes()
13212            }
13213            /// Consume the handle, returning the underlying bytes buffer.
13214            #[must_use]
13215            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13216                self.0.into_bytes()
13217            }
13218            /// Stable error code matching the REST problem+json "code" field.
13219            ///
13220            /// Field 1: `code`
13221            #[must_use]
13222            pub fn code(&self) -> ::buffa::EnumValue<super::super::ErrorCode> {
13223                self.0.reborrow().code
13224            }
13225        }
13226        impl ::core::convert::From<::buffa::OwnedView<ErrorDetailView<'static>>>
13227        for ErrorDetailOwnedView {
13228            fn from(inner: ::buffa::OwnedView<ErrorDetailView<'static>>) -> Self {
13229                ErrorDetailOwnedView(inner)
13230            }
13231        }
13232        impl ::core::convert::From<ErrorDetailOwnedView>
13233        for ::buffa::OwnedView<ErrorDetailView<'static>> {
13234            fn from(wrapper: ErrorDetailOwnedView) -> Self {
13235                wrapper.0
13236            }
13237        }
13238        impl ::core::convert::AsRef<::buffa::OwnedView<ErrorDetailView<'static>>>
13239        for ErrorDetailOwnedView {
13240            fn as_ref(&self) -> &::buffa::OwnedView<ErrorDetailView<'static>> {
13241                &self.0
13242            }
13243        }
13244        impl ::buffa::HasMessageView for super::super::ErrorDetail {
13245            type View<'a> = ErrorDetailView<'a>;
13246            type ViewHandle = ErrorDetailOwnedView;
13247        }
13248        impl ::serde::Serialize for ErrorDetailOwnedView {
13249            fn serialize<__S: ::serde::Serializer>(
13250                &self,
13251                __s: __S,
13252            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13253                ::serde::Serialize::serialize(&self.0, __s)
13254            }
13255        }
13256        pub mod oneof {
13257            #[allow(unused_imports)]
13258            use super::*;
13259            pub mod equity_series {
13260                #[allow(unused_imports)]
13261                use super::*;
13262                #[derive(Clone, Debug)]
13263                pub enum Grouping<'a> {
13264                    Account(
13265                        ::buffa::alloc::boxed::Box<
13266                            super::super::super::super::__buffa::view::AccountGroupingView<
13267                                'a,
13268                            >,
13269                        >,
13270                    ),
13271                    Asset(
13272                        ::buffa::alloc::boxed::Box<
13273                            super::super::super::super::__buffa::view::AssetGroupingView<
13274                                'a,
13275                            >,
13276                        >,
13277                    ),
13278                }
13279            }
13280        }
13281    }
13282    pub mod oneof {
13283        #[allow(unused_imports)]
13284        use super::*;
13285        pub mod equity_series {
13286            #[allow(unused_imports)]
13287            use super::*;
13288            /// Grouping identifier: either account or asset, depending on request group_by.
13289            #[derive(Clone, PartialEq, Debug)]
13290            pub enum Grouping {
13291                Account(
13292                    ::buffa::alloc::boxed::Box<super::super::super::AccountGrouping>,
13293                ),
13294                Asset(::buffa::alloc::boxed::Box<super::super::super::AssetGrouping>),
13295            }
13296            impl ::buffa::Oneof for Grouping {}
13297            impl From<super::super::super::AccountGrouping> for Grouping {
13298                fn from(v: super::super::super::AccountGrouping) -> Self {
13299                    Self::Account(::buffa::alloc::boxed::Box::new(v))
13300                }
13301            }
13302            impl From<super::super::super::AccountGrouping>
13303            for ::core::option::Option<Grouping> {
13304                fn from(v: super::super::super::AccountGrouping) -> Self {
13305                    Self::Some(Grouping::from(v))
13306                }
13307            }
13308            impl From<super::super::super::AssetGrouping> for Grouping {
13309                fn from(v: super::super::super::AssetGrouping) -> Self {
13310                    Self::Asset(::buffa::alloc::boxed::Box::new(v))
13311                }
13312            }
13313            impl From<super::super::super::AssetGrouping>
13314            for ::core::option::Option<Grouping> {
13315                fn from(v: super::super::super::AssetGrouping) -> Self {
13316                    Self::Some(Grouping::from(v))
13317                }
13318            }
13319            impl serde::Serialize for Grouping {
13320                fn serialize<S: serde::Serializer>(
13321                    &self,
13322                    s: S,
13323                ) -> ::core::result::Result<S::Ok, S::Error> {
13324                    use serde::ser::SerializeMap;
13325                    let mut map = s.serialize_map(Some(1))?;
13326                    match self {
13327                        Self::Account(v) => {
13328                            map.serialize_entry("account", v)?;
13329                        }
13330                        Self::Asset(v) => {
13331                            map.serialize_entry("asset", v)?;
13332                        }
13333                    }
13334                    map.end()
13335                }
13336            }
13337        }
13338    }
13339    /// Register this package's `Any` type entries and extension entries.
13340    pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
13341        reg.register_json_any(super::__GET_BALANCES_REQUEST_JSON_ANY);
13342        reg.register_json_any(super::__ASSET_BALANCE_JSON_ANY);
13343        reg.register_json_any(super::__GET_BALANCES_RESPONSE_JSON_ANY);
13344        reg.register_json_any(super::__GET_BALANCE_HISTORY_REQUEST_JSON_ANY);
13345        reg.register_json_any(super::__BALANCE_SERIES_JSON_ANY);
13346        reg.register_json_any(super::__GET_BALANCE_HISTORY_RESPONSE_JSON_ANY);
13347        reg.register_json_any(super::__ACCOUNT_GROUPING_JSON_ANY);
13348        reg.register_json_any(super::__ASSET_GROUPING_JSON_ANY);
13349        reg.register_json_any(super::__GET_EQUITY_HISTORY_SERIES_REQUEST_JSON_ANY);
13350        reg.register_json_any(super::__EQUITY_SERIES_JSON_ANY);
13351        reg.register_json_any(super::__GET_EQUITY_HISTORY_SERIES_RESPONSE_JSON_ANY);
13352        reg.register_json_any(super::__LIST_TRANSFERS_REQUEST_JSON_ANY);
13353        reg.register_json_any(super::__TRANSFER_SIDE_JSON_ANY);
13354        reg.register_json_any(super::__TRANSFER_ROW_JSON_ANY);
13355        reg.register_json_any(super::__LIST_TRANSFERS_RESPONSE_JSON_ANY);
13356        reg.register_json_any(super::__LIST_HOLDS_REQUEST_JSON_ANY);
13357        reg.register_json_any(super::__HOLD_ROW_JSON_ANY);
13358        reg.register_json_any(super::__LIST_HOLDS_RESPONSE_JSON_ANY);
13359        reg.register_json_any(super::__ERROR_DETAIL_JSON_ANY);
13360    }
13361}
13362#[doc(inline)]
13363pub use self::__buffa::view::GetBalancesRequestView;
13364#[doc(inline)]
13365pub use self::__buffa::view::GetBalancesRequestOwnedView;
13366#[doc(inline)]
13367pub use self::__buffa::view::AssetBalanceView;
13368#[doc(inline)]
13369pub use self::__buffa::view::AssetBalanceOwnedView;
13370#[doc(inline)]
13371pub use self::__buffa::view::GetBalancesResponseView;
13372#[doc(inline)]
13373pub use self::__buffa::view::GetBalancesResponseOwnedView;
13374#[doc(inline)]
13375pub use self::__buffa::view::GetBalanceHistoryRequestView;
13376#[doc(inline)]
13377pub use self::__buffa::view::GetBalanceHistoryRequestOwnedView;
13378#[doc(inline)]
13379pub use self::__buffa::view::BalanceSeriesView;
13380#[doc(inline)]
13381pub use self::__buffa::view::BalanceSeriesOwnedView;
13382#[doc(inline)]
13383pub use self::__buffa::view::GetBalanceHistoryResponseView;
13384#[doc(inline)]
13385pub use self::__buffa::view::GetBalanceHistoryResponseOwnedView;
13386#[doc(inline)]
13387pub use self::__buffa::view::AccountGroupingView;
13388#[doc(inline)]
13389pub use self::__buffa::view::AccountGroupingOwnedView;
13390#[doc(inline)]
13391pub use self::__buffa::view::AssetGroupingView;
13392#[doc(inline)]
13393pub use self::__buffa::view::AssetGroupingOwnedView;
13394#[doc(inline)]
13395pub use self::__buffa::view::GetEquityHistorySeriesRequestView;
13396#[doc(inline)]
13397pub use self::__buffa::view::GetEquityHistorySeriesRequestOwnedView;
13398#[doc(inline)]
13399pub use self::__buffa::view::EquitySeriesView;
13400#[doc(inline)]
13401pub use self::__buffa::view::EquitySeriesOwnedView;
13402#[doc(inline)]
13403pub use self::__buffa::view::GetEquityHistorySeriesResponseView;
13404#[doc(inline)]
13405pub use self::__buffa::view::GetEquityHistorySeriesResponseOwnedView;
13406#[doc(inline)]
13407pub use self::__buffa::view::ListTransfersRequestView;
13408#[doc(inline)]
13409pub use self::__buffa::view::ListTransfersRequestOwnedView;
13410#[doc(inline)]
13411pub use self::__buffa::view::TransferSideView;
13412#[doc(inline)]
13413pub use self::__buffa::view::TransferSideOwnedView;
13414#[doc(inline)]
13415pub use self::__buffa::view::TransferRowView;
13416#[doc(inline)]
13417pub use self::__buffa::view::TransferRowOwnedView;
13418#[doc(inline)]
13419pub use self::__buffa::view::ListTransfersResponseView;
13420#[doc(inline)]
13421pub use self::__buffa::view::ListTransfersResponseOwnedView;
13422#[doc(inline)]
13423pub use self::__buffa::view::ListHoldsRequestView;
13424#[doc(inline)]
13425pub use self::__buffa::view::ListHoldsRequestOwnedView;
13426#[doc(inline)]
13427pub use self::__buffa::view::HoldRowView;
13428#[doc(inline)]
13429pub use self::__buffa::view::HoldRowOwnedView;
13430#[doc(inline)]
13431pub use self::__buffa::view::ListHoldsResponseView;
13432#[doc(inline)]
13433pub use self::__buffa::view::ListHoldsResponseOwnedView;
13434#[doc(inline)]
13435pub use self::__buffa::view::ErrorDetailView;
13436#[doc(inline)]
13437pub use self::__buffa::view::ErrorDetailOwnedView;
13438#[doc(inline)]
13439pub use self::__buffa::register_types;