Skip to main content

polyester/gen/buffa/
chain.withdraw.v1.rs

1// @generated by buffa-codegen. DO NOT EDIT.
2
3/// TradingWithdrawAction identifies where funds should move from Trading.
4#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5#[repr(i32)]
6pub enum TradingWithdrawAction {
7    ACTION_UNSPECIFIED = 0i32,
8    TO_FUNDING = 1i32,
9    TO_EXTERNAL_CHAIN = 2i32,
10}
11impl TradingWithdrawAction {
12    ///Idiomatic alias for [`Self::ACTION_UNSPECIFIED`]; `Debug` prints the variant name.
13    #[allow(non_upper_case_globals)]
14    pub const ActionUnspecified: Self = Self::ACTION_UNSPECIFIED;
15    ///Idiomatic alias for [`Self::TO_FUNDING`]; `Debug` prints the variant name.
16    #[allow(non_upper_case_globals)]
17    pub const ToFunding: Self = Self::TO_FUNDING;
18    ///Idiomatic alias for [`Self::TO_EXTERNAL_CHAIN`]; `Debug` prints the variant name.
19    #[allow(non_upper_case_globals)]
20    pub const ToExternalChain: Self = Self::TO_EXTERNAL_CHAIN;
21}
22impl ::core::default::Default for TradingWithdrawAction {
23    fn default() -> Self {
24        Self::ACTION_UNSPECIFIED
25    }
26}
27impl ::serde::Serialize for TradingWithdrawAction {
28    fn serialize<S: ::serde::Serializer>(
29        &self,
30        s: S,
31    ) -> ::core::result::Result<S::Ok, S::Error> {
32        s.serialize_str(::buffa::Enumeration::proto_name(self))
33    }
34}
35impl<'de> ::serde::Deserialize<'de> for TradingWithdrawAction {
36    fn deserialize<D: ::serde::Deserializer<'de>>(
37        d: D,
38    ) -> ::core::result::Result<Self, D::Error> {
39        struct _V;
40        impl ::serde::de::Visitor<'_> for _V {
41            type Value = TradingWithdrawAction;
42            fn expecting(
43                &self,
44                f: &mut ::core::fmt::Formatter<'_>,
45            ) -> ::core::fmt::Result {
46                f.write_str(
47                    concat!(
48                        "a string, integer, or null for ",
49                        stringify!(TradingWithdrawAction)
50                    ),
51                )
52            }
53            fn visit_str<E: ::serde::de::Error>(
54                self,
55                v: &str,
56            ) -> ::core::result::Result<TradingWithdrawAction, E> {
57                <TradingWithdrawAction as ::buffa::Enumeration>::from_proto_name(v)
58                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
59            }
60            fn visit_i64<E: ::serde::de::Error>(
61                self,
62                v: i64,
63            ) -> ::core::result::Result<TradingWithdrawAction, E> {
64                let v32 = i32::try_from(v)
65                    .map_err(|_| {
66                        ::serde::de::Error::custom(
67                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
68                        )
69                    })?;
70                <TradingWithdrawAction as ::buffa::Enumeration>::from_i32(v32)
71                    .ok_or_else(|| {
72                        ::serde::de::Error::custom(
73                            ::buffa::alloc::format!("unknown enum value {v32}"),
74                        )
75                    })
76            }
77            fn visit_u64<E: ::serde::de::Error>(
78                self,
79                v: u64,
80            ) -> ::core::result::Result<TradingWithdrawAction, E> {
81                let v32 = i32::try_from(v)
82                    .map_err(|_| {
83                        ::serde::de::Error::custom(
84                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
85                        )
86                    })?;
87                <TradingWithdrawAction as ::buffa::Enumeration>::from_i32(v32)
88                    .ok_or_else(|| {
89                        ::serde::de::Error::custom(
90                            ::buffa::alloc::format!("unknown enum value {v32}"),
91                        )
92                    })
93            }
94            fn visit_unit<E: ::serde::de::Error>(
95                self,
96            ) -> ::core::result::Result<TradingWithdrawAction, E> {
97                ::core::result::Result::Ok(::core::default::Default::default())
98            }
99        }
100        d.deserialize_any(_V)
101    }
102}
103impl ::buffa::json_helpers::ProtoElemJson for TradingWithdrawAction {
104    fn serialize_proto_json<S: ::serde::Serializer>(
105        v: &Self,
106        s: S,
107    ) -> ::core::result::Result<S::Ok, S::Error> {
108        ::serde::Serialize::serialize(v, s)
109    }
110    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
111        d: D,
112    ) -> ::core::result::Result<Self, D::Error> {
113        <Self as ::serde::Deserialize>::deserialize(d)
114    }
115}
116impl ::buffa::Enumeration for TradingWithdrawAction {
117    fn from_i32(value: i32) -> ::core::option::Option<Self> {
118        match value {
119            0i32 => ::core::option::Option::Some(Self::ACTION_UNSPECIFIED),
120            1i32 => ::core::option::Option::Some(Self::TO_FUNDING),
121            2i32 => ::core::option::Option::Some(Self::TO_EXTERNAL_CHAIN),
122            _ => ::core::option::Option::None,
123        }
124    }
125    fn to_i32(&self) -> i32 {
126        *self as i32
127    }
128    fn proto_name(&self) -> &'static str {
129        match self {
130            Self::ACTION_UNSPECIFIED => "ACTION_UNSPECIFIED",
131            Self::TO_FUNDING => "TO_FUNDING",
132            Self::TO_EXTERNAL_CHAIN => "TO_EXTERNAL_CHAIN",
133        }
134    }
135    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
136        match name {
137            "ACTION_UNSPECIFIED" => {
138                ::core::option::Option::Some(Self::ACTION_UNSPECIFIED)
139            }
140            "TO_FUNDING" => ::core::option::Option::Some(Self::TO_FUNDING),
141            "TO_EXTERNAL_CHAIN" => ::core::option::Option::Some(Self::TO_EXTERNAL_CHAIN),
142            _ => ::core::option::Option::None,
143        }
144    }
145    fn values() -> &'static [Self] {
146        &[Self::ACTION_UNSPECIFIED, Self::TO_FUNDING, Self::TO_EXTERNAL_CHAIN]
147    }
148}
149/// CreateTradingWithdrawResponse returns the accepted durable intent identifier
150/// for the withdraw lifecycle.
151#[derive(Clone, PartialEq, Default)]
152#[derive(::serde::Serialize, ::serde::Deserialize)]
153#[serde(default)]
154pub struct CreateTradingWithdrawResponse {
155    /// Stable server-owned intent identifier for the accepted withdraw lifecycle.
156    /// Clients use this id to follow later progress for the same withdraw flow.
157    ///
158    /// Field 1: `intent_id`
159    #[serde(
160        rename = "intentId",
161        alias = "intent_id",
162        with = "::buffa::json_helpers::proto_string",
163        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
164    )]
165    pub intent_id: ::buffa::alloc::string::String,
166    #[serde(skip)]
167    #[doc(hidden)]
168    pub __buffa_unknown_fields: ::buffa::UnknownFields,
169}
170impl ::core::fmt::Debug for CreateTradingWithdrawResponse {
171    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
172        f.debug_struct("CreateTradingWithdrawResponse")
173            .field("intent_id", &self.intent_id)
174            .finish()
175    }
176}
177impl CreateTradingWithdrawResponse {
178    /// Protobuf type URL for this message, for use with `Any::pack` and
179    /// `Any::unpack_if`.
180    ///
181    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
182    pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
183}
184::buffa::impl_default_instance!(CreateTradingWithdrawResponse);
185impl ::buffa::MessageName for CreateTradingWithdrawResponse {
186    const PACKAGE: &'static str = "chain.withdraw.v1";
187    const NAME: &'static str = "CreateTradingWithdrawResponse";
188    const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
189    const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
190}
191impl ::buffa::Message for CreateTradingWithdrawResponse {
192    /// Returns the total encoded size in bytes.
193    ///
194    /// The result is a `u32`; the protobuf specification requires all
195    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
196    /// compliant message will never overflow this type.
197    #[allow(clippy::let_and_return)]
198    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
199        #[allow(unused_imports)]
200        use ::buffa::Enumeration as _;
201        let mut size = 0u32;
202        if !self.intent_id.is_empty() {
203            size += 1u32 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
204        }
205        size += self.__buffa_unknown_fields.encoded_len() as u32;
206        size
207    }
208    fn write_to(
209        &self,
210        _cache: &mut ::buffa::SizeCache,
211        buf: &mut impl ::buffa::bytes::BufMut,
212    ) {
213        #[allow(unused_imports)]
214        use ::buffa::Enumeration as _;
215        if !self.intent_id.is_empty() {
216            ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
217        }
218        self.__buffa_unknown_fields.write_to(buf);
219    }
220    fn merge_field(
221        &mut self,
222        tag: ::buffa::encoding::Tag,
223        buf: &mut impl ::buffa::bytes::Buf,
224        ctx: ::buffa::DecodeContext<'_>,
225    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
226        #[allow(unused_imports)]
227        use ::buffa::bytes::Buf as _;
228        #[allow(unused_imports)]
229        use ::buffa::Enumeration as _;
230        match tag.field_number() {
231            1u32 => {
232                ::buffa::encoding::check_wire_type(
233                    tag,
234                    ::buffa::encoding::WireType::LengthDelimited,
235                )?;
236                ::buffa::types::merge_string(&mut self.intent_id, buf)?;
237            }
238            _ => {
239                self.__buffa_unknown_fields
240                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
241            }
242        }
243        ::core::result::Result::Ok(())
244    }
245    fn clear(&mut self) {
246        self.intent_id.clear();
247        self.__buffa_unknown_fields.clear();
248    }
249}
250impl ::buffa::ExtensionSet for CreateTradingWithdrawResponse {
251    const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
252    fn unknown_fields(&self) -> &::buffa::UnknownFields {
253        &self.__buffa_unknown_fields
254    }
255    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
256        &mut self.__buffa_unknown_fields
257    }
258}
259impl ::buffa::json_helpers::ProtoElemJson for CreateTradingWithdrawResponse {
260    fn serialize_proto_json<S: ::serde::Serializer>(
261        v: &Self,
262        s: S,
263    ) -> ::core::result::Result<S::Ok, S::Error> {
264        ::serde::Serialize::serialize(v, s)
265    }
266    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
267        d: D,
268    ) -> ::core::result::Result<Self, D::Error> {
269        <Self as ::serde::Deserialize>::deserialize(d)
270    }
271}
272#[doc(hidden)]
273pub const __CREATE_TRADING_WITHDRAW_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
274    type_url: "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse",
275    to_json: ::buffa::type_registry::any_to_json::<CreateTradingWithdrawResponse>,
276    from_json: ::buffa::type_registry::any_from_json::<CreateTradingWithdrawResponse>,
277    is_wkt: false,
278};
279/// CreateWalletTradingWithdrawResponse returns the accepted durable intent
280/// identifier for a wallet-authorized withdraw lifecycle.
281#[derive(Clone, PartialEq, Default)]
282#[derive(::serde::Serialize, ::serde::Deserialize)]
283#[serde(default)]
284pub struct CreateWalletTradingWithdrawResponse {
285    /// Stable server-owned intent identifier for the accepted withdraw lifecycle.
286    /// Clients use this id to follow later progress for the same withdraw flow.
287    ///
288    /// Field 1: `intent_id`
289    #[serde(
290        rename = "intentId",
291        alias = "intent_id",
292        with = "::buffa::json_helpers::proto_string",
293        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
294    )]
295    pub intent_id: ::buffa::alloc::string::String,
296    #[serde(skip)]
297    #[doc(hidden)]
298    pub __buffa_unknown_fields: ::buffa::UnknownFields,
299}
300impl ::core::fmt::Debug for CreateWalletTradingWithdrawResponse {
301    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
302        f.debug_struct("CreateWalletTradingWithdrawResponse")
303            .field("intent_id", &self.intent_id)
304            .finish()
305    }
306}
307impl CreateWalletTradingWithdrawResponse {
308    /// Protobuf type URL for this message, for use with `Any::pack` and
309    /// `Any::unpack_if`.
310    ///
311    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
312    pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
313}
314::buffa::impl_default_instance!(CreateWalletTradingWithdrawResponse);
315impl ::buffa::MessageName for CreateWalletTradingWithdrawResponse {
316    const PACKAGE: &'static str = "chain.withdraw.v1";
317    const NAME: &'static str = "CreateWalletTradingWithdrawResponse";
318    const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
319    const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
320}
321impl ::buffa::Message for CreateWalletTradingWithdrawResponse {
322    /// Returns the total encoded size in bytes.
323    ///
324    /// The result is a `u32`; the protobuf specification requires all
325    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
326    /// compliant message will never overflow this type.
327    #[allow(clippy::let_and_return)]
328    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
329        #[allow(unused_imports)]
330        use ::buffa::Enumeration as _;
331        let mut size = 0u32;
332        if !self.intent_id.is_empty() {
333            size += 1u32 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
334        }
335        size += self.__buffa_unknown_fields.encoded_len() as u32;
336        size
337    }
338    fn write_to(
339        &self,
340        _cache: &mut ::buffa::SizeCache,
341        buf: &mut impl ::buffa::bytes::BufMut,
342    ) {
343        #[allow(unused_imports)]
344        use ::buffa::Enumeration as _;
345        if !self.intent_id.is_empty() {
346            ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
347        }
348        self.__buffa_unknown_fields.write_to(buf);
349    }
350    fn merge_field(
351        &mut self,
352        tag: ::buffa::encoding::Tag,
353        buf: &mut impl ::buffa::bytes::Buf,
354        ctx: ::buffa::DecodeContext<'_>,
355    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
356        #[allow(unused_imports)]
357        use ::buffa::bytes::Buf as _;
358        #[allow(unused_imports)]
359        use ::buffa::Enumeration as _;
360        match tag.field_number() {
361            1u32 => {
362                ::buffa::encoding::check_wire_type(
363                    tag,
364                    ::buffa::encoding::WireType::LengthDelimited,
365                )?;
366                ::buffa::types::merge_string(&mut self.intent_id, buf)?;
367            }
368            _ => {
369                self.__buffa_unknown_fields
370                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
371            }
372        }
373        ::core::result::Result::Ok(())
374    }
375    fn clear(&mut self) {
376        self.intent_id.clear();
377        self.__buffa_unknown_fields.clear();
378    }
379}
380impl ::buffa::ExtensionSet for CreateWalletTradingWithdrawResponse {
381    const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
382    fn unknown_fields(&self) -> &::buffa::UnknownFields {
383        &self.__buffa_unknown_fields
384    }
385    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
386        &mut self.__buffa_unknown_fields
387    }
388}
389impl ::buffa::json_helpers::ProtoElemJson for CreateWalletTradingWithdrawResponse {
390    fn serialize_proto_json<S: ::serde::Serializer>(
391        v: &Self,
392        s: S,
393    ) -> ::core::result::Result<S::Ok, S::Error> {
394        ::serde::Serialize::serialize(v, s)
395    }
396    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
397        d: D,
398    ) -> ::core::result::Result<Self, D::Error> {
399        <Self as ::serde::Deserialize>::deserialize(d)
400    }
401}
402#[doc(hidden)]
403pub const __CREATE_WALLET_TRADING_WITHDRAW_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
404    type_url: "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse",
405    to_json: ::buffa::type_registry::any_to_json::<CreateWalletTradingWithdrawResponse>,
406    from_json: ::buffa::type_registry::any_from_json::<
407        CreateWalletTradingWithdrawResponse,
408    >,
409    is_wkt: false,
410};
411/// TradingWithdrawIntentPayload is the client-signed typed withdraw request.
412/// Account scope and backend intent ids are derived server-side.
413#[derive(Clone, PartialEq, Default)]
414#[derive(::serde::Serialize, ::serde::Deserialize)]
415#[serde(default)]
416pub struct TradingWithdrawIntentPayload {
417    /// Destination for funds leaving Trading.
418    ///
419    /// Field 1: `action`
420    #[serde(
421        rename = "action",
422        with = "::buffa::json_helpers::proto_enum",
423        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
424    )]
425    pub action: ::buffa::EnumValue<TradingWithdrawAction>,
426    /// Unified asset identifier from Polyester asset metadata. amount_e18 is
427    /// denominated in this asset at canonical 18-decimal scale.
428    ///
429    /// Field 2: `asset_id`
430    #[serde(
431        rename = "assetId",
432        alias = "asset_id",
433        with = "::buffa::json_helpers::uint32",
434        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
435    )]
436    pub asset_id: u32,
437    /// External network id for TO_EXTERNAL_CHAIN. Omit for TO_FUNDING.
438    ///
439    /// Field 3: `destination_chain_id`
440    #[serde(
441        rename = "destinationChainId",
442        alias = "destination_chain_id",
443        with = "::buffa::json_helpers::uint64",
444        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
445    )]
446    pub destination_chain_id: u64,
447    /// Withdraw amount in canonical 18-decimal unified asset units.
448    /// For example, 0.5 is encoded as 500000000000000000.
449    ///
450    /// Field 4: `amount_e18`
451    #[serde(
452        rename = "amountE18",
453        alias = "amount_e18",
454        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
455    )]
456    pub amount_e18: ::buffa::MessageField<
457        super::super::super::polyester::r#type::v1::U128,
458    >,
459    /// Unix timestamp in seconds after which this signed user authorization is no
460    /// longer accepted by the API. This is separate from the server-owned
461    /// execution deadline used later for on-chain submission.
462    ///
463    /// Field 5: `deadline_ts_sec`
464    #[serde(
465        rename = "deadlineTsSec",
466        alias = "deadline_ts_sec",
467        with = "::buffa::json_helpers::uint64",
468        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
469    )]
470    pub deadline_ts_sec: u64,
471    /// Client-generated unsigned 128-bit nonce bound to the signed request. This
472    /// is an identifier, not a decimal amount.
473    ///
474    /// Field 6: `nonce`
475    #[serde(
476        rename = "nonce",
477        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
478    )]
479    pub nonce: ::buffa::MessageField<super::super::super::polyester::r#type::v1::U128>,
480    /// Destination address. For TO_EXTERNAL_CHAIN this is an address on
481    /// destination_chain_id and is validated according to that network. For
482    /// TO_FUNDING, omit it to move funds to the selected account's Funding account
483    /// or provide another Polyester funding address for a Trading-to-Funding
484    /// transfer.
485    ///
486    /// Field 7: `destination_address`
487    #[serde(
488        rename = "destinationAddress",
489        alias = "destination_address",
490        with = "::buffa::json_helpers::proto_string",
491        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
492    )]
493    pub destination_address: ::buffa::alloc::string::String,
494    /// Client-chosen idempotency key. Reusing the same key with the same payload
495    /// returns the existing withdraw; reusing it with different payload fails.
496    ///
497    /// Field 8: `idempotency_key`
498    #[serde(
499        rename = "idempotencyKey",
500        alias = "idempotency_key",
501        with = "::buffa::json_helpers::proto_string",
502        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
503    )]
504    pub idempotency_key: ::buffa::alloc::string::String,
505    #[serde(skip)]
506    #[doc(hidden)]
507    pub __buffa_unknown_fields: ::buffa::UnknownFields,
508}
509impl ::core::fmt::Debug for TradingWithdrawIntentPayload {
510    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
511        f.debug_struct("TradingWithdrawIntentPayload")
512            .field("action", &self.action)
513            .field("asset_id", &self.asset_id)
514            .field("destination_chain_id", &self.destination_chain_id)
515            .field("amount_e18", &self.amount_e18)
516            .field("deadline_ts_sec", &self.deadline_ts_sec)
517            .field("nonce", &self.nonce)
518            .field("destination_address", &self.destination_address)
519            .field("idempotency_key", &self.idempotency_key)
520            .finish()
521    }
522}
523impl TradingWithdrawIntentPayload {
524    /// Protobuf type URL for this message, for use with `Any::pack` and
525    /// `Any::unpack_if`.
526    ///
527    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
528    pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
529}
530::buffa::impl_default_instance!(TradingWithdrawIntentPayload);
531impl ::buffa::MessageName for TradingWithdrawIntentPayload {
532    const PACKAGE: &'static str = "chain.withdraw.v1";
533    const NAME: &'static str = "TradingWithdrawIntentPayload";
534    const FULL_NAME: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
535    const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
536}
537impl ::buffa::Message for TradingWithdrawIntentPayload {
538    /// Returns the total encoded size in bytes.
539    ///
540    /// The result is a `u32`; the protobuf specification requires all
541    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
542    /// compliant message will never overflow this type.
543    #[allow(clippy::let_and_return)]
544    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
545        #[allow(unused_imports)]
546        use ::buffa::Enumeration as _;
547        let mut size = 0u32;
548        {
549            let val = self.action.to_i32();
550            if val != 0 {
551                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
552            }
553        }
554        if self.asset_id != 0u32 {
555            size += 1u32 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
556        }
557        if self.destination_chain_id != 0u64 {
558            size
559                += 1u32
560                    + ::buffa::types::uint64_encoded_len(self.destination_chain_id)
561                        as u32;
562        }
563        if self.amount_e18.is_set() {
564            let __slot = __cache.reserve();
565            let inner_size = self.amount_e18.compute_size(__cache);
566            __cache.set(__slot, inner_size);
567            size
568                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
569                    + inner_size;
570        }
571        if self.deadline_ts_sec != 0u64 {
572            size
573                += 1u32
574                    + ::buffa::types::uint64_encoded_len(self.deadline_ts_sec) as u32;
575        }
576        if self.nonce.is_set() {
577            let __slot = __cache.reserve();
578            let inner_size = self.nonce.compute_size(__cache);
579            __cache.set(__slot, inner_size);
580            size
581                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
582                    + inner_size;
583        }
584        if !self.destination_address.is_empty() {
585            size
586                += 1u32
587                    + ::buffa::types::string_encoded_len(&self.destination_address)
588                        as u32;
589        }
590        if !self.idempotency_key.is_empty() {
591            size
592                += 1u32
593                    + ::buffa::types::string_encoded_len(&self.idempotency_key) as u32;
594        }
595        size += self.__buffa_unknown_fields.encoded_len() as u32;
596        size
597    }
598    fn write_to(
599        &self,
600        __cache: &mut ::buffa::SizeCache,
601        buf: &mut impl ::buffa::bytes::BufMut,
602    ) {
603        #[allow(unused_imports)]
604        use ::buffa::Enumeration as _;
605        {
606            let val = self.action.to_i32();
607            if val != 0 {
608                ::buffa::types::put_int32_field(1u32, val, buf);
609            }
610        }
611        if self.asset_id != 0u32 {
612            ::buffa::types::put_uint32_field(2u32, self.asset_id, buf);
613        }
614        if self.destination_chain_id != 0u64 {
615            ::buffa::types::put_uint64_field(3u32, self.destination_chain_id, buf);
616        }
617        if self.amount_e18.is_set() {
618            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
619            self.amount_e18.write_to(__cache, buf);
620        }
621        if self.deadline_ts_sec != 0u64 {
622            ::buffa::types::put_uint64_field(5u32, self.deadline_ts_sec, buf);
623        }
624        if self.nonce.is_set() {
625            ::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf);
626            self.nonce.write_to(__cache, buf);
627        }
628        if !self.destination_address.is_empty() {
629            ::buffa::types::put_string_field(7u32, &self.destination_address, buf);
630        }
631        if !self.idempotency_key.is_empty() {
632            ::buffa::types::put_string_field(8u32, &self.idempotency_key, buf);
633        }
634        self.__buffa_unknown_fields.write_to(buf);
635    }
636    fn merge_field(
637        &mut self,
638        tag: ::buffa::encoding::Tag,
639        buf: &mut impl ::buffa::bytes::Buf,
640        ctx: ::buffa::DecodeContext<'_>,
641    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
642        #[allow(unused_imports)]
643        use ::buffa::bytes::Buf as _;
644        #[allow(unused_imports)]
645        use ::buffa::Enumeration as _;
646        match tag.field_number() {
647            1u32 => {
648                ::buffa::encoding::check_wire_type(
649                    tag,
650                    ::buffa::encoding::WireType::Varint,
651                )?;
652                self.action = ::buffa::EnumValue::from(
653                    ::buffa::types::decode_int32(buf)?,
654                );
655            }
656            2u32 => {
657                ::buffa::encoding::check_wire_type(
658                    tag,
659                    ::buffa::encoding::WireType::Varint,
660                )?;
661                self.asset_id = ::buffa::types::decode_uint32(buf)?;
662            }
663            3u32 => {
664                ::buffa::encoding::check_wire_type(
665                    tag,
666                    ::buffa::encoding::WireType::Varint,
667                )?;
668                self.destination_chain_id = ::buffa::types::decode_uint64(buf)?;
669            }
670            4u32 => {
671                ::buffa::encoding::check_wire_type(
672                    tag,
673                    ::buffa::encoding::WireType::LengthDelimited,
674                )?;
675                ::buffa::Message::merge_length_delimited(
676                    self.amount_e18.get_or_insert_default(),
677                    buf,
678                    ctx,
679                )?;
680            }
681            5u32 => {
682                ::buffa::encoding::check_wire_type(
683                    tag,
684                    ::buffa::encoding::WireType::Varint,
685                )?;
686                self.deadline_ts_sec = ::buffa::types::decode_uint64(buf)?;
687            }
688            6u32 => {
689                ::buffa::encoding::check_wire_type(
690                    tag,
691                    ::buffa::encoding::WireType::LengthDelimited,
692                )?;
693                ::buffa::Message::merge_length_delimited(
694                    self.nonce.get_or_insert_default(),
695                    buf,
696                    ctx,
697                )?;
698            }
699            7u32 => {
700                ::buffa::encoding::check_wire_type(
701                    tag,
702                    ::buffa::encoding::WireType::LengthDelimited,
703                )?;
704                ::buffa::types::merge_string(&mut self.destination_address, buf)?;
705            }
706            8u32 => {
707                ::buffa::encoding::check_wire_type(
708                    tag,
709                    ::buffa::encoding::WireType::LengthDelimited,
710                )?;
711                ::buffa::types::merge_string(&mut self.idempotency_key, buf)?;
712            }
713            _ => {
714                self.__buffa_unknown_fields
715                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
716            }
717        }
718        ::core::result::Result::Ok(())
719    }
720    fn clear(&mut self) {
721        self.action = ::buffa::EnumValue::from(0);
722        self.asset_id = 0u32;
723        self.destination_chain_id = 0u64;
724        self.amount_e18 = ::buffa::MessageField::none();
725        self.deadline_ts_sec = 0u64;
726        self.nonce = ::buffa::MessageField::none();
727        self.destination_address.clear();
728        self.idempotency_key.clear();
729        self.__buffa_unknown_fields.clear();
730    }
731}
732impl ::buffa::ExtensionSet for TradingWithdrawIntentPayload {
733    const PROTO_FQN: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
734    fn unknown_fields(&self) -> &::buffa::UnknownFields {
735        &self.__buffa_unknown_fields
736    }
737    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
738        &mut self.__buffa_unknown_fields
739    }
740}
741impl ::buffa::json_helpers::ProtoElemJson for TradingWithdrawIntentPayload {
742    fn serialize_proto_json<S: ::serde::Serializer>(
743        v: &Self,
744        s: S,
745    ) -> ::core::result::Result<S::Ok, S::Error> {
746        ::serde::Serialize::serialize(v, s)
747    }
748    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
749        d: D,
750    ) -> ::core::result::Result<Self, D::Error> {
751        <Self as ::serde::Deserialize>::deserialize(d)
752    }
753}
754#[doc(hidden)]
755pub const __TRADING_WITHDRAW_INTENT_PAYLOAD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
756    type_url: "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload",
757    to_json: ::buffa::type_registry::any_to_json::<TradingWithdrawIntentPayload>,
758    from_json: ::buffa::type_registry::any_from_json::<TradingWithdrawIntentPayload>,
759    is_wkt: false,
760};
761/// CreateTradingWithdrawRequest creates or returns one durable backend-authorized
762/// Trading withdraw intent from typed protobuf fields and an API-key signature.
763#[derive(Clone, PartialEq, Default)]
764#[derive(::serde::Serialize, ::serde::Deserialize)]
765#[serde(default)]
766pub struct CreateTradingWithdrawRequest {
767    /// Client-signed withdraw details.
768    ///
769    /// Field 1: `payload`
770    #[serde(
771        rename = "payload",
772        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
773    )]
774    pub payload: ::buffa::MessageField<TradingWithdrawIntentPayload>,
775    /// User/API signature over deterministic TradingWithdrawIntentPayload bytes.
776    ///
777    /// Field 2: `payload_signature`
778    #[serde(
779        rename = "payloadSignature",
780        alias = "payload_signature",
781        with = "::buffa::json_helpers::bytes",
782        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
783    )]
784    pub payload_signature: ::buffa::alloc::vec::Vec<u8>,
785    #[serde(skip)]
786    #[doc(hidden)]
787    pub __buffa_unknown_fields: ::buffa::UnknownFields,
788}
789impl ::core::fmt::Debug for CreateTradingWithdrawRequest {
790    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
791        f.debug_struct("CreateTradingWithdrawRequest")
792            .field("payload", &self.payload)
793            .field("payload_signature", &self.payload_signature)
794            .finish()
795    }
796}
797impl CreateTradingWithdrawRequest {
798    /// Protobuf type URL for this message, for use with `Any::pack` and
799    /// `Any::unpack_if`.
800    ///
801    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
802    pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
803}
804::buffa::impl_default_instance!(CreateTradingWithdrawRequest);
805impl ::buffa::MessageName for CreateTradingWithdrawRequest {
806    const PACKAGE: &'static str = "chain.withdraw.v1";
807    const NAME: &'static str = "CreateTradingWithdrawRequest";
808    const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
809    const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
810}
811impl ::buffa::Message for CreateTradingWithdrawRequest {
812    /// Returns the total encoded size in bytes.
813    ///
814    /// The result is a `u32`; the protobuf specification requires all
815    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
816    /// compliant message will never overflow this type.
817    #[allow(clippy::let_and_return)]
818    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
819        #[allow(unused_imports)]
820        use ::buffa::Enumeration as _;
821        let mut size = 0u32;
822        if self.payload.is_set() {
823            let __slot = __cache.reserve();
824            let inner_size = self.payload.compute_size(__cache);
825            __cache.set(__slot, inner_size);
826            size
827                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
828                    + inner_size;
829        }
830        if !self.payload_signature.is_empty() {
831            size
832                += 1u32
833                    + ::buffa::types::bytes_encoded_len(&self.payload_signature) as u32;
834        }
835        size += self.__buffa_unknown_fields.encoded_len() as u32;
836        size
837    }
838    fn write_to(
839        &self,
840        __cache: &mut ::buffa::SizeCache,
841        buf: &mut impl ::buffa::bytes::BufMut,
842    ) {
843        #[allow(unused_imports)]
844        use ::buffa::Enumeration as _;
845        if self.payload.is_set() {
846            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
847            self.payload.write_to(__cache, buf);
848        }
849        if !self.payload_signature.is_empty() {
850            ::buffa::types::put_bytes_field(2u32, &self.payload_signature, buf);
851        }
852        self.__buffa_unknown_fields.write_to(buf);
853    }
854    fn merge_field(
855        &mut self,
856        tag: ::buffa::encoding::Tag,
857        buf: &mut impl ::buffa::bytes::Buf,
858        ctx: ::buffa::DecodeContext<'_>,
859    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
860        #[allow(unused_imports)]
861        use ::buffa::bytes::Buf as _;
862        #[allow(unused_imports)]
863        use ::buffa::Enumeration as _;
864        match tag.field_number() {
865            1u32 => {
866                ::buffa::encoding::check_wire_type(
867                    tag,
868                    ::buffa::encoding::WireType::LengthDelimited,
869                )?;
870                ::buffa::Message::merge_length_delimited(
871                    self.payload.get_or_insert_default(),
872                    buf,
873                    ctx,
874                )?;
875            }
876            2u32 => {
877                ::buffa::encoding::check_wire_type(
878                    tag,
879                    ::buffa::encoding::WireType::LengthDelimited,
880                )?;
881                ::buffa::types::merge_bytes(&mut self.payload_signature, buf)?;
882            }
883            _ => {
884                self.__buffa_unknown_fields
885                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
886            }
887        }
888        ::core::result::Result::Ok(())
889    }
890    fn clear(&mut self) {
891        self.payload = ::buffa::MessageField::none();
892        self.payload_signature.clear();
893        self.__buffa_unknown_fields.clear();
894    }
895}
896impl ::buffa::ExtensionSet for CreateTradingWithdrawRequest {
897    const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
898    fn unknown_fields(&self) -> &::buffa::UnknownFields {
899        &self.__buffa_unknown_fields
900    }
901    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
902        &mut self.__buffa_unknown_fields
903    }
904}
905impl ::buffa::json_helpers::ProtoElemJson for CreateTradingWithdrawRequest {
906    fn serialize_proto_json<S: ::serde::Serializer>(
907        v: &Self,
908        s: S,
909    ) -> ::core::result::Result<S::Ok, S::Error> {
910        ::serde::Serialize::serialize(v, s)
911    }
912    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
913        d: D,
914    ) -> ::core::result::Result<Self, D::Error> {
915        <Self as ::serde::Deserialize>::deserialize(d)
916    }
917}
918#[doc(hidden)]
919pub const __CREATE_TRADING_WITHDRAW_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
920    type_url: "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest",
921    to_json: ::buffa::type_registry::any_to_json::<CreateTradingWithdrawRequest>,
922    from_json: ::buffa::type_registry::any_from_json::<CreateTradingWithdrawRequest>,
923    is_wkt: false,
924};
925/// CreateWalletTradingWithdrawRequest creates or returns one durable Trading
926/// withdraw intent from typed frontend fields plus a wallet EIP-712 signature.
927#[derive(Clone, PartialEq, Default)]
928#[derive(::serde::Serialize, ::serde::Deserialize)]
929#[serde(default)]
930pub struct CreateWalletTradingWithdrawRequest {
931    /// Client-signed withdraw details.
932    ///
933    /// Field 1: `payload`
934    #[serde(
935        rename = "payload",
936        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
937    )]
938    pub payload: ::buffa::MessageField<TradingWithdrawIntentPayload>,
939    /// Optional public subaccount id. Omit to withdraw from the JWT root account.
940    ///
941    /// Field 2: `subaccount_id`
942    #[serde(
943        rename = "subaccountId",
944        alias = "subaccount_id",
945        with = "::buffa::json_helpers::uint64",
946        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
947    )]
948    pub subaccount_id: u64,
949    /// Wallet address that produced payload_signature.
950    ///
951    /// Field 3: `signer_wallet`
952    #[serde(
953        rename = "signerWallet",
954        alias = "signer_wallet",
955        with = "::buffa::json_helpers::proto_string",
956        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
957    )]
958    pub signer_wallet: ::buffa::alloc::string::String,
959    /// Wallet EIP-712 signature over the typed withdraw payload.
960    ///
961    /// Field 4: `payload_signature`
962    #[serde(
963        rename = "payloadSignature",
964        alias = "payload_signature",
965        with = "::buffa::json_helpers::bytes",
966        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
967    )]
968    pub payload_signature: ::buffa::alloc::vec::Vec<u8>,
969    #[serde(skip)]
970    #[doc(hidden)]
971    pub __buffa_unknown_fields: ::buffa::UnknownFields,
972}
973impl ::core::fmt::Debug for CreateWalletTradingWithdrawRequest {
974    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
975        f.debug_struct("CreateWalletTradingWithdrawRequest")
976            .field("payload", &self.payload)
977            .field("subaccount_id", &self.subaccount_id)
978            .field("signer_wallet", &self.signer_wallet)
979            .field("payload_signature", &self.payload_signature)
980            .finish()
981    }
982}
983impl CreateWalletTradingWithdrawRequest {
984    /// Protobuf type URL for this message, for use with `Any::pack` and
985    /// `Any::unpack_if`.
986    ///
987    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
988    pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
989}
990::buffa::impl_default_instance!(CreateWalletTradingWithdrawRequest);
991impl ::buffa::MessageName for CreateWalletTradingWithdrawRequest {
992    const PACKAGE: &'static str = "chain.withdraw.v1";
993    const NAME: &'static str = "CreateWalletTradingWithdrawRequest";
994    const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
995    const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
996}
997impl ::buffa::Message for CreateWalletTradingWithdrawRequest {
998    /// Returns the total encoded size in bytes.
999    ///
1000    /// The result is a `u32`; the protobuf specification requires all
1001    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1002    /// compliant message will never overflow this type.
1003    #[allow(clippy::let_and_return)]
1004    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1005        #[allow(unused_imports)]
1006        use ::buffa::Enumeration as _;
1007        let mut size = 0u32;
1008        if self.payload.is_set() {
1009            let __slot = __cache.reserve();
1010            let inner_size = self.payload.compute_size(__cache);
1011            __cache.set(__slot, inner_size);
1012            size
1013                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1014                    + inner_size;
1015        }
1016        if self.subaccount_id != 0u64 {
1017            size += 1u32 + ::buffa::types::uint64_encoded_len(self.subaccount_id) as u32;
1018        }
1019        if !self.signer_wallet.is_empty() {
1020            size
1021                += 1u32 + ::buffa::types::string_encoded_len(&self.signer_wallet) as u32;
1022        }
1023        if !self.payload_signature.is_empty() {
1024            size
1025                += 1u32
1026                    + ::buffa::types::bytes_encoded_len(&self.payload_signature) as u32;
1027        }
1028        size += self.__buffa_unknown_fields.encoded_len() as u32;
1029        size
1030    }
1031    fn write_to(
1032        &self,
1033        __cache: &mut ::buffa::SizeCache,
1034        buf: &mut impl ::buffa::bytes::BufMut,
1035    ) {
1036        #[allow(unused_imports)]
1037        use ::buffa::Enumeration as _;
1038        if self.payload.is_set() {
1039            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
1040            self.payload.write_to(__cache, buf);
1041        }
1042        if self.subaccount_id != 0u64 {
1043            ::buffa::types::put_uint64_field(2u32, self.subaccount_id, buf);
1044        }
1045        if !self.signer_wallet.is_empty() {
1046            ::buffa::types::put_string_field(3u32, &self.signer_wallet, buf);
1047        }
1048        if !self.payload_signature.is_empty() {
1049            ::buffa::types::put_bytes_field(4u32, &self.payload_signature, buf);
1050        }
1051        self.__buffa_unknown_fields.write_to(buf);
1052    }
1053    fn merge_field(
1054        &mut self,
1055        tag: ::buffa::encoding::Tag,
1056        buf: &mut impl ::buffa::bytes::Buf,
1057        ctx: ::buffa::DecodeContext<'_>,
1058    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1059        #[allow(unused_imports)]
1060        use ::buffa::bytes::Buf as _;
1061        #[allow(unused_imports)]
1062        use ::buffa::Enumeration as _;
1063        match tag.field_number() {
1064            1u32 => {
1065                ::buffa::encoding::check_wire_type(
1066                    tag,
1067                    ::buffa::encoding::WireType::LengthDelimited,
1068                )?;
1069                ::buffa::Message::merge_length_delimited(
1070                    self.payload.get_or_insert_default(),
1071                    buf,
1072                    ctx,
1073                )?;
1074            }
1075            2u32 => {
1076                ::buffa::encoding::check_wire_type(
1077                    tag,
1078                    ::buffa::encoding::WireType::Varint,
1079                )?;
1080                self.subaccount_id = ::buffa::types::decode_uint64(buf)?;
1081            }
1082            3u32 => {
1083                ::buffa::encoding::check_wire_type(
1084                    tag,
1085                    ::buffa::encoding::WireType::LengthDelimited,
1086                )?;
1087                ::buffa::types::merge_string(&mut self.signer_wallet, buf)?;
1088            }
1089            4u32 => {
1090                ::buffa::encoding::check_wire_type(
1091                    tag,
1092                    ::buffa::encoding::WireType::LengthDelimited,
1093                )?;
1094                ::buffa::types::merge_bytes(&mut self.payload_signature, buf)?;
1095            }
1096            _ => {
1097                self.__buffa_unknown_fields
1098                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1099            }
1100        }
1101        ::core::result::Result::Ok(())
1102    }
1103    fn clear(&mut self) {
1104        self.payload = ::buffa::MessageField::none();
1105        self.subaccount_id = 0u64;
1106        self.signer_wallet.clear();
1107        self.payload_signature.clear();
1108        self.__buffa_unknown_fields.clear();
1109    }
1110}
1111impl ::buffa::ExtensionSet for CreateWalletTradingWithdrawRequest {
1112    const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
1113    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1114        &self.__buffa_unknown_fields
1115    }
1116    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1117        &mut self.__buffa_unknown_fields
1118    }
1119}
1120impl ::buffa::json_helpers::ProtoElemJson for CreateWalletTradingWithdrawRequest {
1121    fn serialize_proto_json<S: ::serde::Serializer>(
1122        v: &Self,
1123        s: S,
1124    ) -> ::core::result::Result<S::Ok, S::Error> {
1125        ::serde::Serialize::serialize(v, s)
1126    }
1127    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1128        d: D,
1129    ) -> ::core::result::Result<Self, D::Error> {
1130        <Self as ::serde::Deserialize>::deserialize(d)
1131    }
1132}
1133#[doc(hidden)]
1134pub const __CREATE_WALLET_TRADING_WITHDRAW_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1135    type_url: "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest",
1136    to_json: ::buffa::type_registry::any_to_json::<CreateWalletTradingWithdrawRequest>,
1137    from_json: ::buffa::type_registry::any_from_json::<
1138        CreateWalletTradingWithdrawRequest,
1139    >,
1140    is_wkt: false,
1141};
1142#[allow(
1143    non_camel_case_types,
1144    dead_code,
1145    unused_imports,
1146    unused_qualifications,
1147    clippy::derivable_impls,
1148    clippy::match_single_binding,
1149    clippy::uninlined_format_args,
1150    clippy::doc_lazy_continuation,
1151    clippy::module_inception
1152)]
1153pub mod __buffa {
1154    #[allow(unused_imports)]
1155    use super::*;
1156    pub mod view {
1157        #[allow(unused_imports)]
1158        use super::*;
1159        /// CreateTradingWithdrawResponse returns the accepted durable intent identifier
1160        /// for the withdraw lifecycle.
1161        #[derive(Clone, Debug, Default)]
1162        pub struct CreateTradingWithdrawResponseView<'a> {
1163            /// Stable server-owned intent identifier for the accepted withdraw lifecycle.
1164            /// Clients use this id to follow later progress for the same withdraw flow.
1165            ///
1166            /// Field 1: `intent_id`
1167            pub intent_id: &'a str,
1168            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1169        }
1170        impl<'a> ::buffa::MessageView<'a> for CreateTradingWithdrawResponseView<'a> {
1171            type Owned = super::super::CreateTradingWithdrawResponse;
1172            fn decode_view(
1173                buf: &'a [u8],
1174            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1175                let __limit = ::core::cell::Cell::new(
1176                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
1177                );
1178                <Self as ::buffa::MessageView>::decode_view_ctx(
1179                    buf,
1180                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1181                )
1182            }
1183            fn decode_view_with_ctx(
1184                buf: &'a [u8],
1185                ctx: ::buffa::DecodeContext<'_>,
1186            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1187                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1188            }
1189            fn merge_view_field(
1190                &mut self,
1191                tag: ::buffa::encoding::Tag,
1192                cur: &'a [u8],
1193                before_tag: &'a [u8],
1194                ctx: ::buffa::DecodeContext<'_>,
1195            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1196                let _ = ctx;
1197                #[allow(unused_variables)]
1198                let view = self;
1199                let mut cur = cur;
1200                match tag.field_number() {
1201                    1u32 => {
1202                        ::buffa::encoding::check_wire_type(
1203                            tag,
1204                            ::buffa::encoding::WireType::LengthDelimited,
1205                        )?;
1206                        view.intent_id = ::buffa::types::borrow_str(&mut cur)?;
1207                    }
1208                    _ => {
1209                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1210                        let span_len = before_tag.len() - cur.len();
1211                        view.__buffa_unknown_fields
1212                            .push_record(before_tag, span_len, ctx)?;
1213                    }
1214                }
1215                ::core::result::Result::Ok(cur)
1216            }
1217            fn to_owned_message(
1218                &self,
1219            ) -> ::core::result::Result<
1220                super::super::CreateTradingWithdrawResponse,
1221                ::buffa::DecodeError,
1222            > {
1223                self.to_owned_from_source(None)
1224            }
1225            #[allow(clippy::useless_conversion, clippy::needless_update)]
1226            fn to_owned_from_source(
1227                &self,
1228                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1229            ) -> ::core::result::Result<
1230                super::super::CreateTradingWithdrawResponse,
1231                ::buffa::DecodeError,
1232            > {
1233                #[allow(unused_imports)]
1234                use ::buffa::alloc::string::ToString as _;
1235                let _ = __buffa_src;
1236                ::core::result::Result::Ok(super::super::CreateTradingWithdrawResponse {
1237                    intent_id: self.intent_id.to_string(),
1238                    __buffa_unknown_fields: self
1239                        .__buffa_unknown_fields
1240                        .to_owned()?
1241                        .into(),
1242                    ..::core::default::Default::default()
1243                })
1244            }
1245        }
1246        impl<'a> ::buffa::ViewEncode<'a> for CreateTradingWithdrawResponseView<'a> {
1247            #[allow(clippy::needless_borrow, clippy::let_and_return)]
1248            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1249                #[allow(unused_imports)]
1250                use ::buffa::Enumeration as _;
1251                let mut size = 0u32;
1252                if !self.intent_id.is_empty() {
1253                    size
1254                        += 1u32
1255                            + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
1256                }
1257                size += self.__buffa_unknown_fields.encoded_len() as u32;
1258                size
1259            }
1260            #[allow(clippy::needless_borrow)]
1261            fn write_to(
1262                &self,
1263                _cache: &mut ::buffa::SizeCache,
1264                buf: &mut impl ::buffa::bytes::BufMut,
1265            ) {
1266                #[allow(unused_imports)]
1267                use ::buffa::Enumeration as _;
1268                if !self.intent_id.is_empty() {
1269                    ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
1270                }
1271                self.__buffa_unknown_fields.write_to(buf);
1272            }
1273        }
1274        /// Serializes this view as protobuf JSON.
1275        ///
1276        /// Implicit-presence fields with default values are omitted, `required`
1277        /// fields are always emitted, explicit-presence (`optional`) fields are
1278        /// emitted only when set, bytes fields are base64-encoded, and enum
1279        /// values are their proto name strings.
1280        ///
1281        /// This impl uses `serialize_map(None)` because the number of emitted
1282        /// fields depends on default-omission rules; serializers that require
1283        /// known map lengths (e.g. `bincode`) will return a runtime error.
1284        /// Use the owned message type for those formats.
1285        impl<'__a> ::serde::Serialize for CreateTradingWithdrawResponseView<'__a> {
1286            fn serialize<__S: ::serde::Serializer>(
1287                &self,
1288                __s: __S,
1289            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1290                use ::serde::ser::SerializeMap as _;
1291                let mut __map = __s.serialize_map(::core::option::Option::None)?;
1292                if !::buffa::json_helpers::skip_if::is_empty_str(self.intent_id) {
1293                    __map.serialize_entry("intentId", self.intent_id)?;
1294                }
1295                __map.end()
1296            }
1297        }
1298        impl<'a> ::buffa::MessageName for CreateTradingWithdrawResponseView<'a> {
1299            const PACKAGE: &'static str = "chain.withdraw.v1";
1300            const NAME: &'static str = "CreateTradingWithdrawResponse";
1301            const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
1302            const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
1303        }
1304        ::buffa::impl_default_view_instance!(CreateTradingWithdrawResponseView);
1305        ::buffa::impl_view_reborrow!(CreateTradingWithdrawResponseView);
1306        /** Self-contained, `'static` owned view of a `CreateTradingWithdrawResponse` message.
1307
1308 Wraps [`::buffa::OwnedView`]`<`[`CreateTradingWithdrawResponseView`]`<'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.
1309
1310 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateTradingWithdrawResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
1311        #[derive(Clone, Debug)]
1312        pub struct CreateTradingWithdrawResponseOwnedView(
1313            ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
1314        );
1315        impl CreateTradingWithdrawResponseOwnedView {
1316            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
1317            ///
1318            /// The view borrows directly from the buffer's data; the buffer is
1319            /// retained inside the returned handle.
1320            ///
1321            /// # Errors
1322            ///
1323            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
1324            /// protobuf data.
1325            pub fn decode(
1326                bytes: ::buffa::bytes::Bytes,
1327            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1328                ::core::result::Result::Ok(
1329                    CreateTradingWithdrawResponseOwnedView(
1330                        ::buffa::OwnedView::decode(bytes)?,
1331                    ),
1332                )
1333            }
1334            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
1335            /// max message size).
1336            ///
1337            /// # Errors
1338            ///
1339            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
1340            /// exceeds the configured limits.
1341            pub fn decode_with_options(
1342                bytes: ::buffa::bytes::Bytes,
1343                opts: &::buffa::DecodeOptions,
1344            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1345                ::core::result::Result::Ok(
1346                    CreateTradingWithdrawResponseOwnedView(
1347                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
1348                    ),
1349                )
1350            }
1351            /// Build from an owned message via an encode → decode round-trip.
1352            ///
1353            /// # Errors
1354            ///
1355            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
1356            /// somehow invalid (should not happen for well-formed messages).
1357            pub fn from_owned(
1358                msg: &super::super::CreateTradingWithdrawResponse,
1359            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1360                ::core::result::Result::Ok(
1361                    CreateTradingWithdrawResponseOwnedView(
1362                        ::buffa::OwnedView::from_owned(msg)?,
1363                    ),
1364                )
1365            }
1366            /// Borrow the full [`CreateTradingWithdrawResponseView`] with its lifetime tied to `&self`.
1367            #[must_use]
1368            pub fn view(&self) -> &CreateTradingWithdrawResponseView<'_> {
1369                self.0.reborrow()
1370            }
1371            /// Convert to the owned message type.
1372            ///
1373            /// # Errors
1374            ///
1375            /// Returns an error if re-materializing preserved unknown fields
1376            /// fails (e.g. the unknown-field limit is exceeded).
1377            pub fn to_owned_message(
1378                &self,
1379            ) -> ::core::result::Result<
1380                super::super::CreateTradingWithdrawResponse,
1381                ::buffa::DecodeError,
1382            > {
1383                self.0.to_owned_message()
1384            }
1385            /// The underlying bytes buffer.
1386            #[must_use]
1387            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1388                self.0.bytes()
1389            }
1390            /// Consume the handle, returning the underlying bytes buffer.
1391            #[must_use]
1392            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1393                self.0.into_bytes()
1394            }
1395            /// Stable server-owned intent identifier for the accepted withdraw lifecycle.
1396            /// Clients use this id to follow later progress for the same withdraw flow.
1397            ///
1398            /// Field 1: `intent_id`
1399            #[must_use]
1400            pub fn intent_id(&self) -> &'_ str {
1401                self.0.reborrow().intent_id
1402            }
1403        }
1404        impl ::core::convert::From<
1405            ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
1406        > for CreateTradingWithdrawResponseOwnedView {
1407            fn from(
1408                inner: ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
1409            ) -> Self {
1410                CreateTradingWithdrawResponseOwnedView(inner)
1411            }
1412        }
1413        impl ::core::convert::From<CreateTradingWithdrawResponseOwnedView>
1414        for ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>> {
1415            fn from(wrapper: CreateTradingWithdrawResponseOwnedView) -> Self {
1416                wrapper.0
1417            }
1418        }
1419        impl ::core::convert::AsRef<
1420            ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
1421        > for CreateTradingWithdrawResponseOwnedView {
1422            fn as_ref(
1423                &self,
1424            ) -> &::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>> {
1425                &self.0
1426            }
1427        }
1428        impl ::buffa::HasMessageView for super::super::CreateTradingWithdrawResponse {
1429            type View<'a> = CreateTradingWithdrawResponseView<'a>;
1430            type ViewHandle = CreateTradingWithdrawResponseOwnedView;
1431        }
1432        impl ::serde::Serialize for CreateTradingWithdrawResponseOwnedView {
1433            fn serialize<__S: ::serde::Serializer>(
1434                &self,
1435                __s: __S,
1436            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1437                ::serde::Serialize::serialize(&self.0, __s)
1438            }
1439        }
1440        /// CreateWalletTradingWithdrawResponse returns the accepted durable intent
1441        /// identifier for a wallet-authorized withdraw lifecycle.
1442        #[derive(Clone, Debug, Default)]
1443        pub struct CreateWalletTradingWithdrawResponseView<'a> {
1444            /// Stable server-owned intent identifier for the accepted withdraw lifecycle.
1445            /// Clients use this id to follow later progress for the same withdraw flow.
1446            ///
1447            /// Field 1: `intent_id`
1448            pub intent_id: &'a str,
1449            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1450        }
1451        impl<'a> ::buffa::MessageView<'a>
1452        for CreateWalletTradingWithdrawResponseView<'a> {
1453            type Owned = super::super::CreateWalletTradingWithdrawResponse;
1454            fn decode_view(
1455                buf: &'a [u8],
1456            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1457                let __limit = ::core::cell::Cell::new(
1458                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
1459                );
1460                <Self as ::buffa::MessageView>::decode_view_ctx(
1461                    buf,
1462                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1463                )
1464            }
1465            fn decode_view_with_ctx(
1466                buf: &'a [u8],
1467                ctx: ::buffa::DecodeContext<'_>,
1468            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1469                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1470            }
1471            fn merge_view_field(
1472                &mut self,
1473                tag: ::buffa::encoding::Tag,
1474                cur: &'a [u8],
1475                before_tag: &'a [u8],
1476                ctx: ::buffa::DecodeContext<'_>,
1477            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1478                let _ = ctx;
1479                #[allow(unused_variables)]
1480                let view = self;
1481                let mut cur = cur;
1482                match tag.field_number() {
1483                    1u32 => {
1484                        ::buffa::encoding::check_wire_type(
1485                            tag,
1486                            ::buffa::encoding::WireType::LengthDelimited,
1487                        )?;
1488                        view.intent_id = ::buffa::types::borrow_str(&mut cur)?;
1489                    }
1490                    _ => {
1491                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1492                        let span_len = before_tag.len() - cur.len();
1493                        view.__buffa_unknown_fields
1494                            .push_record(before_tag, span_len, ctx)?;
1495                    }
1496                }
1497                ::core::result::Result::Ok(cur)
1498            }
1499            fn to_owned_message(
1500                &self,
1501            ) -> ::core::result::Result<
1502                super::super::CreateWalletTradingWithdrawResponse,
1503                ::buffa::DecodeError,
1504            > {
1505                self.to_owned_from_source(None)
1506            }
1507            #[allow(clippy::useless_conversion, clippy::needless_update)]
1508            fn to_owned_from_source(
1509                &self,
1510                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1511            ) -> ::core::result::Result<
1512                super::super::CreateWalletTradingWithdrawResponse,
1513                ::buffa::DecodeError,
1514            > {
1515                #[allow(unused_imports)]
1516                use ::buffa::alloc::string::ToString as _;
1517                let _ = __buffa_src;
1518                ::core::result::Result::Ok(super::super::CreateWalletTradingWithdrawResponse {
1519                    intent_id: self.intent_id.to_string(),
1520                    __buffa_unknown_fields: self
1521                        .__buffa_unknown_fields
1522                        .to_owned()?
1523                        .into(),
1524                    ..::core::default::Default::default()
1525                })
1526            }
1527        }
1528        impl<'a> ::buffa::ViewEncode<'a>
1529        for CreateWalletTradingWithdrawResponseView<'a> {
1530            #[allow(clippy::needless_borrow, clippy::let_and_return)]
1531            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1532                #[allow(unused_imports)]
1533                use ::buffa::Enumeration as _;
1534                let mut size = 0u32;
1535                if !self.intent_id.is_empty() {
1536                    size
1537                        += 1u32
1538                            + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
1539                }
1540                size += self.__buffa_unknown_fields.encoded_len() as u32;
1541                size
1542            }
1543            #[allow(clippy::needless_borrow)]
1544            fn write_to(
1545                &self,
1546                _cache: &mut ::buffa::SizeCache,
1547                buf: &mut impl ::buffa::bytes::BufMut,
1548            ) {
1549                #[allow(unused_imports)]
1550                use ::buffa::Enumeration as _;
1551                if !self.intent_id.is_empty() {
1552                    ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
1553                }
1554                self.__buffa_unknown_fields.write_to(buf);
1555            }
1556        }
1557        /// Serializes this view as protobuf JSON.
1558        ///
1559        /// Implicit-presence fields with default values are omitted, `required`
1560        /// fields are always emitted, explicit-presence (`optional`) fields are
1561        /// emitted only when set, bytes fields are base64-encoded, and enum
1562        /// values are their proto name strings.
1563        ///
1564        /// This impl uses `serialize_map(None)` because the number of emitted
1565        /// fields depends on default-omission rules; serializers that require
1566        /// known map lengths (e.g. `bincode`) will return a runtime error.
1567        /// Use the owned message type for those formats.
1568        impl<'__a> ::serde::Serialize for CreateWalletTradingWithdrawResponseView<'__a> {
1569            fn serialize<__S: ::serde::Serializer>(
1570                &self,
1571                __s: __S,
1572            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1573                use ::serde::ser::SerializeMap as _;
1574                let mut __map = __s.serialize_map(::core::option::Option::None)?;
1575                if !::buffa::json_helpers::skip_if::is_empty_str(self.intent_id) {
1576                    __map.serialize_entry("intentId", self.intent_id)?;
1577                }
1578                __map.end()
1579            }
1580        }
1581        impl<'a> ::buffa::MessageName for CreateWalletTradingWithdrawResponseView<'a> {
1582            const PACKAGE: &'static str = "chain.withdraw.v1";
1583            const NAME: &'static str = "CreateWalletTradingWithdrawResponse";
1584            const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
1585            const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
1586        }
1587        ::buffa::impl_default_view_instance!(CreateWalletTradingWithdrawResponseView);
1588        ::buffa::impl_view_reborrow!(CreateWalletTradingWithdrawResponseView);
1589        /** Self-contained, `'static` owned view of a `CreateWalletTradingWithdrawResponse` message.
1590
1591 Wraps [`::buffa::OwnedView`]`<`[`CreateWalletTradingWithdrawResponseView`]`<'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.
1592
1593 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateWalletTradingWithdrawResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
1594        #[derive(Clone, Debug)]
1595        pub struct CreateWalletTradingWithdrawResponseOwnedView(
1596            ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
1597        );
1598        impl CreateWalletTradingWithdrawResponseOwnedView {
1599            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
1600            ///
1601            /// The view borrows directly from the buffer's data; the buffer is
1602            /// retained inside the returned handle.
1603            ///
1604            /// # Errors
1605            ///
1606            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
1607            /// protobuf data.
1608            pub fn decode(
1609                bytes: ::buffa::bytes::Bytes,
1610            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1611                ::core::result::Result::Ok(
1612                    CreateWalletTradingWithdrawResponseOwnedView(
1613                        ::buffa::OwnedView::decode(bytes)?,
1614                    ),
1615                )
1616            }
1617            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
1618            /// max message size).
1619            ///
1620            /// # Errors
1621            ///
1622            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
1623            /// exceeds the configured limits.
1624            pub fn decode_with_options(
1625                bytes: ::buffa::bytes::Bytes,
1626                opts: &::buffa::DecodeOptions,
1627            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1628                ::core::result::Result::Ok(
1629                    CreateWalletTradingWithdrawResponseOwnedView(
1630                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
1631                    ),
1632                )
1633            }
1634            /// Build from an owned message via an encode → decode round-trip.
1635            ///
1636            /// # Errors
1637            ///
1638            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
1639            /// somehow invalid (should not happen for well-formed messages).
1640            pub fn from_owned(
1641                msg: &super::super::CreateWalletTradingWithdrawResponse,
1642            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1643                ::core::result::Result::Ok(
1644                    CreateWalletTradingWithdrawResponseOwnedView(
1645                        ::buffa::OwnedView::from_owned(msg)?,
1646                    ),
1647                )
1648            }
1649            /// Borrow the full [`CreateWalletTradingWithdrawResponseView`] with its lifetime tied to `&self`.
1650            #[must_use]
1651            pub fn view(&self) -> &CreateWalletTradingWithdrawResponseView<'_> {
1652                self.0.reborrow()
1653            }
1654            /// Convert to the owned message type.
1655            ///
1656            /// # Errors
1657            ///
1658            /// Returns an error if re-materializing preserved unknown fields
1659            /// fails (e.g. the unknown-field limit is exceeded).
1660            pub fn to_owned_message(
1661                &self,
1662            ) -> ::core::result::Result<
1663                super::super::CreateWalletTradingWithdrawResponse,
1664                ::buffa::DecodeError,
1665            > {
1666                self.0.to_owned_message()
1667            }
1668            /// The underlying bytes buffer.
1669            #[must_use]
1670            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1671                self.0.bytes()
1672            }
1673            /// Consume the handle, returning the underlying bytes buffer.
1674            #[must_use]
1675            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1676                self.0.into_bytes()
1677            }
1678            /// Stable server-owned intent identifier for the accepted withdraw lifecycle.
1679            /// Clients use this id to follow later progress for the same withdraw flow.
1680            ///
1681            /// Field 1: `intent_id`
1682            #[must_use]
1683            pub fn intent_id(&self) -> &'_ str {
1684                self.0.reborrow().intent_id
1685            }
1686        }
1687        impl ::core::convert::From<
1688            ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
1689        > for CreateWalletTradingWithdrawResponseOwnedView {
1690            fn from(
1691                inner: ::buffa::OwnedView<
1692                    CreateWalletTradingWithdrawResponseView<'static>,
1693                >,
1694            ) -> Self {
1695                CreateWalletTradingWithdrawResponseOwnedView(inner)
1696            }
1697        }
1698        impl ::core::convert::From<CreateWalletTradingWithdrawResponseOwnedView>
1699        for ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>> {
1700            fn from(wrapper: CreateWalletTradingWithdrawResponseOwnedView) -> Self {
1701                wrapper.0
1702            }
1703        }
1704        impl ::core::convert::AsRef<
1705            ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
1706        > for CreateWalletTradingWithdrawResponseOwnedView {
1707            fn as_ref(
1708                &self,
1709            ) -> &::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>> {
1710                &self.0
1711            }
1712        }
1713        impl ::buffa::HasMessageView
1714        for super::super::CreateWalletTradingWithdrawResponse {
1715            type View<'a> = CreateWalletTradingWithdrawResponseView<'a>;
1716            type ViewHandle = CreateWalletTradingWithdrawResponseOwnedView;
1717        }
1718        impl ::serde::Serialize for CreateWalletTradingWithdrawResponseOwnedView {
1719            fn serialize<__S: ::serde::Serializer>(
1720                &self,
1721                __s: __S,
1722            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1723                ::serde::Serialize::serialize(&self.0, __s)
1724            }
1725        }
1726        /// TradingWithdrawIntentPayload is the client-signed typed withdraw request.
1727        /// Account scope and backend intent ids are derived server-side.
1728        #[derive(Clone, Debug, Default)]
1729        pub struct TradingWithdrawIntentPayloadView<'a> {
1730            /// Destination for funds leaving Trading.
1731            ///
1732            /// Field 1: `action`
1733            pub action: ::buffa::EnumValue<super::super::TradingWithdrawAction>,
1734            /// Unified asset identifier from Polyester asset metadata. amount_e18 is
1735            /// denominated in this asset at canonical 18-decimal scale.
1736            ///
1737            /// Field 2: `asset_id`
1738            pub asset_id: u32,
1739            /// External network id for TO_EXTERNAL_CHAIN. Omit for TO_FUNDING.
1740            ///
1741            /// Field 3: `destination_chain_id`
1742            pub destination_chain_id: u64,
1743            /// Withdraw amount in canonical 18-decimal unified asset units.
1744            /// For example, 0.5 is encoded as 500000000000000000.
1745            ///
1746            /// Field 4: `amount_e18`
1747            pub amount_e18: ::buffa::MessageFieldView<
1748                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
1749                    'a,
1750                >,
1751            >,
1752            /// Unix timestamp in seconds after which this signed user authorization is no
1753            /// longer accepted by the API. This is separate from the server-owned
1754            /// execution deadline used later for on-chain submission.
1755            ///
1756            /// Field 5: `deadline_ts_sec`
1757            pub deadline_ts_sec: u64,
1758            /// Client-generated unsigned 128-bit nonce bound to the signed request. This
1759            /// is an identifier, not a decimal amount.
1760            ///
1761            /// Field 6: `nonce`
1762            pub nonce: ::buffa::MessageFieldView<
1763                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
1764                    'a,
1765                >,
1766            >,
1767            /// Destination address. For TO_EXTERNAL_CHAIN this is an address on
1768            /// destination_chain_id and is validated according to that network. For
1769            /// TO_FUNDING, omit it to move funds to the selected account's Funding account
1770            /// or provide another Polyester funding address for a Trading-to-Funding
1771            /// transfer.
1772            ///
1773            /// Field 7: `destination_address`
1774            pub destination_address: &'a str,
1775            /// Client-chosen idempotency key. Reusing the same key with the same payload
1776            /// returns the existing withdraw; reusing it with different payload fails.
1777            ///
1778            /// Field 8: `idempotency_key`
1779            pub idempotency_key: &'a str,
1780            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1781        }
1782        impl<'a> ::buffa::MessageView<'a> for TradingWithdrawIntentPayloadView<'a> {
1783            type Owned = super::super::TradingWithdrawIntentPayload;
1784            fn decode_view(
1785                buf: &'a [u8],
1786            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1787                let __limit = ::core::cell::Cell::new(
1788                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
1789                );
1790                <Self as ::buffa::MessageView>::decode_view_ctx(
1791                    buf,
1792                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1793                )
1794            }
1795            fn decode_view_with_ctx(
1796                buf: &'a [u8],
1797                ctx: ::buffa::DecodeContext<'_>,
1798            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1799                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1800            }
1801            fn merge_view_field(
1802                &mut self,
1803                tag: ::buffa::encoding::Tag,
1804                cur: &'a [u8],
1805                before_tag: &'a [u8],
1806                ctx: ::buffa::DecodeContext<'_>,
1807            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1808                let _ = ctx;
1809                #[allow(unused_variables)]
1810                let view = self;
1811                let mut cur = cur;
1812                match tag.field_number() {
1813                    1u32 => {
1814                        ::buffa::encoding::check_wire_type(
1815                            tag,
1816                            ::buffa::encoding::WireType::Varint,
1817                        )?;
1818                        view.action = ::buffa::EnumValue::from(
1819                            ::buffa::types::decode_int32(&mut cur)?,
1820                        );
1821                    }
1822                    2u32 => {
1823                        ::buffa::encoding::check_wire_type(
1824                            tag,
1825                            ::buffa::encoding::WireType::Varint,
1826                        )?;
1827                        view.asset_id = ::buffa::types::decode_uint32(&mut cur)?;
1828                    }
1829                    3u32 => {
1830                        ::buffa::encoding::check_wire_type(
1831                            tag,
1832                            ::buffa::encoding::WireType::Varint,
1833                        )?;
1834                        view.destination_chain_id = ::buffa::types::decode_uint64(
1835                            &mut cur,
1836                        )?;
1837                    }
1838                    4u32 => {
1839                        ::buffa::encoding::check_wire_type(
1840                            tag,
1841                            ::buffa::encoding::WireType::LengthDelimited,
1842                        )?;
1843                        let __sub_ctx = ctx.descend()?;
1844                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1845                        match view.amount_e18.as_mut() {
1846                            Some(existing) => {
1847                                ::buffa::MessageView::merge_into_view(
1848                                    existing,
1849                                    sub,
1850                                    __sub_ctx,
1851                                )?
1852                            }
1853                            None => {
1854                                view.amount_e18 = ::buffa::MessageFieldView::set(
1855                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
1856                                        sub,
1857                                        __sub_ctx,
1858                                    )?,
1859                                );
1860                            }
1861                        }
1862                    }
1863                    5u32 => {
1864                        ::buffa::encoding::check_wire_type(
1865                            tag,
1866                            ::buffa::encoding::WireType::Varint,
1867                        )?;
1868                        view.deadline_ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
1869                    }
1870                    6u32 => {
1871                        ::buffa::encoding::check_wire_type(
1872                            tag,
1873                            ::buffa::encoding::WireType::LengthDelimited,
1874                        )?;
1875                        let __sub_ctx = ctx.descend()?;
1876                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1877                        match view.nonce.as_mut() {
1878                            Some(existing) => {
1879                                ::buffa::MessageView::merge_into_view(
1880                                    existing,
1881                                    sub,
1882                                    __sub_ctx,
1883                                )?
1884                            }
1885                            None => {
1886                                view.nonce = ::buffa::MessageFieldView::set(
1887                                    <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
1888                                        sub,
1889                                        __sub_ctx,
1890                                    )?,
1891                                );
1892                            }
1893                        }
1894                    }
1895                    7u32 => {
1896                        ::buffa::encoding::check_wire_type(
1897                            tag,
1898                            ::buffa::encoding::WireType::LengthDelimited,
1899                        )?;
1900                        view.destination_address = ::buffa::types::borrow_str(&mut cur)?;
1901                    }
1902                    8u32 => {
1903                        ::buffa::encoding::check_wire_type(
1904                            tag,
1905                            ::buffa::encoding::WireType::LengthDelimited,
1906                        )?;
1907                        view.idempotency_key = ::buffa::types::borrow_str(&mut cur)?;
1908                    }
1909                    _ => {
1910                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1911                        let span_len = before_tag.len() - cur.len();
1912                        view.__buffa_unknown_fields
1913                            .push_record(before_tag, span_len, ctx)?;
1914                    }
1915                }
1916                ::core::result::Result::Ok(cur)
1917            }
1918            fn to_owned_message(
1919                &self,
1920            ) -> ::core::result::Result<
1921                super::super::TradingWithdrawIntentPayload,
1922                ::buffa::DecodeError,
1923            > {
1924                self.to_owned_from_source(None)
1925            }
1926            #[allow(clippy::useless_conversion, clippy::needless_update)]
1927            fn to_owned_from_source(
1928                &self,
1929                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1930            ) -> ::core::result::Result<
1931                super::super::TradingWithdrawIntentPayload,
1932                ::buffa::DecodeError,
1933            > {
1934                #[allow(unused_imports)]
1935                use ::buffa::alloc::string::ToString as _;
1936                let _ = __buffa_src;
1937                ::core::result::Result::Ok(super::super::TradingWithdrawIntentPayload {
1938                    action: self.action,
1939                    asset_id: self.asset_id,
1940                    destination_chain_id: self.destination_chain_id,
1941                    amount_e18: match self.amount_e18.as_option() {
1942                        Some(v) => {
1943                            ::buffa::MessageField::<
1944                                super::super::super::super::super::polyester::r#type::v1::U128,
1945                            >::some(v.to_owned_from_source(__buffa_src)?)
1946                        }
1947                        None => ::buffa::MessageField::none(),
1948                    },
1949                    deadline_ts_sec: self.deadline_ts_sec,
1950                    nonce: match self.nonce.as_option() {
1951                        Some(v) => {
1952                            ::buffa::MessageField::<
1953                                super::super::super::super::super::polyester::r#type::v1::U128,
1954                            >::some(v.to_owned_from_source(__buffa_src)?)
1955                        }
1956                        None => ::buffa::MessageField::none(),
1957                    },
1958                    destination_address: self.destination_address.to_string(),
1959                    idempotency_key: self.idempotency_key.to_string(),
1960                    __buffa_unknown_fields: self
1961                        .__buffa_unknown_fields
1962                        .to_owned()?
1963                        .into(),
1964                    ..::core::default::Default::default()
1965                })
1966            }
1967        }
1968        impl<'a> ::buffa::ViewEncode<'a> for TradingWithdrawIntentPayloadView<'a> {
1969            #[allow(clippy::needless_borrow, 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.action.to_i32();
1976                    if val != 0 {
1977                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1978                    }
1979                }
1980                if self.asset_id != 0u32 {
1981                    size
1982                        += 1u32
1983                            + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
1984                }
1985                if self.destination_chain_id != 0u64 {
1986                    size
1987                        += 1u32
1988                            + ::buffa::types::uint64_encoded_len(
1989                                self.destination_chain_id,
1990                            ) as u32;
1991                }
1992                if self.amount_e18.is_set() {
1993                    let __slot = __cache.reserve();
1994                    let inner_size = self.amount_e18.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                if self.deadline_ts_sec != 0u64 {
2001                    size
2002                        += 1u32
2003                            + ::buffa::types::uint64_encoded_len(self.deadline_ts_sec)
2004                                as u32;
2005                }
2006                if self.nonce.is_set() {
2007                    let __slot = __cache.reserve();
2008                    let inner_size = self.nonce.compute_size(__cache);
2009                    __cache.set(__slot, inner_size);
2010                    size
2011                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2012                            + inner_size;
2013                }
2014                if !self.destination_address.is_empty() {
2015                    size
2016                        += 1u32
2017                            + ::buffa::types::string_encoded_len(
2018                                &self.destination_address,
2019                            ) as u32;
2020                }
2021                if !self.idempotency_key.is_empty() {
2022                    size
2023                        += 1u32
2024                            + ::buffa::types::string_encoded_len(&self.idempotency_key)
2025                                as u32;
2026                }
2027                size += self.__buffa_unknown_fields.encoded_len() as u32;
2028                size
2029            }
2030            #[allow(clippy::needless_borrow)]
2031            fn write_to(
2032                &self,
2033                __cache: &mut ::buffa::SizeCache,
2034                buf: &mut impl ::buffa::bytes::BufMut,
2035            ) {
2036                #[allow(unused_imports)]
2037                use ::buffa::Enumeration as _;
2038                {
2039                    let val = self.action.to_i32();
2040                    if val != 0 {
2041                        ::buffa::types::put_int32_field(1u32, val, buf);
2042                    }
2043                }
2044                if self.asset_id != 0u32 {
2045                    ::buffa::types::put_uint32_field(2u32, self.asset_id, buf);
2046                }
2047                if self.destination_chain_id != 0u64 {
2048                    ::buffa::types::put_uint64_field(
2049                        3u32,
2050                        self.destination_chain_id,
2051                        buf,
2052                    );
2053                }
2054                if self.amount_e18.is_set() {
2055                    ::buffa::types::put_len_delimited_header(
2056                        4u32,
2057                        __cache.consume_next(),
2058                        buf,
2059                    );
2060                    self.amount_e18.write_to(__cache, buf);
2061                }
2062                if self.deadline_ts_sec != 0u64 {
2063                    ::buffa::types::put_uint64_field(5u32, self.deadline_ts_sec, buf);
2064                }
2065                if self.nonce.is_set() {
2066                    ::buffa::types::put_len_delimited_header(
2067                        6u32,
2068                        __cache.consume_next(),
2069                        buf,
2070                    );
2071                    self.nonce.write_to(__cache, buf);
2072                }
2073                if !self.destination_address.is_empty() {
2074                    ::buffa::types::put_string_field(
2075                        7u32,
2076                        &self.destination_address,
2077                        buf,
2078                    );
2079                }
2080                if !self.idempotency_key.is_empty() {
2081                    ::buffa::types::put_string_field(8u32, &self.idempotency_key, buf);
2082                }
2083                self.__buffa_unknown_fields.write_to(buf);
2084            }
2085        }
2086        /// Serializes this view as protobuf JSON.
2087        ///
2088        /// Implicit-presence fields with default values are omitted, `required`
2089        /// fields are always emitted, explicit-presence (`optional`) fields are
2090        /// emitted only when set, bytes fields are base64-encoded, and enum
2091        /// values are their proto name strings.
2092        ///
2093        /// This impl uses `serialize_map(None)` because the number of emitted
2094        /// fields depends on default-omission rules; serializers that require
2095        /// known map lengths (e.g. `bincode`) will return a runtime error.
2096        /// Use the owned message type for those formats.
2097        impl<'__a> ::serde::Serialize for TradingWithdrawIntentPayloadView<'__a> {
2098            fn serialize<__S: ::serde::Serializer>(
2099                &self,
2100                __s: __S,
2101            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2102                use ::serde::ser::SerializeMap as _;
2103                let mut __map = __s.serialize_map(::core::option::Option::None)?;
2104                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.action) {
2105                    __map.serialize_entry("action", &self.action)?;
2106                }
2107                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.asset_id) {
2108                    __map
2109                        .serialize_entry(
2110                            "assetId",
2111                            &::buffa::json_helpers::ProtoJson(&self.asset_id),
2112                        )?;
2113                }
2114                if !::buffa::json_helpers::skip_if::is_zero_u64(
2115                    &self.destination_chain_id,
2116                ) {
2117                    __map
2118                        .serialize_entry(
2119                            "destinationChainId",
2120                            &::buffa::json_helpers::ProtoJson(&self.destination_chain_id),
2121                        )?;
2122                }
2123                {
2124                    if let ::core::option::Option::Some(__v) = self
2125                        .amount_e18
2126                        .as_option()
2127                    {
2128                        __map.serialize_entry("amountE18", __v)?;
2129                    }
2130                }
2131                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.deadline_ts_sec) {
2132                    __map
2133                        .serialize_entry(
2134                            "deadlineTsSec",
2135                            &::buffa::json_helpers::ProtoJson(&self.deadline_ts_sec),
2136                        )?;
2137                }
2138                {
2139                    if let ::core::option::Option::Some(__v) = self.nonce.as_option() {
2140                        __map.serialize_entry("nonce", __v)?;
2141                    }
2142                }
2143                if !::buffa::json_helpers::skip_if::is_empty_str(
2144                    self.destination_address,
2145                ) {
2146                    __map
2147                        .serialize_entry(
2148                            "destinationAddress",
2149                            self.destination_address,
2150                        )?;
2151                }
2152                if !::buffa::json_helpers::skip_if::is_empty_str(self.idempotency_key) {
2153                    __map.serialize_entry("idempotencyKey", self.idempotency_key)?;
2154                }
2155                __map.end()
2156            }
2157        }
2158        impl<'a> ::buffa::MessageName for TradingWithdrawIntentPayloadView<'a> {
2159            const PACKAGE: &'static str = "chain.withdraw.v1";
2160            const NAME: &'static str = "TradingWithdrawIntentPayload";
2161            const FULL_NAME: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
2162            const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
2163        }
2164        ::buffa::impl_default_view_instance!(TradingWithdrawIntentPayloadView);
2165        ::buffa::impl_view_reborrow!(TradingWithdrawIntentPayloadView);
2166        /** Self-contained, `'static` owned view of a `TradingWithdrawIntentPayload` message.
2167
2168 Wraps [`::buffa::OwnedView`]`<`[`TradingWithdrawIntentPayloadView`]`<'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.
2169
2170 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TradingWithdrawIntentPayloadView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
2171        #[derive(Clone, Debug)]
2172        pub struct TradingWithdrawIntentPayloadOwnedView(
2173            ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2174        );
2175        impl TradingWithdrawIntentPayloadOwnedView {
2176            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
2177            ///
2178            /// The view borrows directly from the buffer's data; the buffer is
2179            /// retained inside the returned handle.
2180            ///
2181            /// # Errors
2182            ///
2183            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
2184            /// protobuf data.
2185            pub fn decode(
2186                bytes: ::buffa::bytes::Bytes,
2187            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2188                ::core::result::Result::Ok(
2189                    TradingWithdrawIntentPayloadOwnedView(
2190                        ::buffa::OwnedView::decode(bytes)?,
2191                    ),
2192                )
2193            }
2194            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
2195            /// max message size).
2196            ///
2197            /// # Errors
2198            ///
2199            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
2200            /// exceeds the configured limits.
2201            pub fn decode_with_options(
2202                bytes: ::buffa::bytes::Bytes,
2203                opts: &::buffa::DecodeOptions,
2204            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2205                ::core::result::Result::Ok(
2206                    TradingWithdrawIntentPayloadOwnedView(
2207                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
2208                    ),
2209                )
2210            }
2211            /// Build from an owned message via an encode → decode round-trip.
2212            ///
2213            /// # Errors
2214            ///
2215            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
2216            /// somehow invalid (should not happen for well-formed messages).
2217            pub fn from_owned(
2218                msg: &super::super::TradingWithdrawIntentPayload,
2219            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2220                ::core::result::Result::Ok(
2221                    TradingWithdrawIntentPayloadOwnedView(
2222                        ::buffa::OwnedView::from_owned(msg)?,
2223                    ),
2224                )
2225            }
2226            /// Borrow the full [`TradingWithdrawIntentPayloadView`] with its lifetime tied to `&self`.
2227            #[must_use]
2228            pub fn view(&self) -> &TradingWithdrawIntentPayloadView<'_> {
2229                self.0.reborrow()
2230            }
2231            /// Convert to the owned message type.
2232            ///
2233            /// # Errors
2234            ///
2235            /// Returns an error if re-materializing preserved unknown fields
2236            /// fails (e.g. the unknown-field limit is exceeded).
2237            pub fn to_owned_message(
2238                &self,
2239            ) -> ::core::result::Result<
2240                super::super::TradingWithdrawIntentPayload,
2241                ::buffa::DecodeError,
2242            > {
2243                self.0.to_owned_message()
2244            }
2245            /// The underlying bytes buffer.
2246            #[must_use]
2247            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2248                self.0.bytes()
2249            }
2250            /// Consume the handle, returning the underlying bytes buffer.
2251            #[must_use]
2252            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2253                self.0.into_bytes()
2254            }
2255            /// Destination for funds leaving Trading.
2256            ///
2257            /// Field 1: `action`
2258            #[must_use]
2259            pub fn action(
2260                &self,
2261            ) -> ::buffa::EnumValue<super::super::TradingWithdrawAction> {
2262                self.0.reborrow().action
2263            }
2264            /// Unified asset identifier from Polyester asset metadata. amount_e18 is
2265            /// denominated in this asset at canonical 18-decimal scale.
2266            ///
2267            /// Field 2: `asset_id`
2268            #[must_use]
2269            pub fn asset_id(&self) -> u32 {
2270                self.0.reborrow().asset_id
2271            }
2272            /// External network id for TO_EXTERNAL_CHAIN. Omit for TO_FUNDING.
2273            ///
2274            /// Field 3: `destination_chain_id`
2275            #[must_use]
2276            pub fn destination_chain_id(&self) -> u64 {
2277                self.0.reborrow().destination_chain_id
2278            }
2279            /// Withdraw amount in canonical 18-decimal unified asset units.
2280            /// For example, 0.5 is encoded as 500000000000000000.
2281            ///
2282            /// Field 4: `amount_e18`
2283            #[must_use]
2284            pub fn amount_e18(
2285                &self,
2286            ) -> &::buffa::MessageFieldView<
2287                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
2288                    '_,
2289                >,
2290            > {
2291                &self.0.reborrow().amount_e18
2292            }
2293            /// Unix timestamp in seconds after which this signed user authorization is no
2294            /// longer accepted by the API. This is separate from the server-owned
2295            /// execution deadline used later for on-chain submission.
2296            ///
2297            /// Field 5: `deadline_ts_sec`
2298            #[must_use]
2299            pub fn deadline_ts_sec(&self) -> u64 {
2300                self.0.reborrow().deadline_ts_sec
2301            }
2302            /// Client-generated unsigned 128-bit nonce bound to the signed request. This
2303            /// is an identifier, not a decimal amount.
2304            ///
2305            /// Field 6: `nonce`
2306            #[must_use]
2307            pub fn nonce(
2308                &self,
2309            ) -> &::buffa::MessageFieldView<
2310                super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
2311                    '_,
2312                >,
2313            > {
2314                &self.0.reborrow().nonce
2315            }
2316            /// Destination address. For TO_EXTERNAL_CHAIN this is an address on
2317            /// destination_chain_id and is validated according to that network. For
2318            /// TO_FUNDING, omit it to move funds to the selected account's Funding account
2319            /// or provide another Polyester funding address for a Trading-to-Funding
2320            /// transfer.
2321            ///
2322            /// Field 7: `destination_address`
2323            #[must_use]
2324            pub fn destination_address(&self) -> &'_ str {
2325                self.0.reborrow().destination_address
2326            }
2327            /// Client-chosen idempotency key. Reusing the same key with the same payload
2328            /// returns the existing withdraw; reusing it with different payload fails.
2329            ///
2330            /// Field 8: `idempotency_key`
2331            #[must_use]
2332            pub fn idempotency_key(&self) -> &'_ str {
2333                self.0.reborrow().idempotency_key
2334            }
2335        }
2336        impl ::core::convert::From<
2337            ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2338        > for TradingWithdrawIntentPayloadOwnedView {
2339            fn from(
2340                inner: ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2341            ) -> Self {
2342                TradingWithdrawIntentPayloadOwnedView(inner)
2343            }
2344        }
2345        impl ::core::convert::From<TradingWithdrawIntentPayloadOwnedView>
2346        for ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>> {
2347            fn from(wrapper: TradingWithdrawIntentPayloadOwnedView) -> Self {
2348                wrapper.0
2349            }
2350        }
2351        impl ::core::convert::AsRef<
2352            ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2353        > for TradingWithdrawIntentPayloadOwnedView {
2354            fn as_ref(
2355                &self,
2356            ) -> &::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>> {
2357                &self.0
2358            }
2359        }
2360        impl ::buffa::HasMessageView for super::super::TradingWithdrawIntentPayload {
2361            type View<'a> = TradingWithdrawIntentPayloadView<'a>;
2362            type ViewHandle = TradingWithdrawIntentPayloadOwnedView;
2363        }
2364        impl ::serde::Serialize for TradingWithdrawIntentPayloadOwnedView {
2365            fn serialize<__S: ::serde::Serializer>(
2366                &self,
2367                __s: __S,
2368            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2369                ::serde::Serialize::serialize(&self.0, __s)
2370            }
2371        }
2372        /// CreateTradingWithdrawRequest creates or returns one durable backend-authorized
2373        /// Trading withdraw intent from typed protobuf fields and an API-key signature.
2374        #[derive(Clone, Debug, Default)]
2375        pub struct CreateTradingWithdrawRequestView<'a> {
2376            /// Client-signed withdraw details.
2377            ///
2378            /// Field 1: `payload`
2379            pub payload: ::buffa::MessageFieldView<
2380                super::super::__buffa::view::TradingWithdrawIntentPayloadView<'a>,
2381            >,
2382            /// User/API signature over deterministic TradingWithdrawIntentPayload bytes.
2383            ///
2384            /// Field 2: `payload_signature`
2385            pub payload_signature: &'a [u8],
2386            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2387        }
2388        impl<'a> ::buffa::MessageView<'a> for CreateTradingWithdrawRequestView<'a> {
2389            type Owned = super::super::CreateTradingWithdrawRequest;
2390            fn decode_view(
2391                buf: &'a [u8],
2392            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2393                let __limit = ::core::cell::Cell::new(
2394                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
2395                );
2396                <Self as ::buffa::MessageView>::decode_view_ctx(
2397                    buf,
2398                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
2399                )
2400            }
2401            fn decode_view_with_ctx(
2402                buf: &'a [u8],
2403                ctx: ::buffa::DecodeContext<'_>,
2404            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2405                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2406            }
2407            fn merge_view_field(
2408                &mut self,
2409                tag: ::buffa::encoding::Tag,
2410                cur: &'a [u8],
2411                before_tag: &'a [u8],
2412                ctx: ::buffa::DecodeContext<'_>,
2413            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2414                let _ = ctx;
2415                #[allow(unused_variables)]
2416                let view = self;
2417                let mut cur = cur;
2418                match tag.field_number() {
2419                    1u32 => {
2420                        ::buffa::encoding::check_wire_type(
2421                            tag,
2422                            ::buffa::encoding::WireType::LengthDelimited,
2423                        )?;
2424                        let __sub_ctx = ctx.descend()?;
2425                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2426                        match view.payload.as_mut() {
2427                            Some(existing) => {
2428                                ::buffa::MessageView::merge_into_view(
2429                                    existing,
2430                                    sub,
2431                                    __sub_ctx,
2432                                )?
2433                            }
2434                            None => {
2435                                view.payload = ::buffa::MessageFieldView::set(
2436                                    <super::super::__buffa::view::TradingWithdrawIntentPayloadView as ::buffa::MessageView>::decode_view_ctx(
2437                                        sub,
2438                                        __sub_ctx,
2439                                    )?,
2440                                );
2441                            }
2442                        }
2443                    }
2444                    2u32 => {
2445                        ::buffa::encoding::check_wire_type(
2446                            tag,
2447                            ::buffa::encoding::WireType::LengthDelimited,
2448                        )?;
2449                        view.payload_signature = ::buffa::types::borrow_bytes(&mut cur)?;
2450                    }
2451                    _ => {
2452                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
2453                        let span_len = before_tag.len() - cur.len();
2454                        view.__buffa_unknown_fields
2455                            .push_record(before_tag, span_len, ctx)?;
2456                    }
2457                }
2458                ::core::result::Result::Ok(cur)
2459            }
2460            fn to_owned_message(
2461                &self,
2462            ) -> ::core::result::Result<
2463                super::super::CreateTradingWithdrawRequest,
2464                ::buffa::DecodeError,
2465            > {
2466                self.to_owned_from_source(None)
2467            }
2468            #[allow(clippy::useless_conversion, clippy::needless_update)]
2469            fn to_owned_from_source(
2470                &self,
2471                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2472            ) -> ::core::result::Result<
2473                super::super::CreateTradingWithdrawRequest,
2474                ::buffa::DecodeError,
2475            > {
2476                #[allow(unused_imports)]
2477                use ::buffa::alloc::string::ToString as _;
2478                let _ = __buffa_src;
2479                ::core::result::Result::Ok(super::super::CreateTradingWithdrawRequest {
2480                    payload: match self.payload.as_option() {
2481                        Some(v) => {
2482                            ::buffa::MessageField::<
2483                                super::super::TradingWithdrawIntentPayload,
2484                            >::some(v.to_owned_from_source(__buffa_src)?)
2485                        }
2486                        None => ::buffa::MessageField::none(),
2487                    },
2488                    payload_signature: (self.payload_signature).to_vec(),
2489                    __buffa_unknown_fields: self
2490                        .__buffa_unknown_fields
2491                        .to_owned()?
2492                        .into(),
2493                    ..::core::default::Default::default()
2494                })
2495            }
2496        }
2497        impl<'a> ::buffa::ViewEncode<'a> for CreateTradingWithdrawRequestView<'a> {
2498            #[allow(clippy::needless_borrow, clippy::let_and_return)]
2499            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2500                #[allow(unused_imports)]
2501                use ::buffa::Enumeration as _;
2502                let mut size = 0u32;
2503                if self.payload.is_set() {
2504                    let __slot = __cache.reserve();
2505                    let inner_size = self.payload.compute_size(__cache);
2506                    __cache.set(__slot, inner_size);
2507                    size
2508                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2509                            + inner_size;
2510                }
2511                if !self.payload_signature.is_empty() {
2512                    size
2513                        += 1u32
2514                            + ::buffa::types::bytes_encoded_len(&self.payload_signature)
2515                                as u32;
2516                }
2517                size += self.__buffa_unknown_fields.encoded_len() as u32;
2518                size
2519            }
2520            #[allow(clippy::needless_borrow)]
2521            fn write_to(
2522                &self,
2523                __cache: &mut ::buffa::SizeCache,
2524                buf: &mut impl ::buffa::bytes::BufMut,
2525            ) {
2526                #[allow(unused_imports)]
2527                use ::buffa::Enumeration as _;
2528                if self.payload.is_set() {
2529                    ::buffa::types::put_len_delimited_header(
2530                        1u32,
2531                        __cache.consume_next(),
2532                        buf,
2533                    );
2534                    self.payload.write_to(__cache, buf);
2535                }
2536                if !self.payload_signature.is_empty() {
2537                    ::buffa::types::put_bytes_field(2u32, &self.payload_signature, buf);
2538                }
2539                self.__buffa_unknown_fields.write_to(buf);
2540            }
2541        }
2542        /// Serializes this view as protobuf JSON.
2543        ///
2544        /// Implicit-presence fields with default values are omitted, `required`
2545        /// fields are always emitted, explicit-presence (`optional`) fields are
2546        /// emitted only when set, bytes fields are base64-encoded, and enum
2547        /// values are their proto name strings.
2548        ///
2549        /// This impl uses `serialize_map(None)` because the number of emitted
2550        /// fields depends on default-omission rules; serializers that require
2551        /// known map lengths (e.g. `bincode`) will return a runtime error.
2552        /// Use the owned message type for those formats.
2553        impl<'__a> ::serde::Serialize for CreateTradingWithdrawRequestView<'__a> {
2554            fn serialize<__S: ::serde::Serializer>(
2555                &self,
2556                __s: __S,
2557            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2558                use ::serde::ser::SerializeMap as _;
2559                let mut __map = __s.serialize_map(::core::option::Option::None)?;
2560                {
2561                    if let ::core::option::Option::Some(__v) = self.payload.as_option() {
2562                        __map.serialize_entry("payload", __v)?;
2563                    }
2564                }
2565                if !::buffa::json_helpers::skip_if::is_empty_bytes(
2566                    self.payload_signature,
2567                ) {
2568                    __map
2569                        .serialize_entry(
2570                            "payloadSignature",
2571                            &::buffa::json_helpers::BytesJson(self.payload_signature),
2572                        )?;
2573                }
2574                __map.end()
2575            }
2576        }
2577        impl<'a> ::buffa::MessageName for CreateTradingWithdrawRequestView<'a> {
2578            const PACKAGE: &'static str = "chain.withdraw.v1";
2579            const NAME: &'static str = "CreateTradingWithdrawRequest";
2580            const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
2581            const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
2582        }
2583        ::buffa::impl_default_view_instance!(CreateTradingWithdrawRequestView);
2584        ::buffa::impl_view_reborrow!(CreateTradingWithdrawRequestView);
2585        /** Self-contained, `'static` owned view of a `CreateTradingWithdrawRequest` message.
2586
2587 Wraps [`::buffa::OwnedView`]`<`[`CreateTradingWithdrawRequestView`]`<'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.
2588
2589 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateTradingWithdrawRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
2590        #[derive(Clone, Debug)]
2591        pub struct CreateTradingWithdrawRequestOwnedView(
2592            ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
2593        );
2594        impl CreateTradingWithdrawRequestOwnedView {
2595            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
2596            ///
2597            /// The view borrows directly from the buffer's data; the buffer is
2598            /// retained inside the returned handle.
2599            ///
2600            /// # Errors
2601            ///
2602            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
2603            /// protobuf data.
2604            pub fn decode(
2605                bytes: ::buffa::bytes::Bytes,
2606            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2607                ::core::result::Result::Ok(
2608                    CreateTradingWithdrawRequestOwnedView(
2609                        ::buffa::OwnedView::decode(bytes)?,
2610                    ),
2611                )
2612            }
2613            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
2614            /// max message size).
2615            ///
2616            /// # Errors
2617            ///
2618            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
2619            /// exceeds the configured limits.
2620            pub fn decode_with_options(
2621                bytes: ::buffa::bytes::Bytes,
2622                opts: &::buffa::DecodeOptions,
2623            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2624                ::core::result::Result::Ok(
2625                    CreateTradingWithdrawRequestOwnedView(
2626                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
2627                    ),
2628                )
2629            }
2630            /// Build from an owned message via an encode → decode round-trip.
2631            ///
2632            /// # Errors
2633            ///
2634            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
2635            /// somehow invalid (should not happen for well-formed messages).
2636            pub fn from_owned(
2637                msg: &super::super::CreateTradingWithdrawRequest,
2638            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2639                ::core::result::Result::Ok(
2640                    CreateTradingWithdrawRequestOwnedView(
2641                        ::buffa::OwnedView::from_owned(msg)?,
2642                    ),
2643                )
2644            }
2645            /// Borrow the full [`CreateTradingWithdrawRequestView`] with its lifetime tied to `&self`.
2646            #[must_use]
2647            pub fn view(&self) -> &CreateTradingWithdrawRequestView<'_> {
2648                self.0.reborrow()
2649            }
2650            /// Convert to the owned message type.
2651            ///
2652            /// # Errors
2653            ///
2654            /// Returns an error if re-materializing preserved unknown fields
2655            /// fails (e.g. the unknown-field limit is exceeded).
2656            pub fn to_owned_message(
2657                &self,
2658            ) -> ::core::result::Result<
2659                super::super::CreateTradingWithdrawRequest,
2660                ::buffa::DecodeError,
2661            > {
2662                self.0.to_owned_message()
2663            }
2664            /// The underlying bytes buffer.
2665            #[must_use]
2666            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2667                self.0.bytes()
2668            }
2669            /// Consume the handle, returning the underlying bytes buffer.
2670            #[must_use]
2671            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2672                self.0.into_bytes()
2673            }
2674            /// Client-signed withdraw details.
2675            ///
2676            /// Field 1: `payload`
2677            #[must_use]
2678            pub fn payload(
2679                &self,
2680            ) -> &::buffa::MessageFieldView<
2681                super::super::__buffa::view::TradingWithdrawIntentPayloadView<'_>,
2682            > {
2683                &self.0.reborrow().payload
2684            }
2685            /// User/API signature over deterministic TradingWithdrawIntentPayload bytes.
2686            ///
2687            /// Field 2: `payload_signature`
2688            #[must_use]
2689            pub fn payload_signature(&self) -> &'_ [u8] {
2690                self.0.reborrow().payload_signature
2691            }
2692        }
2693        impl ::core::convert::From<
2694            ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
2695        > for CreateTradingWithdrawRequestOwnedView {
2696            fn from(
2697                inner: ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
2698            ) -> Self {
2699                CreateTradingWithdrawRequestOwnedView(inner)
2700            }
2701        }
2702        impl ::core::convert::From<CreateTradingWithdrawRequestOwnedView>
2703        for ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>> {
2704            fn from(wrapper: CreateTradingWithdrawRequestOwnedView) -> Self {
2705                wrapper.0
2706            }
2707        }
2708        impl ::core::convert::AsRef<
2709            ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
2710        > for CreateTradingWithdrawRequestOwnedView {
2711            fn as_ref(
2712                &self,
2713            ) -> &::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>> {
2714                &self.0
2715            }
2716        }
2717        impl ::buffa::HasMessageView for super::super::CreateTradingWithdrawRequest {
2718            type View<'a> = CreateTradingWithdrawRequestView<'a>;
2719            type ViewHandle = CreateTradingWithdrawRequestOwnedView;
2720        }
2721        impl ::serde::Serialize for CreateTradingWithdrawRequestOwnedView {
2722            fn serialize<__S: ::serde::Serializer>(
2723                &self,
2724                __s: __S,
2725            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2726                ::serde::Serialize::serialize(&self.0, __s)
2727            }
2728        }
2729        /// CreateWalletTradingWithdrawRequest creates or returns one durable Trading
2730        /// withdraw intent from typed frontend fields plus a wallet EIP-712 signature.
2731        #[derive(Clone, Debug, Default)]
2732        pub struct CreateWalletTradingWithdrawRequestView<'a> {
2733            /// Client-signed withdraw details.
2734            ///
2735            /// Field 1: `payload`
2736            pub payload: ::buffa::MessageFieldView<
2737                super::super::__buffa::view::TradingWithdrawIntentPayloadView<'a>,
2738            >,
2739            /// Optional public subaccount id. Omit to withdraw from the JWT root account.
2740            ///
2741            /// Field 2: `subaccount_id`
2742            pub subaccount_id: u64,
2743            /// Wallet address that produced payload_signature.
2744            ///
2745            /// Field 3: `signer_wallet`
2746            pub signer_wallet: &'a str,
2747            /// Wallet EIP-712 signature over the typed withdraw payload.
2748            ///
2749            /// Field 4: `payload_signature`
2750            pub payload_signature: &'a [u8],
2751            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2752        }
2753        impl<'a> ::buffa::MessageView<'a>
2754        for CreateWalletTradingWithdrawRequestView<'a> {
2755            type Owned = super::super::CreateWalletTradingWithdrawRequest;
2756            fn decode_view(
2757                buf: &'a [u8],
2758            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2759                let __limit = ::core::cell::Cell::new(
2760                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
2761                );
2762                <Self as ::buffa::MessageView>::decode_view_ctx(
2763                    buf,
2764                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
2765                )
2766            }
2767            fn decode_view_with_ctx(
2768                buf: &'a [u8],
2769                ctx: ::buffa::DecodeContext<'_>,
2770            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2771                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2772            }
2773            fn merge_view_field(
2774                &mut self,
2775                tag: ::buffa::encoding::Tag,
2776                cur: &'a [u8],
2777                before_tag: &'a [u8],
2778                ctx: ::buffa::DecodeContext<'_>,
2779            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2780                let _ = ctx;
2781                #[allow(unused_variables)]
2782                let view = self;
2783                let mut cur = cur;
2784                match tag.field_number() {
2785                    1u32 => {
2786                        ::buffa::encoding::check_wire_type(
2787                            tag,
2788                            ::buffa::encoding::WireType::LengthDelimited,
2789                        )?;
2790                        let __sub_ctx = ctx.descend()?;
2791                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2792                        match view.payload.as_mut() {
2793                            Some(existing) => {
2794                                ::buffa::MessageView::merge_into_view(
2795                                    existing,
2796                                    sub,
2797                                    __sub_ctx,
2798                                )?
2799                            }
2800                            None => {
2801                                view.payload = ::buffa::MessageFieldView::set(
2802                                    <super::super::__buffa::view::TradingWithdrawIntentPayloadView as ::buffa::MessageView>::decode_view_ctx(
2803                                        sub,
2804                                        __sub_ctx,
2805                                    )?,
2806                                );
2807                            }
2808                        }
2809                    }
2810                    2u32 => {
2811                        ::buffa::encoding::check_wire_type(
2812                            tag,
2813                            ::buffa::encoding::WireType::Varint,
2814                        )?;
2815                        view.subaccount_id = ::buffa::types::decode_uint64(&mut cur)?;
2816                    }
2817                    3u32 => {
2818                        ::buffa::encoding::check_wire_type(
2819                            tag,
2820                            ::buffa::encoding::WireType::LengthDelimited,
2821                        )?;
2822                        view.signer_wallet = ::buffa::types::borrow_str(&mut cur)?;
2823                    }
2824                    4u32 => {
2825                        ::buffa::encoding::check_wire_type(
2826                            tag,
2827                            ::buffa::encoding::WireType::LengthDelimited,
2828                        )?;
2829                        view.payload_signature = ::buffa::types::borrow_bytes(&mut cur)?;
2830                    }
2831                    _ => {
2832                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
2833                        let span_len = before_tag.len() - cur.len();
2834                        view.__buffa_unknown_fields
2835                            .push_record(before_tag, span_len, ctx)?;
2836                    }
2837                }
2838                ::core::result::Result::Ok(cur)
2839            }
2840            fn to_owned_message(
2841                &self,
2842            ) -> ::core::result::Result<
2843                super::super::CreateWalletTradingWithdrawRequest,
2844                ::buffa::DecodeError,
2845            > {
2846                self.to_owned_from_source(None)
2847            }
2848            #[allow(clippy::useless_conversion, clippy::needless_update)]
2849            fn to_owned_from_source(
2850                &self,
2851                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2852            ) -> ::core::result::Result<
2853                super::super::CreateWalletTradingWithdrawRequest,
2854                ::buffa::DecodeError,
2855            > {
2856                #[allow(unused_imports)]
2857                use ::buffa::alloc::string::ToString as _;
2858                let _ = __buffa_src;
2859                ::core::result::Result::Ok(super::super::CreateWalletTradingWithdrawRequest {
2860                    payload: match self.payload.as_option() {
2861                        Some(v) => {
2862                            ::buffa::MessageField::<
2863                                super::super::TradingWithdrawIntentPayload,
2864                            >::some(v.to_owned_from_source(__buffa_src)?)
2865                        }
2866                        None => ::buffa::MessageField::none(),
2867                    },
2868                    subaccount_id: self.subaccount_id,
2869                    signer_wallet: self.signer_wallet.to_string(),
2870                    payload_signature: (self.payload_signature).to_vec(),
2871                    __buffa_unknown_fields: self
2872                        .__buffa_unknown_fields
2873                        .to_owned()?
2874                        .into(),
2875                    ..::core::default::Default::default()
2876                })
2877            }
2878        }
2879        impl<'a> ::buffa::ViewEncode<'a> for CreateWalletTradingWithdrawRequestView<'a> {
2880            #[allow(clippy::needless_borrow, clippy::let_and_return)]
2881            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2882                #[allow(unused_imports)]
2883                use ::buffa::Enumeration as _;
2884                let mut size = 0u32;
2885                if self.payload.is_set() {
2886                    let __slot = __cache.reserve();
2887                    let inner_size = self.payload.compute_size(__cache);
2888                    __cache.set(__slot, inner_size);
2889                    size
2890                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2891                            + inner_size;
2892                }
2893                if self.subaccount_id != 0u64 {
2894                    size
2895                        += 1u32
2896                            + ::buffa::types::uint64_encoded_len(self.subaccount_id)
2897                                as u32;
2898                }
2899                if !self.signer_wallet.is_empty() {
2900                    size
2901                        += 1u32
2902                            + ::buffa::types::string_encoded_len(&self.signer_wallet)
2903                                as u32;
2904                }
2905                if !self.payload_signature.is_empty() {
2906                    size
2907                        += 1u32
2908                            + ::buffa::types::bytes_encoded_len(&self.payload_signature)
2909                                as u32;
2910                }
2911                size += self.__buffa_unknown_fields.encoded_len() as u32;
2912                size
2913            }
2914            #[allow(clippy::needless_borrow)]
2915            fn write_to(
2916                &self,
2917                __cache: &mut ::buffa::SizeCache,
2918                buf: &mut impl ::buffa::bytes::BufMut,
2919            ) {
2920                #[allow(unused_imports)]
2921                use ::buffa::Enumeration as _;
2922                if self.payload.is_set() {
2923                    ::buffa::types::put_len_delimited_header(
2924                        1u32,
2925                        __cache.consume_next(),
2926                        buf,
2927                    );
2928                    self.payload.write_to(__cache, buf);
2929                }
2930                if self.subaccount_id != 0u64 {
2931                    ::buffa::types::put_uint64_field(2u32, self.subaccount_id, buf);
2932                }
2933                if !self.signer_wallet.is_empty() {
2934                    ::buffa::types::put_string_field(3u32, &self.signer_wallet, buf);
2935                }
2936                if !self.payload_signature.is_empty() {
2937                    ::buffa::types::put_bytes_field(4u32, &self.payload_signature, buf);
2938                }
2939                self.__buffa_unknown_fields.write_to(buf);
2940            }
2941        }
2942        /// Serializes this view as protobuf JSON.
2943        ///
2944        /// Implicit-presence fields with default values are omitted, `required`
2945        /// fields are always emitted, explicit-presence (`optional`) fields are
2946        /// emitted only when set, bytes fields are base64-encoded, and enum
2947        /// values are their proto name strings.
2948        ///
2949        /// This impl uses `serialize_map(None)` because the number of emitted
2950        /// fields depends on default-omission rules; serializers that require
2951        /// known map lengths (e.g. `bincode`) will return a runtime error.
2952        /// Use the owned message type for those formats.
2953        impl<'__a> ::serde::Serialize for CreateWalletTradingWithdrawRequestView<'__a> {
2954            fn serialize<__S: ::serde::Serializer>(
2955                &self,
2956                __s: __S,
2957            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2958                use ::serde::ser::SerializeMap as _;
2959                let mut __map = __s.serialize_map(::core::option::Option::None)?;
2960                {
2961                    if let ::core::option::Option::Some(__v) = self.payload.as_option() {
2962                        __map.serialize_entry("payload", __v)?;
2963                    }
2964                }
2965                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
2966                    __map
2967                        .serialize_entry(
2968                            "subaccountId",
2969                            &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
2970                        )?;
2971                }
2972                if !::buffa::json_helpers::skip_if::is_empty_str(self.signer_wallet) {
2973                    __map.serialize_entry("signerWallet", self.signer_wallet)?;
2974                }
2975                if !::buffa::json_helpers::skip_if::is_empty_bytes(
2976                    self.payload_signature,
2977                ) {
2978                    __map
2979                        .serialize_entry(
2980                            "payloadSignature",
2981                            &::buffa::json_helpers::BytesJson(self.payload_signature),
2982                        )?;
2983                }
2984                __map.end()
2985            }
2986        }
2987        impl<'a> ::buffa::MessageName for CreateWalletTradingWithdrawRequestView<'a> {
2988            const PACKAGE: &'static str = "chain.withdraw.v1";
2989            const NAME: &'static str = "CreateWalletTradingWithdrawRequest";
2990            const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
2991            const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
2992        }
2993        ::buffa::impl_default_view_instance!(CreateWalletTradingWithdrawRequestView);
2994        ::buffa::impl_view_reborrow!(CreateWalletTradingWithdrawRequestView);
2995        /** Self-contained, `'static` owned view of a `CreateWalletTradingWithdrawRequest` message.
2996
2997 Wraps [`::buffa::OwnedView`]`<`[`CreateWalletTradingWithdrawRequestView`]`<'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.
2998
2999 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateWalletTradingWithdrawRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
3000        #[derive(Clone, Debug)]
3001        pub struct CreateWalletTradingWithdrawRequestOwnedView(
3002            ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
3003        );
3004        impl CreateWalletTradingWithdrawRequestOwnedView {
3005            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
3006            ///
3007            /// The view borrows directly from the buffer's data; the buffer is
3008            /// retained inside the returned handle.
3009            ///
3010            /// # Errors
3011            ///
3012            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
3013            /// protobuf data.
3014            pub fn decode(
3015                bytes: ::buffa::bytes::Bytes,
3016            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3017                ::core::result::Result::Ok(
3018                    CreateWalletTradingWithdrawRequestOwnedView(
3019                        ::buffa::OwnedView::decode(bytes)?,
3020                    ),
3021                )
3022            }
3023            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
3024            /// max message size).
3025            ///
3026            /// # Errors
3027            ///
3028            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
3029            /// exceeds the configured limits.
3030            pub fn decode_with_options(
3031                bytes: ::buffa::bytes::Bytes,
3032                opts: &::buffa::DecodeOptions,
3033            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3034                ::core::result::Result::Ok(
3035                    CreateWalletTradingWithdrawRequestOwnedView(
3036                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
3037                    ),
3038                )
3039            }
3040            /// Build from an owned message via an encode → decode round-trip.
3041            ///
3042            /// # Errors
3043            ///
3044            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
3045            /// somehow invalid (should not happen for well-formed messages).
3046            pub fn from_owned(
3047                msg: &super::super::CreateWalletTradingWithdrawRequest,
3048            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3049                ::core::result::Result::Ok(
3050                    CreateWalletTradingWithdrawRequestOwnedView(
3051                        ::buffa::OwnedView::from_owned(msg)?,
3052                    ),
3053                )
3054            }
3055            /// Borrow the full [`CreateWalletTradingWithdrawRequestView`] with its lifetime tied to `&self`.
3056            #[must_use]
3057            pub fn view(&self) -> &CreateWalletTradingWithdrawRequestView<'_> {
3058                self.0.reborrow()
3059            }
3060            /// Convert to the owned message type.
3061            ///
3062            /// # Errors
3063            ///
3064            /// Returns an error if re-materializing preserved unknown fields
3065            /// fails (e.g. the unknown-field limit is exceeded).
3066            pub fn to_owned_message(
3067                &self,
3068            ) -> ::core::result::Result<
3069                super::super::CreateWalletTradingWithdrawRequest,
3070                ::buffa::DecodeError,
3071            > {
3072                self.0.to_owned_message()
3073            }
3074            /// The underlying bytes buffer.
3075            #[must_use]
3076            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
3077                self.0.bytes()
3078            }
3079            /// Consume the handle, returning the underlying bytes buffer.
3080            #[must_use]
3081            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
3082                self.0.into_bytes()
3083            }
3084            /// Client-signed withdraw details.
3085            ///
3086            /// Field 1: `payload`
3087            #[must_use]
3088            pub fn payload(
3089                &self,
3090            ) -> &::buffa::MessageFieldView<
3091                super::super::__buffa::view::TradingWithdrawIntentPayloadView<'_>,
3092            > {
3093                &self.0.reborrow().payload
3094            }
3095            /// Optional public subaccount id. Omit to withdraw from the JWT root account.
3096            ///
3097            /// Field 2: `subaccount_id`
3098            #[must_use]
3099            pub fn subaccount_id(&self) -> u64 {
3100                self.0.reborrow().subaccount_id
3101            }
3102            /// Wallet address that produced payload_signature.
3103            ///
3104            /// Field 3: `signer_wallet`
3105            #[must_use]
3106            pub fn signer_wallet(&self) -> &'_ str {
3107                self.0.reborrow().signer_wallet
3108            }
3109            /// Wallet EIP-712 signature over the typed withdraw payload.
3110            ///
3111            /// Field 4: `payload_signature`
3112            #[must_use]
3113            pub fn payload_signature(&self) -> &'_ [u8] {
3114                self.0.reborrow().payload_signature
3115            }
3116        }
3117        impl ::core::convert::From<
3118            ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
3119        > for CreateWalletTradingWithdrawRequestOwnedView {
3120            fn from(
3121                inner: ::buffa::OwnedView<
3122                    CreateWalletTradingWithdrawRequestView<'static>,
3123                >,
3124            ) -> Self {
3125                CreateWalletTradingWithdrawRequestOwnedView(inner)
3126            }
3127        }
3128        impl ::core::convert::From<CreateWalletTradingWithdrawRequestOwnedView>
3129        for ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>> {
3130            fn from(wrapper: CreateWalletTradingWithdrawRequestOwnedView) -> Self {
3131                wrapper.0
3132            }
3133        }
3134        impl ::core::convert::AsRef<
3135            ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
3136        > for CreateWalletTradingWithdrawRequestOwnedView {
3137            fn as_ref(
3138                &self,
3139            ) -> &::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>> {
3140                &self.0
3141            }
3142        }
3143        impl ::buffa::HasMessageView
3144        for super::super::CreateWalletTradingWithdrawRequest {
3145            type View<'a> = CreateWalletTradingWithdrawRequestView<'a>;
3146            type ViewHandle = CreateWalletTradingWithdrawRequestOwnedView;
3147        }
3148        impl ::serde::Serialize for CreateWalletTradingWithdrawRequestOwnedView {
3149            fn serialize<__S: ::serde::Serializer>(
3150                &self,
3151                __s: __S,
3152            ) -> ::core::result::Result<__S::Ok, __S::Error> {
3153                ::serde::Serialize::serialize(&self.0, __s)
3154            }
3155        }
3156    }
3157    /// Register this package's `Any` type entries and extension entries.
3158    pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
3159        reg.register_json_any(super::__CREATE_TRADING_WITHDRAW_RESPONSE_JSON_ANY);
3160        reg.register_json_any(super::__CREATE_WALLET_TRADING_WITHDRAW_RESPONSE_JSON_ANY);
3161        reg.register_json_any(super::__TRADING_WITHDRAW_INTENT_PAYLOAD_JSON_ANY);
3162        reg.register_json_any(super::__CREATE_TRADING_WITHDRAW_REQUEST_JSON_ANY);
3163        reg.register_json_any(super::__CREATE_WALLET_TRADING_WITHDRAW_REQUEST_JSON_ANY);
3164    }
3165}
3166#[doc(inline)]
3167pub use self::__buffa::view::CreateTradingWithdrawResponseView;
3168#[doc(inline)]
3169pub use self::__buffa::view::CreateTradingWithdrawResponseOwnedView;
3170#[doc(inline)]
3171pub use self::__buffa::view::CreateWalletTradingWithdrawResponseView;
3172#[doc(inline)]
3173pub use self::__buffa::view::CreateWalletTradingWithdrawResponseOwnedView;
3174#[doc(inline)]
3175pub use self::__buffa::view::TradingWithdrawIntentPayloadView;
3176#[doc(inline)]
3177pub use self::__buffa::view::TradingWithdrawIntentPayloadOwnedView;
3178#[doc(inline)]
3179pub use self::__buffa::view::CreateTradingWithdrawRequestView;
3180#[doc(inline)]
3181pub use self::__buffa::view::CreateTradingWithdrawRequestOwnedView;
3182#[doc(inline)]
3183pub use self::__buffa::view::CreateWalletTradingWithdrawRequestView;
3184#[doc(inline)]
3185pub use self::__buffa::view::CreateWalletTradingWithdrawRequestOwnedView;
3186#[doc(inline)]
3187pub use self::__buffa::register_types;