1#[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 #[allow(non_upper_case_globals)]
14 pub const ActionUnspecified: Self = Self::ACTION_UNSPECIFIED;
15 #[allow(non_upper_case_globals)]
17 pub const ToFunding: Self = Self::TO_FUNDING;
18 #[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#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
152#[repr(i32)]
153pub enum WithdrawDestinationValidationCode {
154 RESULT_UNSPECIFIED = 0i32,
156 VALID = 1i32,
158 INVALID_ADDRESS = 2i32,
160 UNSUPPORTED_CHAIN = 3i32,
162 POLYESTER_SMART_ACCOUNT = 4i32,
165 TOKEN_CONTRACT = 5i32,
167 DENYLISTED_ADDRESS = 6i32,
169}
170impl WithdrawDestinationValidationCode {
171 #[allow(non_upper_case_globals)]
173 pub const ResultUnspecified: Self = Self::RESULT_UNSPECIFIED;
174 #[allow(non_upper_case_globals)]
176 pub const Valid: Self = Self::VALID;
177 #[allow(non_upper_case_globals)]
179 pub const InvalidAddress: Self = Self::INVALID_ADDRESS;
180 #[allow(non_upper_case_globals)]
182 pub const UnsupportedChain: Self = Self::UNSUPPORTED_CHAIN;
183 #[allow(non_upper_case_globals)]
185 pub const PolyesterSmartAccount: Self = Self::POLYESTER_SMART_ACCOUNT;
186 #[allow(non_upper_case_globals)]
188 pub const TokenContract: Self = Self::TOKEN_CONTRACT;
189 #[allow(non_upper_case_globals)]
191 pub const DenylistedAddress: Self = Self::DENYLISTED_ADDRESS;
192}
193impl ::core::default::Default for WithdrawDestinationValidationCode {
194 fn default() -> Self {
195 Self::RESULT_UNSPECIFIED
196 }
197}
198impl ::serde::Serialize for WithdrawDestinationValidationCode {
199 fn serialize<S: ::serde::Serializer>(
200 &self,
201 s: S,
202 ) -> ::core::result::Result<S::Ok, S::Error> {
203 s.serialize_str(::buffa::Enumeration::proto_name(self))
204 }
205}
206impl<'de> ::serde::Deserialize<'de> for WithdrawDestinationValidationCode {
207 fn deserialize<D: ::serde::Deserializer<'de>>(
208 d: D,
209 ) -> ::core::result::Result<Self, D::Error> {
210 struct _V;
211 impl ::serde::de::Visitor<'_> for _V {
212 type Value = WithdrawDestinationValidationCode;
213 fn expecting(
214 &self,
215 f: &mut ::core::fmt::Formatter<'_>,
216 ) -> ::core::fmt::Result {
217 f.write_str(
218 concat!(
219 "a string, integer, or null for ",
220 stringify!(WithdrawDestinationValidationCode)
221 ),
222 )
223 }
224 fn visit_str<E: ::serde::de::Error>(
225 self,
226 v: &str,
227 ) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
228 <WithdrawDestinationValidationCode as ::buffa::Enumeration>::from_proto_name(
229 v,
230 )
231 .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
232 }
233 fn visit_i64<E: ::serde::de::Error>(
234 self,
235 v: i64,
236 ) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
237 let v32 = i32::try_from(v)
238 .map_err(|_| {
239 ::serde::de::Error::custom(
240 ::buffa::alloc::format!("enum value {v} out of i32 range"),
241 )
242 })?;
243 <WithdrawDestinationValidationCode as ::buffa::Enumeration>::from_i32(
244 v32,
245 )
246 .ok_or_else(|| {
247 ::serde::de::Error::custom(
248 ::buffa::alloc::format!("unknown enum value {v32}"),
249 )
250 })
251 }
252 fn visit_u64<E: ::serde::de::Error>(
253 self,
254 v: u64,
255 ) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
256 let v32 = i32::try_from(v)
257 .map_err(|_| {
258 ::serde::de::Error::custom(
259 ::buffa::alloc::format!("enum value {v} out of i32 range"),
260 )
261 })?;
262 <WithdrawDestinationValidationCode as ::buffa::Enumeration>::from_i32(
263 v32,
264 )
265 .ok_or_else(|| {
266 ::serde::de::Error::custom(
267 ::buffa::alloc::format!("unknown enum value {v32}"),
268 )
269 })
270 }
271 fn visit_unit<E: ::serde::de::Error>(
272 self,
273 ) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
274 ::core::result::Result::Ok(::core::default::Default::default())
275 }
276 }
277 d.deserialize_any(_V)
278 }
279}
280impl ::buffa::json_helpers::ProtoElemJson for WithdrawDestinationValidationCode {
281 fn serialize_proto_json<S: ::serde::Serializer>(
282 v: &Self,
283 s: S,
284 ) -> ::core::result::Result<S::Ok, S::Error> {
285 ::serde::Serialize::serialize(v, s)
286 }
287 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
288 d: D,
289 ) -> ::core::result::Result<Self, D::Error> {
290 <Self as ::serde::Deserialize>::deserialize(d)
291 }
292}
293impl ::buffa::Enumeration for WithdrawDestinationValidationCode {
294 fn from_i32(value: i32) -> ::core::option::Option<Self> {
295 match value {
296 0i32 => ::core::option::Option::Some(Self::RESULT_UNSPECIFIED),
297 1i32 => ::core::option::Option::Some(Self::VALID),
298 2i32 => ::core::option::Option::Some(Self::INVALID_ADDRESS),
299 3i32 => ::core::option::Option::Some(Self::UNSUPPORTED_CHAIN),
300 4i32 => ::core::option::Option::Some(Self::POLYESTER_SMART_ACCOUNT),
301 5i32 => ::core::option::Option::Some(Self::TOKEN_CONTRACT),
302 6i32 => ::core::option::Option::Some(Self::DENYLISTED_ADDRESS),
303 _ => ::core::option::Option::None,
304 }
305 }
306 fn to_i32(&self) -> i32 {
307 *self as i32
308 }
309 fn proto_name(&self) -> &'static str {
310 match self {
311 Self::RESULT_UNSPECIFIED => "RESULT_UNSPECIFIED",
312 Self::VALID => "VALID",
313 Self::INVALID_ADDRESS => "INVALID_ADDRESS",
314 Self::UNSUPPORTED_CHAIN => "UNSUPPORTED_CHAIN",
315 Self::POLYESTER_SMART_ACCOUNT => "POLYESTER_SMART_ACCOUNT",
316 Self::TOKEN_CONTRACT => "TOKEN_CONTRACT",
317 Self::DENYLISTED_ADDRESS => "DENYLISTED_ADDRESS",
318 }
319 }
320 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
321 match name {
322 "RESULT_UNSPECIFIED" => {
323 ::core::option::Option::Some(Self::RESULT_UNSPECIFIED)
324 }
325 "VALID" => ::core::option::Option::Some(Self::VALID),
326 "INVALID_ADDRESS" => ::core::option::Option::Some(Self::INVALID_ADDRESS),
327 "UNSUPPORTED_CHAIN" => ::core::option::Option::Some(Self::UNSUPPORTED_CHAIN),
328 "POLYESTER_SMART_ACCOUNT" => {
329 ::core::option::Option::Some(Self::POLYESTER_SMART_ACCOUNT)
330 }
331 "TOKEN_CONTRACT" => ::core::option::Option::Some(Self::TOKEN_CONTRACT),
332 "DENYLISTED_ADDRESS" => {
333 ::core::option::Option::Some(Self::DENYLISTED_ADDRESS)
334 }
335 _ => ::core::option::Option::None,
336 }
337 }
338 fn values() -> &'static [Self] {
339 &[
340 Self::RESULT_UNSPECIFIED,
341 Self::VALID,
342 Self::INVALID_ADDRESS,
343 Self::UNSUPPORTED_CHAIN,
344 Self::POLYESTER_SMART_ACCOUNT,
345 Self::TOKEN_CONTRACT,
346 Self::DENYLISTED_ADDRESS,
347 ]
348 }
349}
350#[derive(Clone, PartialEq, Default)]
353#[derive(::serde::Serialize, ::serde::Deserialize)]
354#[serde(default)]
355pub struct CreateTradingWithdrawResponse {
356 #[serde(
361 rename = "intentId",
362 alias = "intent_id",
363 with = "::buffa::json_helpers::proto_string",
364 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
365 )]
366 pub intent_id: ::buffa::alloc::string::String,
367 #[serde(skip)]
368 #[doc(hidden)]
369 pub __buffa_unknown_fields: ::buffa::UnknownFields,
370}
371impl ::core::fmt::Debug for CreateTradingWithdrawResponse {
372 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
373 f.debug_struct("CreateTradingWithdrawResponse")
374 .field("intent_id", &self.intent_id)
375 .finish()
376 }
377}
378impl CreateTradingWithdrawResponse {
379 pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
384}
385::buffa::impl_default_instance!(CreateTradingWithdrawResponse);
386impl ::buffa::MessageName for CreateTradingWithdrawResponse {
387 const PACKAGE: &'static str = "chain.withdraw.v1";
388 const NAME: &'static str = "CreateTradingWithdrawResponse";
389 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
390 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
391}
392impl ::buffa::Message for CreateTradingWithdrawResponse {
393 #[allow(clippy::let_and_return)]
399 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
400 #[allow(unused_imports)]
401 use ::buffa::Enumeration as _;
402 let mut size = 0u32;
403 if !self.intent_id.is_empty() {
404 size += 1u32 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
405 }
406 size += self.__buffa_unknown_fields.encoded_len() as u32;
407 size
408 }
409 fn write_to(
410 &self,
411 _cache: &mut ::buffa::SizeCache,
412 buf: &mut impl ::buffa::bytes::BufMut,
413 ) {
414 #[allow(unused_imports)]
415 use ::buffa::Enumeration as _;
416 if !self.intent_id.is_empty() {
417 ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
418 }
419 self.__buffa_unknown_fields.write_to(buf);
420 }
421 fn merge_field(
422 &mut self,
423 tag: ::buffa::encoding::Tag,
424 buf: &mut impl ::buffa::bytes::Buf,
425 ctx: ::buffa::DecodeContext<'_>,
426 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
427 #[allow(unused_imports)]
428 use ::buffa::bytes::Buf as _;
429 #[allow(unused_imports)]
430 use ::buffa::Enumeration as _;
431 match tag.field_number() {
432 1u32 => {
433 ::buffa::encoding::check_wire_type(
434 tag,
435 ::buffa::encoding::WireType::LengthDelimited,
436 )?;
437 ::buffa::types::merge_string(&mut self.intent_id, buf)?;
438 }
439 _ => {
440 self.__buffa_unknown_fields
441 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
442 }
443 }
444 ::core::result::Result::Ok(())
445 }
446 fn clear(&mut self) {
447 self.intent_id.clear();
448 self.__buffa_unknown_fields.clear();
449 }
450}
451impl ::buffa::ExtensionSet for CreateTradingWithdrawResponse {
452 const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
453 fn unknown_fields(&self) -> &::buffa::UnknownFields {
454 &self.__buffa_unknown_fields
455 }
456 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
457 &mut self.__buffa_unknown_fields
458 }
459}
460impl ::buffa::json_helpers::ProtoElemJson for CreateTradingWithdrawResponse {
461 fn serialize_proto_json<S: ::serde::Serializer>(
462 v: &Self,
463 s: S,
464 ) -> ::core::result::Result<S::Ok, S::Error> {
465 ::serde::Serialize::serialize(v, s)
466 }
467 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
468 d: D,
469 ) -> ::core::result::Result<Self, D::Error> {
470 <Self as ::serde::Deserialize>::deserialize(d)
471 }
472}
473#[doc(hidden)]
474pub const __CREATE_TRADING_WITHDRAW_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
475 type_url: "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse",
476 to_json: ::buffa::type_registry::any_to_json::<CreateTradingWithdrawResponse>,
477 from_json: ::buffa::type_registry::any_from_json::<CreateTradingWithdrawResponse>,
478 is_wkt: false,
479};
480#[derive(Clone, PartialEq, Default)]
483#[derive(::serde::Serialize, ::serde::Deserialize)]
484#[serde(default)]
485pub struct CreateWalletTradingWithdrawResponse {
486 #[serde(
491 rename = "intentId",
492 alias = "intent_id",
493 with = "::buffa::json_helpers::proto_string",
494 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
495 )]
496 pub intent_id: ::buffa::alloc::string::String,
497 #[serde(skip)]
498 #[doc(hidden)]
499 pub __buffa_unknown_fields: ::buffa::UnknownFields,
500}
501impl ::core::fmt::Debug for CreateWalletTradingWithdrawResponse {
502 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
503 f.debug_struct("CreateWalletTradingWithdrawResponse")
504 .field("intent_id", &self.intent_id)
505 .finish()
506 }
507}
508impl CreateWalletTradingWithdrawResponse {
509 pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
514}
515::buffa::impl_default_instance!(CreateWalletTradingWithdrawResponse);
516impl ::buffa::MessageName for CreateWalletTradingWithdrawResponse {
517 const PACKAGE: &'static str = "chain.withdraw.v1";
518 const NAME: &'static str = "CreateWalletTradingWithdrawResponse";
519 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
520 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
521}
522impl ::buffa::Message for CreateWalletTradingWithdrawResponse {
523 #[allow(clippy::let_and_return)]
529 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
530 #[allow(unused_imports)]
531 use ::buffa::Enumeration as _;
532 let mut size = 0u32;
533 if !self.intent_id.is_empty() {
534 size += 1u32 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
535 }
536 size += self.__buffa_unknown_fields.encoded_len() as u32;
537 size
538 }
539 fn write_to(
540 &self,
541 _cache: &mut ::buffa::SizeCache,
542 buf: &mut impl ::buffa::bytes::BufMut,
543 ) {
544 #[allow(unused_imports)]
545 use ::buffa::Enumeration as _;
546 if !self.intent_id.is_empty() {
547 ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
548 }
549 self.__buffa_unknown_fields.write_to(buf);
550 }
551 fn merge_field(
552 &mut self,
553 tag: ::buffa::encoding::Tag,
554 buf: &mut impl ::buffa::bytes::Buf,
555 ctx: ::buffa::DecodeContext<'_>,
556 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
557 #[allow(unused_imports)]
558 use ::buffa::bytes::Buf as _;
559 #[allow(unused_imports)]
560 use ::buffa::Enumeration as _;
561 match tag.field_number() {
562 1u32 => {
563 ::buffa::encoding::check_wire_type(
564 tag,
565 ::buffa::encoding::WireType::LengthDelimited,
566 )?;
567 ::buffa::types::merge_string(&mut self.intent_id, buf)?;
568 }
569 _ => {
570 self.__buffa_unknown_fields
571 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
572 }
573 }
574 ::core::result::Result::Ok(())
575 }
576 fn clear(&mut self) {
577 self.intent_id.clear();
578 self.__buffa_unknown_fields.clear();
579 }
580}
581impl ::buffa::ExtensionSet for CreateWalletTradingWithdrawResponse {
582 const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
583 fn unknown_fields(&self) -> &::buffa::UnknownFields {
584 &self.__buffa_unknown_fields
585 }
586 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
587 &mut self.__buffa_unknown_fields
588 }
589}
590impl ::buffa::json_helpers::ProtoElemJson for CreateWalletTradingWithdrawResponse {
591 fn serialize_proto_json<S: ::serde::Serializer>(
592 v: &Self,
593 s: S,
594 ) -> ::core::result::Result<S::Ok, S::Error> {
595 ::serde::Serialize::serialize(v, s)
596 }
597 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
598 d: D,
599 ) -> ::core::result::Result<Self, D::Error> {
600 <Self as ::serde::Deserialize>::deserialize(d)
601 }
602}
603#[doc(hidden)]
604pub const __CREATE_WALLET_TRADING_WITHDRAW_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
605 type_url: "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse",
606 to_json: ::buffa::type_registry::any_to_json::<CreateWalletTradingWithdrawResponse>,
607 from_json: ::buffa::type_registry::any_from_json::<
608 CreateWalletTradingWithdrawResponse,
609 >,
610 is_wkt: false,
611};
612#[derive(Clone, PartialEq, Default)]
615#[derive(::serde::Serialize, ::serde::Deserialize)]
616#[serde(default)]
617pub struct TradingWithdrawIntentPayload {
618 #[serde(
622 rename = "action",
623 with = "::buffa::json_helpers::proto_enum",
624 skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
625 )]
626 pub action: ::buffa::EnumValue<TradingWithdrawAction>,
627 #[serde(
632 rename = "assetId",
633 alias = "asset_id",
634 with = "::buffa::json_helpers::uint32",
635 skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
636 )]
637 pub asset_id: u32,
638 #[serde(
642 rename = "destinationChainId",
643 alias = "destination_chain_id",
644 with = "::buffa::json_helpers::uint64",
645 skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
646 )]
647 pub destination_chain_id: u64,
648 #[serde(
653 rename = "amountE18",
654 alias = "amount_e18",
655 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
656 )]
657 pub amount_e18: ::buffa::MessageField<
658 super::super::super::polyester::r#type::v1::U128,
659 >,
660 #[serde(
666 rename = "deadlineTsSec",
667 alias = "deadline_ts_sec",
668 with = "::buffa::json_helpers::uint64",
669 skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
670 )]
671 pub deadline_ts_sec: u64,
672 #[serde(
677 rename = "nonce",
678 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
679 )]
680 pub nonce: ::buffa::MessageField<super::super::super::polyester::r#type::v1::U128>,
681 #[serde(
689 rename = "destinationAddress",
690 alias = "destination_address",
691 with = "::buffa::json_helpers::proto_string",
692 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
693 )]
694 pub destination_address: ::buffa::alloc::string::String,
695 #[serde(
700 rename = "idempotencyKey",
701 alias = "idempotency_key",
702 with = "::buffa::json_helpers::proto_string",
703 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
704 )]
705 pub idempotency_key: ::buffa::alloc::string::String,
706 #[serde(skip)]
707 #[doc(hidden)]
708 pub __buffa_unknown_fields: ::buffa::UnknownFields,
709}
710impl ::core::fmt::Debug for TradingWithdrawIntentPayload {
711 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
712 f.debug_struct("TradingWithdrawIntentPayload")
713 .field("action", &self.action)
714 .field("asset_id", &self.asset_id)
715 .field("destination_chain_id", &self.destination_chain_id)
716 .field("amount_e18", &self.amount_e18)
717 .field("deadline_ts_sec", &self.deadline_ts_sec)
718 .field("nonce", &self.nonce)
719 .field("destination_address", &self.destination_address)
720 .field("idempotency_key", &self.idempotency_key)
721 .finish()
722 }
723}
724impl TradingWithdrawIntentPayload {
725 pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
730}
731::buffa::impl_default_instance!(TradingWithdrawIntentPayload);
732impl ::buffa::MessageName for TradingWithdrawIntentPayload {
733 const PACKAGE: &'static str = "chain.withdraw.v1";
734 const NAME: &'static str = "TradingWithdrawIntentPayload";
735 const FULL_NAME: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
736 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
737}
738impl ::buffa::Message for TradingWithdrawIntentPayload {
739 #[allow(clippy::let_and_return)]
745 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
746 #[allow(unused_imports)]
747 use ::buffa::Enumeration as _;
748 let mut size = 0u32;
749 {
750 let val = self.action.to_i32();
751 if val != 0 {
752 size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
753 }
754 }
755 if self.asset_id != 0u32 {
756 size += 1u32 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
757 }
758 if self.destination_chain_id != 0u64 {
759 size
760 += 1u32
761 + ::buffa::types::uint64_encoded_len(self.destination_chain_id)
762 as u32;
763 }
764 if self.amount_e18.is_set() {
765 let __slot = __cache.reserve();
766 let inner_size = self.amount_e18.compute_size(__cache);
767 __cache.set(__slot, inner_size);
768 size
769 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
770 + inner_size;
771 }
772 if self.deadline_ts_sec != 0u64 {
773 size
774 += 1u32
775 + ::buffa::types::uint64_encoded_len(self.deadline_ts_sec) as u32;
776 }
777 if self.nonce.is_set() {
778 let __slot = __cache.reserve();
779 let inner_size = self.nonce.compute_size(__cache);
780 __cache.set(__slot, inner_size);
781 size
782 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
783 + inner_size;
784 }
785 if !self.destination_address.is_empty() {
786 size
787 += 1u32
788 + ::buffa::types::string_encoded_len(&self.destination_address)
789 as u32;
790 }
791 if !self.idempotency_key.is_empty() {
792 size
793 += 1u32
794 + ::buffa::types::string_encoded_len(&self.idempotency_key) as u32;
795 }
796 size += self.__buffa_unknown_fields.encoded_len() as u32;
797 size
798 }
799 fn write_to(
800 &self,
801 __cache: &mut ::buffa::SizeCache,
802 buf: &mut impl ::buffa::bytes::BufMut,
803 ) {
804 #[allow(unused_imports)]
805 use ::buffa::Enumeration as _;
806 {
807 let val = self.action.to_i32();
808 if val != 0 {
809 ::buffa::types::put_int32_field(1u32, val, buf);
810 }
811 }
812 if self.asset_id != 0u32 {
813 ::buffa::types::put_uint32_field(2u32, self.asset_id, buf);
814 }
815 if self.destination_chain_id != 0u64 {
816 ::buffa::types::put_uint64_field(3u32, self.destination_chain_id, buf);
817 }
818 if self.amount_e18.is_set() {
819 ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
820 self.amount_e18.write_to(__cache, buf);
821 }
822 if self.deadline_ts_sec != 0u64 {
823 ::buffa::types::put_uint64_field(5u32, self.deadline_ts_sec, buf);
824 }
825 if self.nonce.is_set() {
826 ::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf);
827 self.nonce.write_to(__cache, buf);
828 }
829 if !self.destination_address.is_empty() {
830 ::buffa::types::put_string_field(7u32, &self.destination_address, buf);
831 }
832 if !self.idempotency_key.is_empty() {
833 ::buffa::types::put_string_field(8u32, &self.idempotency_key, buf);
834 }
835 self.__buffa_unknown_fields.write_to(buf);
836 }
837 fn merge_field(
838 &mut self,
839 tag: ::buffa::encoding::Tag,
840 buf: &mut impl ::buffa::bytes::Buf,
841 ctx: ::buffa::DecodeContext<'_>,
842 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
843 #[allow(unused_imports)]
844 use ::buffa::bytes::Buf as _;
845 #[allow(unused_imports)]
846 use ::buffa::Enumeration as _;
847 match tag.field_number() {
848 1u32 => {
849 ::buffa::encoding::check_wire_type(
850 tag,
851 ::buffa::encoding::WireType::Varint,
852 )?;
853 self.action = ::buffa::EnumValue::from(
854 ::buffa::types::decode_int32(buf)?,
855 );
856 }
857 2u32 => {
858 ::buffa::encoding::check_wire_type(
859 tag,
860 ::buffa::encoding::WireType::Varint,
861 )?;
862 self.asset_id = ::buffa::types::decode_uint32(buf)?;
863 }
864 3u32 => {
865 ::buffa::encoding::check_wire_type(
866 tag,
867 ::buffa::encoding::WireType::Varint,
868 )?;
869 self.destination_chain_id = ::buffa::types::decode_uint64(buf)?;
870 }
871 4u32 => {
872 ::buffa::encoding::check_wire_type(
873 tag,
874 ::buffa::encoding::WireType::LengthDelimited,
875 )?;
876 ::buffa::Message::merge_length_delimited(
877 self.amount_e18.get_or_insert_default(),
878 buf,
879 ctx,
880 )?;
881 }
882 5u32 => {
883 ::buffa::encoding::check_wire_type(
884 tag,
885 ::buffa::encoding::WireType::Varint,
886 )?;
887 self.deadline_ts_sec = ::buffa::types::decode_uint64(buf)?;
888 }
889 6u32 => {
890 ::buffa::encoding::check_wire_type(
891 tag,
892 ::buffa::encoding::WireType::LengthDelimited,
893 )?;
894 ::buffa::Message::merge_length_delimited(
895 self.nonce.get_or_insert_default(),
896 buf,
897 ctx,
898 )?;
899 }
900 7u32 => {
901 ::buffa::encoding::check_wire_type(
902 tag,
903 ::buffa::encoding::WireType::LengthDelimited,
904 )?;
905 ::buffa::types::merge_string(&mut self.destination_address, buf)?;
906 }
907 8u32 => {
908 ::buffa::encoding::check_wire_type(
909 tag,
910 ::buffa::encoding::WireType::LengthDelimited,
911 )?;
912 ::buffa::types::merge_string(&mut self.idempotency_key, buf)?;
913 }
914 _ => {
915 self.__buffa_unknown_fields
916 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
917 }
918 }
919 ::core::result::Result::Ok(())
920 }
921 fn clear(&mut self) {
922 self.action = ::buffa::EnumValue::from(0);
923 self.asset_id = 0u32;
924 self.destination_chain_id = 0u64;
925 self.amount_e18 = ::buffa::MessageField::none();
926 self.deadline_ts_sec = 0u64;
927 self.nonce = ::buffa::MessageField::none();
928 self.destination_address.clear();
929 self.idempotency_key.clear();
930 self.__buffa_unknown_fields.clear();
931 }
932}
933impl ::buffa::ExtensionSet for TradingWithdrawIntentPayload {
934 const PROTO_FQN: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
935 fn unknown_fields(&self) -> &::buffa::UnknownFields {
936 &self.__buffa_unknown_fields
937 }
938 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
939 &mut self.__buffa_unknown_fields
940 }
941}
942impl ::buffa::json_helpers::ProtoElemJson for TradingWithdrawIntentPayload {
943 fn serialize_proto_json<S: ::serde::Serializer>(
944 v: &Self,
945 s: S,
946 ) -> ::core::result::Result<S::Ok, S::Error> {
947 ::serde::Serialize::serialize(v, s)
948 }
949 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
950 d: D,
951 ) -> ::core::result::Result<Self, D::Error> {
952 <Self as ::serde::Deserialize>::deserialize(d)
953 }
954}
955#[doc(hidden)]
956pub const __TRADING_WITHDRAW_INTENT_PAYLOAD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
957 type_url: "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload",
958 to_json: ::buffa::type_registry::any_to_json::<TradingWithdrawIntentPayload>,
959 from_json: ::buffa::type_registry::any_from_json::<TradingWithdrawIntentPayload>,
960 is_wkt: false,
961};
962#[derive(Clone, PartialEq, Default)]
965#[derive(::serde::Serialize, ::serde::Deserialize)]
966#[serde(default)]
967pub struct CreateTradingWithdrawRequest {
968 #[serde(
972 rename = "payload",
973 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
974 )]
975 pub payload: ::buffa::MessageField<TradingWithdrawIntentPayload>,
976 #[serde(
980 rename = "payloadSignature",
981 alias = "payload_signature",
982 with = "::buffa::json_helpers::bytes",
983 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
984 )]
985 pub payload_signature: ::buffa::alloc::vec::Vec<u8>,
986 #[serde(skip)]
987 #[doc(hidden)]
988 pub __buffa_unknown_fields: ::buffa::UnknownFields,
989}
990impl ::core::fmt::Debug for CreateTradingWithdrawRequest {
991 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
992 f.debug_struct("CreateTradingWithdrawRequest")
993 .field("payload", &self.payload)
994 .field("payload_signature", &self.payload_signature)
995 .finish()
996 }
997}
998impl CreateTradingWithdrawRequest {
999 pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
1004}
1005::buffa::impl_default_instance!(CreateTradingWithdrawRequest);
1006impl ::buffa::MessageName for CreateTradingWithdrawRequest {
1007 const PACKAGE: &'static str = "chain.withdraw.v1";
1008 const NAME: &'static str = "CreateTradingWithdrawRequest";
1009 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
1010 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
1011}
1012impl ::buffa::Message for CreateTradingWithdrawRequest {
1013 #[allow(clippy::let_and_return)]
1019 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1020 #[allow(unused_imports)]
1021 use ::buffa::Enumeration as _;
1022 let mut size = 0u32;
1023 if self.payload.is_set() {
1024 let __slot = __cache.reserve();
1025 let inner_size = self.payload.compute_size(__cache);
1026 __cache.set(__slot, inner_size);
1027 size
1028 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1029 + inner_size;
1030 }
1031 if !self.payload_signature.is_empty() {
1032 size
1033 += 1u32
1034 + ::buffa::types::bytes_encoded_len(&self.payload_signature) as u32;
1035 }
1036 size += self.__buffa_unknown_fields.encoded_len() as u32;
1037 size
1038 }
1039 fn write_to(
1040 &self,
1041 __cache: &mut ::buffa::SizeCache,
1042 buf: &mut impl ::buffa::bytes::BufMut,
1043 ) {
1044 #[allow(unused_imports)]
1045 use ::buffa::Enumeration as _;
1046 if self.payload.is_set() {
1047 ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
1048 self.payload.write_to(__cache, buf);
1049 }
1050 if !self.payload_signature.is_empty() {
1051 ::buffa::types::put_bytes_field(2u32, &self.payload_signature, buf);
1052 }
1053 self.__buffa_unknown_fields.write_to(buf);
1054 }
1055 fn merge_field(
1056 &mut self,
1057 tag: ::buffa::encoding::Tag,
1058 buf: &mut impl ::buffa::bytes::Buf,
1059 ctx: ::buffa::DecodeContext<'_>,
1060 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1061 #[allow(unused_imports)]
1062 use ::buffa::bytes::Buf as _;
1063 #[allow(unused_imports)]
1064 use ::buffa::Enumeration as _;
1065 match tag.field_number() {
1066 1u32 => {
1067 ::buffa::encoding::check_wire_type(
1068 tag,
1069 ::buffa::encoding::WireType::LengthDelimited,
1070 )?;
1071 ::buffa::Message::merge_length_delimited(
1072 self.payload.get_or_insert_default(),
1073 buf,
1074 ctx,
1075 )?;
1076 }
1077 2u32 => {
1078 ::buffa::encoding::check_wire_type(
1079 tag,
1080 ::buffa::encoding::WireType::LengthDelimited,
1081 )?;
1082 ::buffa::types::merge_bytes(&mut self.payload_signature, buf)?;
1083 }
1084 _ => {
1085 self.__buffa_unknown_fields
1086 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1087 }
1088 }
1089 ::core::result::Result::Ok(())
1090 }
1091 fn clear(&mut self) {
1092 self.payload = ::buffa::MessageField::none();
1093 self.payload_signature.clear();
1094 self.__buffa_unknown_fields.clear();
1095 }
1096}
1097impl ::buffa::ExtensionSet for CreateTradingWithdrawRequest {
1098 const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
1099 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1100 &self.__buffa_unknown_fields
1101 }
1102 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1103 &mut self.__buffa_unknown_fields
1104 }
1105}
1106impl ::buffa::json_helpers::ProtoElemJson for CreateTradingWithdrawRequest {
1107 fn serialize_proto_json<S: ::serde::Serializer>(
1108 v: &Self,
1109 s: S,
1110 ) -> ::core::result::Result<S::Ok, S::Error> {
1111 ::serde::Serialize::serialize(v, s)
1112 }
1113 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1114 d: D,
1115 ) -> ::core::result::Result<Self, D::Error> {
1116 <Self as ::serde::Deserialize>::deserialize(d)
1117 }
1118}
1119#[doc(hidden)]
1120pub const __CREATE_TRADING_WITHDRAW_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1121 type_url: "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest",
1122 to_json: ::buffa::type_registry::any_to_json::<CreateTradingWithdrawRequest>,
1123 from_json: ::buffa::type_registry::any_from_json::<CreateTradingWithdrawRequest>,
1124 is_wkt: false,
1125};
1126#[derive(Clone, PartialEq, Default)]
1129#[derive(::serde::Serialize, ::serde::Deserialize)]
1130#[serde(default)]
1131pub struct CreateWalletTradingWithdrawRequest {
1132 #[serde(
1136 rename = "payload",
1137 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1138 )]
1139 pub payload: ::buffa::MessageField<TradingWithdrawIntentPayload>,
1140 #[serde(
1144 rename = "subaccountId",
1145 alias = "subaccount_id",
1146 with = "::buffa::json_helpers::uint64",
1147 skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
1148 )]
1149 pub subaccount_id: u64,
1150 #[serde(
1154 rename = "signerWallet",
1155 alias = "signer_wallet",
1156 with = "::buffa::json_helpers::proto_string",
1157 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1158 )]
1159 pub signer_wallet: ::buffa::alloc::string::String,
1160 #[serde(
1164 rename = "payloadSignature",
1165 alias = "payload_signature",
1166 with = "::buffa::json_helpers::bytes",
1167 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
1168 )]
1169 pub payload_signature: ::buffa::alloc::vec::Vec<u8>,
1170 #[serde(skip)]
1171 #[doc(hidden)]
1172 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1173}
1174impl ::core::fmt::Debug for CreateWalletTradingWithdrawRequest {
1175 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1176 f.debug_struct("CreateWalletTradingWithdrawRequest")
1177 .field("payload", &self.payload)
1178 .field("subaccount_id", &self.subaccount_id)
1179 .field("signer_wallet", &self.signer_wallet)
1180 .field("payload_signature", &self.payload_signature)
1181 .finish()
1182 }
1183}
1184impl CreateWalletTradingWithdrawRequest {
1185 pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
1190}
1191::buffa::impl_default_instance!(CreateWalletTradingWithdrawRequest);
1192impl ::buffa::MessageName for CreateWalletTradingWithdrawRequest {
1193 const PACKAGE: &'static str = "chain.withdraw.v1";
1194 const NAME: &'static str = "CreateWalletTradingWithdrawRequest";
1195 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
1196 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
1197}
1198impl ::buffa::Message for CreateWalletTradingWithdrawRequest {
1199 #[allow(clippy::let_and_return)]
1205 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1206 #[allow(unused_imports)]
1207 use ::buffa::Enumeration as _;
1208 let mut size = 0u32;
1209 if self.payload.is_set() {
1210 let __slot = __cache.reserve();
1211 let inner_size = self.payload.compute_size(__cache);
1212 __cache.set(__slot, inner_size);
1213 size
1214 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1215 + inner_size;
1216 }
1217 if self.subaccount_id != 0u64 {
1218 size += 1u32 + ::buffa::types::uint64_encoded_len(self.subaccount_id) as u32;
1219 }
1220 if !self.signer_wallet.is_empty() {
1221 size
1222 += 1u32 + ::buffa::types::string_encoded_len(&self.signer_wallet) as u32;
1223 }
1224 if !self.payload_signature.is_empty() {
1225 size
1226 += 1u32
1227 + ::buffa::types::bytes_encoded_len(&self.payload_signature) as u32;
1228 }
1229 size += self.__buffa_unknown_fields.encoded_len() as u32;
1230 size
1231 }
1232 fn write_to(
1233 &self,
1234 __cache: &mut ::buffa::SizeCache,
1235 buf: &mut impl ::buffa::bytes::BufMut,
1236 ) {
1237 #[allow(unused_imports)]
1238 use ::buffa::Enumeration as _;
1239 if self.payload.is_set() {
1240 ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
1241 self.payload.write_to(__cache, buf);
1242 }
1243 if self.subaccount_id != 0u64 {
1244 ::buffa::types::put_uint64_field(2u32, self.subaccount_id, buf);
1245 }
1246 if !self.signer_wallet.is_empty() {
1247 ::buffa::types::put_string_field(3u32, &self.signer_wallet, buf);
1248 }
1249 if !self.payload_signature.is_empty() {
1250 ::buffa::types::put_bytes_field(4u32, &self.payload_signature, buf);
1251 }
1252 self.__buffa_unknown_fields.write_to(buf);
1253 }
1254 fn merge_field(
1255 &mut self,
1256 tag: ::buffa::encoding::Tag,
1257 buf: &mut impl ::buffa::bytes::Buf,
1258 ctx: ::buffa::DecodeContext<'_>,
1259 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1260 #[allow(unused_imports)]
1261 use ::buffa::bytes::Buf as _;
1262 #[allow(unused_imports)]
1263 use ::buffa::Enumeration as _;
1264 match tag.field_number() {
1265 1u32 => {
1266 ::buffa::encoding::check_wire_type(
1267 tag,
1268 ::buffa::encoding::WireType::LengthDelimited,
1269 )?;
1270 ::buffa::Message::merge_length_delimited(
1271 self.payload.get_or_insert_default(),
1272 buf,
1273 ctx,
1274 )?;
1275 }
1276 2u32 => {
1277 ::buffa::encoding::check_wire_type(
1278 tag,
1279 ::buffa::encoding::WireType::Varint,
1280 )?;
1281 self.subaccount_id = ::buffa::types::decode_uint64(buf)?;
1282 }
1283 3u32 => {
1284 ::buffa::encoding::check_wire_type(
1285 tag,
1286 ::buffa::encoding::WireType::LengthDelimited,
1287 )?;
1288 ::buffa::types::merge_string(&mut self.signer_wallet, buf)?;
1289 }
1290 4u32 => {
1291 ::buffa::encoding::check_wire_type(
1292 tag,
1293 ::buffa::encoding::WireType::LengthDelimited,
1294 )?;
1295 ::buffa::types::merge_bytes(&mut self.payload_signature, buf)?;
1296 }
1297 _ => {
1298 self.__buffa_unknown_fields
1299 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1300 }
1301 }
1302 ::core::result::Result::Ok(())
1303 }
1304 fn clear(&mut self) {
1305 self.payload = ::buffa::MessageField::none();
1306 self.subaccount_id = 0u64;
1307 self.signer_wallet.clear();
1308 self.payload_signature.clear();
1309 self.__buffa_unknown_fields.clear();
1310 }
1311}
1312impl ::buffa::ExtensionSet for CreateWalletTradingWithdrawRequest {
1313 const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
1314 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1315 &self.__buffa_unknown_fields
1316 }
1317 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1318 &mut self.__buffa_unknown_fields
1319 }
1320}
1321impl ::buffa::json_helpers::ProtoElemJson for CreateWalletTradingWithdrawRequest {
1322 fn serialize_proto_json<S: ::serde::Serializer>(
1323 v: &Self,
1324 s: S,
1325 ) -> ::core::result::Result<S::Ok, S::Error> {
1326 ::serde::Serialize::serialize(v, s)
1327 }
1328 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1329 d: D,
1330 ) -> ::core::result::Result<Self, D::Error> {
1331 <Self as ::serde::Deserialize>::deserialize(d)
1332 }
1333}
1334#[doc(hidden)]
1335pub const __CREATE_WALLET_TRADING_WITHDRAW_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1336 type_url: "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest",
1337 to_json: ::buffa::type_registry::any_to_json::<CreateWalletTradingWithdrawRequest>,
1338 from_json: ::buffa::type_registry::any_from_json::<
1339 CreateWalletTradingWithdrawRequest,
1340 >,
1341 is_wkt: false,
1342};
1343#[derive(Clone, PartialEq, Default)]
1346#[derive(::serde::Serialize, ::serde::Deserialize)]
1347#[serde(default)]
1348pub struct ValidateWithdrawDestinationRequest {
1349 #[serde(
1353 rename = "destinationChainId",
1354 alias = "destination_chain_id",
1355 with = "::buffa::json_helpers::uint64",
1356 skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
1357 )]
1358 pub destination_chain_id: u64,
1359 #[serde(
1363 rename = "destinationAddress",
1364 alias = "destination_address",
1365 with = "::buffa::json_helpers::proto_string",
1366 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1367 )]
1368 pub destination_address: ::buffa::alloc::string::String,
1369 #[serde(skip)]
1370 #[doc(hidden)]
1371 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1372}
1373impl ::core::fmt::Debug for ValidateWithdrawDestinationRequest {
1374 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1375 f.debug_struct("ValidateWithdrawDestinationRequest")
1376 .field("destination_chain_id", &self.destination_chain_id)
1377 .field("destination_address", &self.destination_address)
1378 .finish()
1379 }
1380}
1381impl ValidateWithdrawDestinationRequest {
1382 pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest";
1387}
1388::buffa::impl_default_instance!(ValidateWithdrawDestinationRequest);
1389impl ::buffa::MessageName for ValidateWithdrawDestinationRequest {
1390 const PACKAGE: &'static str = "chain.withdraw.v1";
1391 const NAME: &'static str = "ValidateWithdrawDestinationRequest";
1392 const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationRequest";
1393 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest";
1394}
1395impl ::buffa::Message for ValidateWithdrawDestinationRequest {
1396 #[allow(clippy::let_and_return)]
1402 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1403 #[allow(unused_imports)]
1404 use ::buffa::Enumeration as _;
1405 let mut size = 0u32;
1406 if self.destination_chain_id != 0u64 {
1407 size
1408 += 1u32
1409 + ::buffa::types::uint64_encoded_len(self.destination_chain_id)
1410 as u32;
1411 }
1412 if !self.destination_address.is_empty() {
1413 size
1414 += 1u32
1415 + ::buffa::types::string_encoded_len(&self.destination_address)
1416 as u32;
1417 }
1418 size += self.__buffa_unknown_fields.encoded_len() as u32;
1419 size
1420 }
1421 fn write_to(
1422 &self,
1423 _cache: &mut ::buffa::SizeCache,
1424 buf: &mut impl ::buffa::bytes::BufMut,
1425 ) {
1426 #[allow(unused_imports)]
1427 use ::buffa::Enumeration as _;
1428 if self.destination_chain_id != 0u64 {
1429 ::buffa::types::put_uint64_field(1u32, self.destination_chain_id, buf);
1430 }
1431 if !self.destination_address.is_empty() {
1432 ::buffa::types::put_string_field(2u32, &self.destination_address, buf);
1433 }
1434 self.__buffa_unknown_fields.write_to(buf);
1435 }
1436 fn merge_field(
1437 &mut self,
1438 tag: ::buffa::encoding::Tag,
1439 buf: &mut impl ::buffa::bytes::Buf,
1440 ctx: ::buffa::DecodeContext<'_>,
1441 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1442 #[allow(unused_imports)]
1443 use ::buffa::bytes::Buf as _;
1444 #[allow(unused_imports)]
1445 use ::buffa::Enumeration as _;
1446 match tag.field_number() {
1447 1u32 => {
1448 ::buffa::encoding::check_wire_type(
1449 tag,
1450 ::buffa::encoding::WireType::Varint,
1451 )?;
1452 self.destination_chain_id = ::buffa::types::decode_uint64(buf)?;
1453 }
1454 2u32 => {
1455 ::buffa::encoding::check_wire_type(
1456 tag,
1457 ::buffa::encoding::WireType::LengthDelimited,
1458 )?;
1459 ::buffa::types::merge_string(&mut self.destination_address, buf)?;
1460 }
1461 _ => {
1462 self.__buffa_unknown_fields
1463 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1464 }
1465 }
1466 ::core::result::Result::Ok(())
1467 }
1468 fn clear(&mut self) {
1469 self.destination_chain_id = 0u64;
1470 self.destination_address.clear();
1471 self.__buffa_unknown_fields.clear();
1472 }
1473}
1474impl ::buffa::ExtensionSet for ValidateWithdrawDestinationRequest {
1475 const PROTO_FQN: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationRequest";
1476 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1477 &self.__buffa_unknown_fields
1478 }
1479 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1480 &mut self.__buffa_unknown_fields
1481 }
1482}
1483impl ::buffa::json_helpers::ProtoElemJson for ValidateWithdrawDestinationRequest {
1484 fn serialize_proto_json<S: ::serde::Serializer>(
1485 v: &Self,
1486 s: S,
1487 ) -> ::core::result::Result<S::Ok, S::Error> {
1488 ::serde::Serialize::serialize(v, s)
1489 }
1490 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1491 d: D,
1492 ) -> ::core::result::Result<Self, D::Error> {
1493 <Self as ::serde::Deserialize>::deserialize(d)
1494 }
1495}
1496#[doc(hidden)]
1497pub const __VALIDATE_WITHDRAW_DESTINATION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1498 type_url: "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest",
1499 to_json: ::buffa::type_registry::any_to_json::<ValidateWithdrawDestinationRequest>,
1500 from_json: ::buffa::type_registry::any_from_json::<
1501 ValidateWithdrawDestinationRequest,
1502 >,
1503 is_wkt: false,
1504};
1505#[derive(Clone, PartialEq, Default)]
1508#[derive(::serde::Serialize, ::serde::Deserialize)]
1509#[serde(default)]
1510pub struct ValidateWithdrawDestinationResponse {
1511 #[serde(
1515 rename = "valid",
1516 with = "::buffa::json_helpers::proto_bool",
1517 skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
1518 )]
1519 pub valid: bool,
1520 #[serde(
1524 rename = "code",
1525 with = "::buffa::json_helpers::proto_enum",
1526 skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
1527 )]
1528 pub code: ::buffa::EnumValue<WithdrawDestinationValidationCode>,
1529 #[serde(
1533 rename = "message",
1534 with = "::buffa::json_helpers::proto_string",
1535 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1536 )]
1537 pub message: ::buffa::alloc::string::String,
1538 #[serde(
1542 rename = "canonicalDestinationAddress",
1543 alias = "canonical_destination_address",
1544 with = "::buffa::json_helpers::proto_string",
1545 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1546 )]
1547 pub canonical_destination_address: ::buffa::alloc::string::String,
1548 #[serde(skip)]
1549 #[doc(hidden)]
1550 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1551}
1552impl ::core::fmt::Debug for ValidateWithdrawDestinationResponse {
1553 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1554 f.debug_struct("ValidateWithdrawDestinationResponse")
1555 .field("valid", &self.valid)
1556 .field("code", &self.code)
1557 .field("message", &self.message)
1558 .field("canonical_destination_address", &self.canonical_destination_address)
1559 .finish()
1560 }
1561}
1562impl ValidateWithdrawDestinationResponse {
1563 pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse";
1568}
1569::buffa::impl_default_instance!(ValidateWithdrawDestinationResponse);
1570impl ::buffa::MessageName for ValidateWithdrawDestinationResponse {
1571 const PACKAGE: &'static str = "chain.withdraw.v1";
1572 const NAME: &'static str = "ValidateWithdrawDestinationResponse";
1573 const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationResponse";
1574 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse";
1575}
1576impl ::buffa::Message for ValidateWithdrawDestinationResponse {
1577 #[allow(clippy::let_and_return)]
1583 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1584 #[allow(unused_imports)]
1585 use ::buffa::Enumeration as _;
1586 let mut size = 0u32;
1587 if self.valid {
1588 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
1589 }
1590 {
1591 let val = self.code.to_i32();
1592 if val != 0 {
1593 size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1594 }
1595 }
1596 if !self.message.is_empty() {
1597 size += 1u32 + ::buffa::types::string_encoded_len(&self.message) as u32;
1598 }
1599 if !self.canonical_destination_address.is_empty() {
1600 size
1601 += 1u32
1602 + ::buffa::types::string_encoded_len(
1603 &self.canonical_destination_address,
1604 ) as u32;
1605 }
1606 size += self.__buffa_unknown_fields.encoded_len() as u32;
1607 size
1608 }
1609 fn write_to(
1610 &self,
1611 _cache: &mut ::buffa::SizeCache,
1612 buf: &mut impl ::buffa::bytes::BufMut,
1613 ) {
1614 #[allow(unused_imports)]
1615 use ::buffa::Enumeration as _;
1616 if self.valid {
1617 ::buffa::types::put_bool_field(1u32, self.valid, buf);
1618 }
1619 {
1620 let val = self.code.to_i32();
1621 if val != 0 {
1622 ::buffa::types::put_int32_field(2u32, val, buf);
1623 }
1624 }
1625 if !self.message.is_empty() {
1626 ::buffa::types::put_string_field(3u32, &self.message, buf);
1627 }
1628 if !self.canonical_destination_address.is_empty() {
1629 ::buffa::types::put_string_field(
1630 4u32,
1631 &self.canonical_destination_address,
1632 buf,
1633 );
1634 }
1635 self.__buffa_unknown_fields.write_to(buf);
1636 }
1637 fn merge_field(
1638 &mut self,
1639 tag: ::buffa::encoding::Tag,
1640 buf: &mut impl ::buffa::bytes::Buf,
1641 ctx: ::buffa::DecodeContext<'_>,
1642 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1643 #[allow(unused_imports)]
1644 use ::buffa::bytes::Buf as _;
1645 #[allow(unused_imports)]
1646 use ::buffa::Enumeration as _;
1647 match tag.field_number() {
1648 1u32 => {
1649 ::buffa::encoding::check_wire_type(
1650 tag,
1651 ::buffa::encoding::WireType::Varint,
1652 )?;
1653 self.valid = ::buffa::types::decode_bool(buf)?;
1654 }
1655 2u32 => {
1656 ::buffa::encoding::check_wire_type(
1657 tag,
1658 ::buffa::encoding::WireType::Varint,
1659 )?;
1660 self.code = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
1661 }
1662 3u32 => {
1663 ::buffa::encoding::check_wire_type(
1664 tag,
1665 ::buffa::encoding::WireType::LengthDelimited,
1666 )?;
1667 ::buffa::types::merge_string(&mut self.message, buf)?;
1668 }
1669 4u32 => {
1670 ::buffa::encoding::check_wire_type(
1671 tag,
1672 ::buffa::encoding::WireType::LengthDelimited,
1673 )?;
1674 ::buffa::types::merge_string(
1675 &mut self.canonical_destination_address,
1676 buf,
1677 )?;
1678 }
1679 _ => {
1680 self.__buffa_unknown_fields
1681 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1682 }
1683 }
1684 ::core::result::Result::Ok(())
1685 }
1686 fn clear(&mut self) {
1687 self.valid = false;
1688 self.code = ::buffa::EnumValue::from(0);
1689 self.message.clear();
1690 self.canonical_destination_address.clear();
1691 self.__buffa_unknown_fields.clear();
1692 }
1693}
1694impl ::buffa::ExtensionSet for ValidateWithdrawDestinationResponse {
1695 const PROTO_FQN: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationResponse";
1696 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1697 &self.__buffa_unknown_fields
1698 }
1699 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1700 &mut self.__buffa_unknown_fields
1701 }
1702}
1703impl ::buffa::json_helpers::ProtoElemJson for ValidateWithdrawDestinationResponse {
1704 fn serialize_proto_json<S: ::serde::Serializer>(
1705 v: &Self,
1706 s: S,
1707 ) -> ::core::result::Result<S::Ok, S::Error> {
1708 ::serde::Serialize::serialize(v, s)
1709 }
1710 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1711 d: D,
1712 ) -> ::core::result::Result<Self, D::Error> {
1713 <Self as ::serde::Deserialize>::deserialize(d)
1714 }
1715}
1716#[doc(hidden)]
1717pub const __VALIDATE_WITHDRAW_DESTINATION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1718 type_url: "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse",
1719 to_json: ::buffa::type_registry::any_to_json::<ValidateWithdrawDestinationResponse>,
1720 from_json: ::buffa::type_registry::any_from_json::<
1721 ValidateWithdrawDestinationResponse,
1722 >,
1723 is_wkt: false,
1724};
1725#[allow(
1726 non_camel_case_types,
1727 dead_code,
1728 unused_imports,
1729 unused_qualifications,
1730 clippy::derivable_impls,
1731 clippy::match_single_binding,
1732 clippy::uninlined_format_args,
1733 clippy::doc_lazy_continuation,
1734 clippy::module_inception
1735)]
1736pub mod __buffa {
1737 #[allow(unused_imports)]
1738 use super::*;
1739 pub mod view {
1740 #[allow(unused_imports)]
1741 use super::*;
1742 #[derive(Clone, Debug, Default)]
1745 pub struct CreateTradingWithdrawResponseView<'a> {
1746 pub intent_id: &'a str,
1751 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1752 }
1753 impl<'a> ::buffa::MessageView<'a> for CreateTradingWithdrawResponseView<'a> {
1754 type Owned = super::super::CreateTradingWithdrawResponse;
1755 fn decode_view(
1756 buf: &'a [u8],
1757 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1758 let __limit = ::core::cell::Cell::new(
1759 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
1760 );
1761 <Self as ::buffa::MessageView>::decode_view_ctx(
1762 buf,
1763 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1764 )
1765 }
1766 fn decode_view_with_ctx(
1767 buf: &'a [u8],
1768 ctx: ::buffa::DecodeContext<'_>,
1769 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1770 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1771 }
1772 fn merge_view_field(
1773 &mut self,
1774 tag: ::buffa::encoding::Tag,
1775 cur: &'a [u8],
1776 before_tag: &'a [u8],
1777 ctx: ::buffa::DecodeContext<'_>,
1778 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1779 let _ = ctx;
1780 #[allow(unused_variables)]
1781 let view = self;
1782 let mut cur = cur;
1783 match tag.field_number() {
1784 1u32 => {
1785 ::buffa::encoding::check_wire_type(
1786 tag,
1787 ::buffa::encoding::WireType::LengthDelimited,
1788 )?;
1789 view.intent_id = ::buffa::types::borrow_str(&mut cur)?;
1790 }
1791 _ => {
1792 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1793 let span_len = before_tag.len() - cur.len();
1794 view.__buffa_unknown_fields
1795 .push_record(before_tag, span_len, ctx)?;
1796 }
1797 }
1798 ::core::result::Result::Ok(cur)
1799 }
1800 fn to_owned_message(
1801 &self,
1802 ) -> ::core::result::Result<
1803 super::super::CreateTradingWithdrawResponse,
1804 ::buffa::DecodeError,
1805 > {
1806 self.to_owned_from_source(None)
1807 }
1808 #[allow(clippy::useless_conversion, clippy::needless_update)]
1809 fn to_owned_from_source(
1810 &self,
1811 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1812 ) -> ::core::result::Result<
1813 super::super::CreateTradingWithdrawResponse,
1814 ::buffa::DecodeError,
1815 > {
1816 #[allow(unused_imports)]
1817 use ::buffa::alloc::string::ToString as _;
1818 let _ = __buffa_src;
1819 ::core::result::Result::Ok(super::super::CreateTradingWithdrawResponse {
1820 intent_id: self.intent_id.to_string(),
1821 __buffa_unknown_fields: self
1822 .__buffa_unknown_fields
1823 .to_owned()?
1824 .into(),
1825 ..::core::default::Default::default()
1826 })
1827 }
1828 }
1829 impl<'a> ::buffa::ViewEncode<'a> for CreateTradingWithdrawResponseView<'a> {
1830 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1831 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1832 #[allow(unused_imports)]
1833 use ::buffa::Enumeration as _;
1834 let mut size = 0u32;
1835 if !self.intent_id.is_empty() {
1836 size
1837 += 1u32
1838 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
1839 }
1840 size += self.__buffa_unknown_fields.encoded_len() as u32;
1841 size
1842 }
1843 #[allow(clippy::needless_borrow)]
1844 fn write_to(
1845 &self,
1846 _cache: &mut ::buffa::SizeCache,
1847 buf: &mut impl ::buffa::bytes::BufMut,
1848 ) {
1849 #[allow(unused_imports)]
1850 use ::buffa::Enumeration as _;
1851 if !self.intent_id.is_empty() {
1852 ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
1853 }
1854 self.__buffa_unknown_fields.write_to(buf);
1855 }
1856 }
1857 impl<'__a> ::serde::Serialize for CreateTradingWithdrawResponseView<'__a> {
1869 fn serialize<__S: ::serde::Serializer>(
1870 &self,
1871 __s: __S,
1872 ) -> ::core::result::Result<__S::Ok, __S::Error> {
1873 use ::serde::ser::SerializeMap as _;
1874 let mut __map = __s.serialize_map(::core::option::Option::None)?;
1875 if !::buffa::json_helpers::skip_if::is_empty_str(self.intent_id) {
1876 __map.serialize_entry("intentId", self.intent_id)?;
1877 }
1878 __map.end()
1879 }
1880 }
1881 impl<'a> ::buffa::MessageName for CreateTradingWithdrawResponseView<'a> {
1882 const PACKAGE: &'static str = "chain.withdraw.v1";
1883 const NAME: &'static str = "CreateTradingWithdrawResponse";
1884 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
1885 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
1886 }
1887 ::buffa::impl_default_view_instance!(CreateTradingWithdrawResponseView);
1888 ::buffa::impl_view_reborrow!(CreateTradingWithdrawResponseView);
1889 #[derive(Clone, Debug)]
1895 pub struct CreateTradingWithdrawResponseOwnedView(
1896 ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
1897 );
1898 impl CreateTradingWithdrawResponseOwnedView {
1899 pub fn decode(
1909 bytes: ::buffa::bytes::Bytes,
1910 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1911 ::core::result::Result::Ok(
1912 CreateTradingWithdrawResponseOwnedView(
1913 ::buffa::OwnedView::decode(bytes)?,
1914 ),
1915 )
1916 }
1917 pub fn decode_with_options(
1925 bytes: ::buffa::bytes::Bytes,
1926 opts: &::buffa::DecodeOptions,
1927 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1928 ::core::result::Result::Ok(
1929 CreateTradingWithdrawResponseOwnedView(
1930 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
1931 ),
1932 )
1933 }
1934 pub fn from_owned(
1941 msg: &super::super::CreateTradingWithdrawResponse,
1942 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1943 ::core::result::Result::Ok(
1944 CreateTradingWithdrawResponseOwnedView(
1945 ::buffa::OwnedView::from_owned(msg)?,
1946 ),
1947 )
1948 }
1949 #[must_use]
1951 pub fn view(&self) -> &CreateTradingWithdrawResponseView<'_> {
1952 self.0.reborrow()
1953 }
1954 pub fn to_owned_message(
1961 &self,
1962 ) -> ::core::result::Result<
1963 super::super::CreateTradingWithdrawResponse,
1964 ::buffa::DecodeError,
1965 > {
1966 self.0.to_owned_message()
1967 }
1968 #[must_use]
1970 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1971 self.0.bytes()
1972 }
1973 #[must_use]
1975 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1976 self.0.into_bytes()
1977 }
1978 #[must_use]
1983 pub fn intent_id(&self) -> &'_ str {
1984 self.0.reborrow().intent_id
1985 }
1986 }
1987 impl ::core::convert::From<
1988 ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
1989 > for CreateTradingWithdrawResponseOwnedView {
1990 fn from(
1991 inner: ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
1992 ) -> Self {
1993 CreateTradingWithdrawResponseOwnedView(inner)
1994 }
1995 }
1996 impl ::core::convert::From<CreateTradingWithdrawResponseOwnedView>
1997 for ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>> {
1998 fn from(wrapper: CreateTradingWithdrawResponseOwnedView) -> Self {
1999 wrapper.0
2000 }
2001 }
2002 impl ::core::convert::AsRef<
2003 ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
2004 > for CreateTradingWithdrawResponseOwnedView {
2005 fn as_ref(
2006 &self,
2007 ) -> &::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>> {
2008 &self.0
2009 }
2010 }
2011 impl ::buffa::HasMessageView for super::super::CreateTradingWithdrawResponse {
2012 type View<'a> = CreateTradingWithdrawResponseView<'a>;
2013 type ViewHandle = CreateTradingWithdrawResponseOwnedView;
2014 }
2015 impl ::serde::Serialize for CreateTradingWithdrawResponseOwnedView {
2016 fn serialize<__S: ::serde::Serializer>(
2017 &self,
2018 __s: __S,
2019 ) -> ::core::result::Result<__S::Ok, __S::Error> {
2020 ::serde::Serialize::serialize(&self.0, __s)
2021 }
2022 }
2023 #[derive(Clone, Debug, Default)]
2026 pub struct CreateWalletTradingWithdrawResponseView<'a> {
2027 pub intent_id: &'a str,
2032 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2033 }
2034 impl<'a> ::buffa::MessageView<'a>
2035 for CreateWalletTradingWithdrawResponseView<'a> {
2036 type Owned = super::super::CreateWalletTradingWithdrawResponse;
2037 fn decode_view(
2038 buf: &'a [u8],
2039 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2040 let __limit = ::core::cell::Cell::new(
2041 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
2042 );
2043 <Self as ::buffa::MessageView>::decode_view_ctx(
2044 buf,
2045 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
2046 )
2047 }
2048 fn decode_view_with_ctx(
2049 buf: &'a [u8],
2050 ctx: ::buffa::DecodeContext<'_>,
2051 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2052 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2053 }
2054 fn merge_view_field(
2055 &mut self,
2056 tag: ::buffa::encoding::Tag,
2057 cur: &'a [u8],
2058 before_tag: &'a [u8],
2059 ctx: ::buffa::DecodeContext<'_>,
2060 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2061 let _ = ctx;
2062 #[allow(unused_variables)]
2063 let view = self;
2064 let mut cur = cur;
2065 match tag.field_number() {
2066 1u32 => {
2067 ::buffa::encoding::check_wire_type(
2068 tag,
2069 ::buffa::encoding::WireType::LengthDelimited,
2070 )?;
2071 view.intent_id = ::buffa::types::borrow_str(&mut cur)?;
2072 }
2073 _ => {
2074 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
2075 let span_len = before_tag.len() - cur.len();
2076 view.__buffa_unknown_fields
2077 .push_record(before_tag, span_len, ctx)?;
2078 }
2079 }
2080 ::core::result::Result::Ok(cur)
2081 }
2082 fn to_owned_message(
2083 &self,
2084 ) -> ::core::result::Result<
2085 super::super::CreateWalletTradingWithdrawResponse,
2086 ::buffa::DecodeError,
2087 > {
2088 self.to_owned_from_source(None)
2089 }
2090 #[allow(clippy::useless_conversion, clippy::needless_update)]
2091 fn to_owned_from_source(
2092 &self,
2093 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2094 ) -> ::core::result::Result<
2095 super::super::CreateWalletTradingWithdrawResponse,
2096 ::buffa::DecodeError,
2097 > {
2098 #[allow(unused_imports)]
2099 use ::buffa::alloc::string::ToString as _;
2100 let _ = __buffa_src;
2101 ::core::result::Result::Ok(super::super::CreateWalletTradingWithdrawResponse {
2102 intent_id: self.intent_id.to_string(),
2103 __buffa_unknown_fields: self
2104 .__buffa_unknown_fields
2105 .to_owned()?
2106 .into(),
2107 ..::core::default::Default::default()
2108 })
2109 }
2110 }
2111 impl<'a> ::buffa::ViewEncode<'a>
2112 for CreateWalletTradingWithdrawResponseView<'a> {
2113 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2114 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2115 #[allow(unused_imports)]
2116 use ::buffa::Enumeration as _;
2117 let mut size = 0u32;
2118 if !self.intent_id.is_empty() {
2119 size
2120 += 1u32
2121 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
2122 }
2123 size += self.__buffa_unknown_fields.encoded_len() as u32;
2124 size
2125 }
2126 #[allow(clippy::needless_borrow)]
2127 fn write_to(
2128 &self,
2129 _cache: &mut ::buffa::SizeCache,
2130 buf: &mut impl ::buffa::bytes::BufMut,
2131 ) {
2132 #[allow(unused_imports)]
2133 use ::buffa::Enumeration as _;
2134 if !self.intent_id.is_empty() {
2135 ::buffa::types::put_string_field(1u32, &self.intent_id, buf);
2136 }
2137 self.__buffa_unknown_fields.write_to(buf);
2138 }
2139 }
2140 impl<'__a> ::serde::Serialize for CreateWalletTradingWithdrawResponseView<'__a> {
2152 fn serialize<__S: ::serde::Serializer>(
2153 &self,
2154 __s: __S,
2155 ) -> ::core::result::Result<__S::Ok, __S::Error> {
2156 use ::serde::ser::SerializeMap as _;
2157 let mut __map = __s.serialize_map(::core::option::Option::None)?;
2158 if !::buffa::json_helpers::skip_if::is_empty_str(self.intent_id) {
2159 __map.serialize_entry("intentId", self.intent_id)?;
2160 }
2161 __map.end()
2162 }
2163 }
2164 impl<'a> ::buffa::MessageName for CreateWalletTradingWithdrawResponseView<'a> {
2165 const PACKAGE: &'static str = "chain.withdraw.v1";
2166 const NAME: &'static str = "CreateWalletTradingWithdrawResponse";
2167 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
2168 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
2169 }
2170 ::buffa::impl_default_view_instance!(CreateWalletTradingWithdrawResponseView);
2171 ::buffa::impl_view_reborrow!(CreateWalletTradingWithdrawResponseView);
2172 #[derive(Clone, Debug)]
2178 pub struct CreateWalletTradingWithdrawResponseOwnedView(
2179 ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
2180 );
2181 impl CreateWalletTradingWithdrawResponseOwnedView {
2182 pub fn decode(
2192 bytes: ::buffa::bytes::Bytes,
2193 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2194 ::core::result::Result::Ok(
2195 CreateWalletTradingWithdrawResponseOwnedView(
2196 ::buffa::OwnedView::decode(bytes)?,
2197 ),
2198 )
2199 }
2200 pub fn decode_with_options(
2208 bytes: ::buffa::bytes::Bytes,
2209 opts: &::buffa::DecodeOptions,
2210 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2211 ::core::result::Result::Ok(
2212 CreateWalletTradingWithdrawResponseOwnedView(
2213 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
2214 ),
2215 )
2216 }
2217 pub fn from_owned(
2224 msg: &super::super::CreateWalletTradingWithdrawResponse,
2225 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2226 ::core::result::Result::Ok(
2227 CreateWalletTradingWithdrawResponseOwnedView(
2228 ::buffa::OwnedView::from_owned(msg)?,
2229 ),
2230 )
2231 }
2232 #[must_use]
2234 pub fn view(&self) -> &CreateWalletTradingWithdrawResponseView<'_> {
2235 self.0.reborrow()
2236 }
2237 pub fn to_owned_message(
2244 &self,
2245 ) -> ::core::result::Result<
2246 super::super::CreateWalletTradingWithdrawResponse,
2247 ::buffa::DecodeError,
2248 > {
2249 self.0.to_owned_message()
2250 }
2251 #[must_use]
2253 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2254 self.0.bytes()
2255 }
2256 #[must_use]
2258 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2259 self.0.into_bytes()
2260 }
2261 #[must_use]
2266 pub fn intent_id(&self) -> &'_ str {
2267 self.0.reborrow().intent_id
2268 }
2269 }
2270 impl ::core::convert::From<
2271 ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
2272 > for CreateWalletTradingWithdrawResponseOwnedView {
2273 fn from(
2274 inner: ::buffa::OwnedView<
2275 CreateWalletTradingWithdrawResponseView<'static>,
2276 >,
2277 ) -> Self {
2278 CreateWalletTradingWithdrawResponseOwnedView(inner)
2279 }
2280 }
2281 impl ::core::convert::From<CreateWalletTradingWithdrawResponseOwnedView>
2282 for ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>> {
2283 fn from(wrapper: CreateWalletTradingWithdrawResponseOwnedView) -> Self {
2284 wrapper.0
2285 }
2286 }
2287 impl ::core::convert::AsRef<
2288 ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
2289 > for CreateWalletTradingWithdrawResponseOwnedView {
2290 fn as_ref(
2291 &self,
2292 ) -> &::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>> {
2293 &self.0
2294 }
2295 }
2296 impl ::buffa::HasMessageView
2297 for super::super::CreateWalletTradingWithdrawResponse {
2298 type View<'a> = CreateWalletTradingWithdrawResponseView<'a>;
2299 type ViewHandle = CreateWalletTradingWithdrawResponseOwnedView;
2300 }
2301 impl ::serde::Serialize for CreateWalletTradingWithdrawResponseOwnedView {
2302 fn serialize<__S: ::serde::Serializer>(
2303 &self,
2304 __s: __S,
2305 ) -> ::core::result::Result<__S::Ok, __S::Error> {
2306 ::serde::Serialize::serialize(&self.0, __s)
2307 }
2308 }
2309 #[derive(Clone, Debug, Default)]
2312 pub struct TradingWithdrawIntentPayloadView<'a> {
2313 pub action: ::buffa::EnumValue<super::super::TradingWithdrawAction>,
2317 pub asset_id: u32,
2322 pub destination_chain_id: u64,
2326 pub amount_e18: ::buffa::MessageFieldView<
2331 super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
2332 'a,
2333 >,
2334 >,
2335 pub deadline_ts_sec: u64,
2341 pub nonce: ::buffa::MessageFieldView<
2346 super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
2347 'a,
2348 >,
2349 >,
2350 pub destination_address: &'a str,
2358 pub idempotency_key: &'a str,
2363 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2364 }
2365 impl<'a> ::buffa::MessageView<'a> for TradingWithdrawIntentPayloadView<'a> {
2366 type Owned = super::super::TradingWithdrawIntentPayload;
2367 fn decode_view(
2368 buf: &'a [u8],
2369 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2370 let __limit = ::core::cell::Cell::new(
2371 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
2372 );
2373 <Self as ::buffa::MessageView>::decode_view_ctx(
2374 buf,
2375 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
2376 )
2377 }
2378 fn decode_view_with_ctx(
2379 buf: &'a [u8],
2380 ctx: ::buffa::DecodeContext<'_>,
2381 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2382 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2383 }
2384 fn merge_view_field(
2385 &mut self,
2386 tag: ::buffa::encoding::Tag,
2387 cur: &'a [u8],
2388 before_tag: &'a [u8],
2389 ctx: ::buffa::DecodeContext<'_>,
2390 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2391 let _ = ctx;
2392 #[allow(unused_variables)]
2393 let view = self;
2394 let mut cur = cur;
2395 match tag.field_number() {
2396 1u32 => {
2397 ::buffa::encoding::check_wire_type(
2398 tag,
2399 ::buffa::encoding::WireType::Varint,
2400 )?;
2401 view.action = ::buffa::EnumValue::from(
2402 ::buffa::types::decode_int32(&mut cur)?,
2403 );
2404 }
2405 2u32 => {
2406 ::buffa::encoding::check_wire_type(
2407 tag,
2408 ::buffa::encoding::WireType::Varint,
2409 )?;
2410 view.asset_id = ::buffa::types::decode_uint32(&mut cur)?;
2411 }
2412 3u32 => {
2413 ::buffa::encoding::check_wire_type(
2414 tag,
2415 ::buffa::encoding::WireType::Varint,
2416 )?;
2417 view.destination_chain_id = ::buffa::types::decode_uint64(
2418 &mut cur,
2419 )?;
2420 }
2421 4u32 => {
2422 ::buffa::encoding::check_wire_type(
2423 tag,
2424 ::buffa::encoding::WireType::LengthDelimited,
2425 )?;
2426 let __sub_ctx = ctx.descend()?;
2427 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2428 match view.amount_e18.as_mut() {
2429 Some(existing) => {
2430 ::buffa::MessageView::merge_into_view(
2431 existing,
2432 sub,
2433 __sub_ctx,
2434 )?
2435 }
2436 None => {
2437 view.amount_e18 = ::buffa::MessageFieldView::set(
2438 <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
2439 sub,
2440 __sub_ctx,
2441 )?,
2442 );
2443 }
2444 }
2445 }
2446 5u32 => {
2447 ::buffa::encoding::check_wire_type(
2448 tag,
2449 ::buffa::encoding::WireType::Varint,
2450 )?;
2451 view.deadline_ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
2452 }
2453 6u32 => {
2454 ::buffa::encoding::check_wire_type(
2455 tag,
2456 ::buffa::encoding::WireType::LengthDelimited,
2457 )?;
2458 let __sub_ctx = ctx.descend()?;
2459 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2460 match view.nonce.as_mut() {
2461 Some(existing) => {
2462 ::buffa::MessageView::merge_into_view(
2463 existing,
2464 sub,
2465 __sub_ctx,
2466 )?
2467 }
2468 None => {
2469 view.nonce = ::buffa::MessageFieldView::set(
2470 <super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
2471 sub,
2472 __sub_ctx,
2473 )?,
2474 );
2475 }
2476 }
2477 }
2478 7u32 => {
2479 ::buffa::encoding::check_wire_type(
2480 tag,
2481 ::buffa::encoding::WireType::LengthDelimited,
2482 )?;
2483 view.destination_address = ::buffa::types::borrow_str(&mut cur)?;
2484 }
2485 8u32 => {
2486 ::buffa::encoding::check_wire_type(
2487 tag,
2488 ::buffa::encoding::WireType::LengthDelimited,
2489 )?;
2490 view.idempotency_key = ::buffa::types::borrow_str(&mut cur)?;
2491 }
2492 _ => {
2493 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
2494 let span_len = before_tag.len() - cur.len();
2495 view.__buffa_unknown_fields
2496 .push_record(before_tag, span_len, ctx)?;
2497 }
2498 }
2499 ::core::result::Result::Ok(cur)
2500 }
2501 fn to_owned_message(
2502 &self,
2503 ) -> ::core::result::Result<
2504 super::super::TradingWithdrawIntentPayload,
2505 ::buffa::DecodeError,
2506 > {
2507 self.to_owned_from_source(None)
2508 }
2509 #[allow(clippy::useless_conversion, clippy::needless_update)]
2510 fn to_owned_from_source(
2511 &self,
2512 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2513 ) -> ::core::result::Result<
2514 super::super::TradingWithdrawIntentPayload,
2515 ::buffa::DecodeError,
2516 > {
2517 #[allow(unused_imports)]
2518 use ::buffa::alloc::string::ToString as _;
2519 let _ = __buffa_src;
2520 ::core::result::Result::Ok(super::super::TradingWithdrawIntentPayload {
2521 action: self.action,
2522 asset_id: self.asset_id,
2523 destination_chain_id: self.destination_chain_id,
2524 amount_e18: match self.amount_e18.as_option() {
2525 Some(v) => {
2526 ::buffa::MessageField::<
2527 super::super::super::super::super::polyester::r#type::v1::U128,
2528 >::some(v.to_owned_from_source(__buffa_src)?)
2529 }
2530 None => ::buffa::MessageField::none(),
2531 },
2532 deadline_ts_sec: self.deadline_ts_sec,
2533 nonce: match self.nonce.as_option() {
2534 Some(v) => {
2535 ::buffa::MessageField::<
2536 super::super::super::super::super::polyester::r#type::v1::U128,
2537 >::some(v.to_owned_from_source(__buffa_src)?)
2538 }
2539 None => ::buffa::MessageField::none(),
2540 },
2541 destination_address: self.destination_address.to_string(),
2542 idempotency_key: self.idempotency_key.to_string(),
2543 __buffa_unknown_fields: self
2544 .__buffa_unknown_fields
2545 .to_owned()?
2546 .into(),
2547 ..::core::default::Default::default()
2548 })
2549 }
2550 }
2551 impl<'a> ::buffa::ViewEncode<'a> for TradingWithdrawIntentPayloadView<'a> {
2552 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2553 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2554 #[allow(unused_imports)]
2555 use ::buffa::Enumeration as _;
2556 let mut size = 0u32;
2557 {
2558 let val = self.action.to_i32();
2559 if val != 0 {
2560 size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2561 }
2562 }
2563 if self.asset_id != 0u32 {
2564 size
2565 += 1u32
2566 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
2567 }
2568 if self.destination_chain_id != 0u64 {
2569 size
2570 += 1u32
2571 + ::buffa::types::uint64_encoded_len(
2572 self.destination_chain_id,
2573 ) as u32;
2574 }
2575 if self.amount_e18.is_set() {
2576 let __slot = __cache.reserve();
2577 let inner_size = self.amount_e18.compute_size(__cache);
2578 __cache.set(__slot, inner_size);
2579 size
2580 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2581 + inner_size;
2582 }
2583 if self.deadline_ts_sec != 0u64 {
2584 size
2585 += 1u32
2586 + ::buffa::types::uint64_encoded_len(self.deadline_ts_sec)
2587 as u32;
2588 }
2589 if self.nonce.is_set() {
2590 let __slot = __cache.reserve();
2591 let inner_size = self.nonce.compute_size(__cache);
2592 __cache.set(__slot, inner_size);
2593 size
2594 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2595 + inner_size;
2596 }
2597 if !self.destination_address.is_empty() {
2598 size
2599 += 1u32
2600 + ::buffa::types::string_encoded_len(
2601 &self.destination_address,
2602 ) as u32;
2603 }
2604 if !self.idempotency_key.is_empty() {
2605 size
2606 += 1u32
2607 + ::buffa::types::string_encoded_len(&self.idempotency_key)
2608 as u32;
2609 }
2610 size += self.__buffa_unknown_fields.encoded_len() as u32;
2611 size
2612 }
2613 #[allow(clippy::needless_borrow)]
2614 fn write_to(
2615 &self,
2616 __cache: &mut ::buffa::SizeCache,
2617 buf: &mut impl ::buffa::bytes::BufMut,
2618 ) {
2619 #[allow(unused_imports)]
2620 use ::buffa::Enumeration as _;
2621 {
2622 let val = self.action.to_i32();
2623 if val != 0 {
2624 ::buffa::types::put_int32_field(1u32, val, buf);
2625 }
2626 }
2627 if self.asset_id != 0u32 {
2628 ::buffa::types::put_uint32_field(2u32, self.asset_id, buf);
2629 }
2630 if self.destination_chain_id != 0u64 {
2631 ::buffa::types::put_uint64_field(
2632 3u32,
2633 self.destination_chain_id,
2634 buf,
2635 );
2636 }
2637 if self.amount_e18.is_set() {
2638 ::buffa::types::put_len_delimited_header(
2639 4u32,
2640 __cache.consume_next(),
2641 buf,
2642 );
2643 self.amount_e18.write_to(__cache, buf);
2644 }
2645 if self.deadline_ts_sec != 0u64 {
2646 ::buffa::types::put_uint64_field(5u32, self.deadline_ts_sec, buf);
2647 }
2648 if self.nonce.is_set() {
2649 ::buffa::types::put_len_delimited_header(
2650 6u32,
2651 __cache.consume_next(),
2652 buf,
2653 );
2654 self.nonce.write_to(__cache, buf);
2655 }
2656 if !self.destination_address.is_empty() {
2657 ::buffa::types::put_string_field(
2658 7u32,
2659 &self.destination_address,
2660 buf,
2661 );
2662 }
2663 if !self.idempotency_key.is_empty() {
2664 ::buffa::types::put_string_field(8u32, &self.idempotency_key, buf);
2665 }
2666 self.__buffa_unknown_fields.write_to(buf);
2667 }
2668 }
2669 impl<'__a> ::serde::Serialize for TradingWithdrawIntentPayloadView<'__a> {
2681 fn serialize<__S: ::serde::Serializer>(
2682 &self,
2683 __s: __S,
2684 ) -> ::core::result::Result<__S::Ok, __S::Error> {
2685 use ::serde::ser::SerializeMap as _;
2686 let mut __map = __s.serialize_map(::core::option::Option::None)?;
2687 if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.action) {
2688 __map.serialize_entry("action", &self.action)?;
2689 }
2690 if !::buffa::json_helpers::skip_if::is_zero_u32(&self.asset_id) {
2691 __map
2692 .serialize_entry(
2693 "assetId",
2694 &::buffa::json_helpers::ProtoJson(&self.asset_id),
2695 )?;
2696 }
2697 if !::buffa::json_helpers::skip_if::is_zero_u64(
2698 &self.destination_chain_id,
2699 ) {
2700 __map
2701 .serialize_entry(
2702 "destinationChainId",
2703 &::buffa::json_helpers::ProtoJson(&self.destination_chain_id),
2704 )?;
2705 }
2706 {
2707 if let ::core::option::Option::Some(__v) = self
2708 .amount_e18
2709 .as_option()
2710 {
2711 __map.serialize_entry("amountE18", __v)?;
2712 }
2713 }
2714 if !::buffa::json_helpers::skip_if::is_zero_u64(&self.deadline_ts_sec) {
2715 __map
2716 .serialize_entry(
2717 "deadlineTsSec",
2718 &::buffa::json_helpers::ProtoJson(&self.deadline_ts_sec),
2719 )?;
2720 }
2721 {
2722 if let ::core::option::Option::Some(__v) = self.nonce.as_option() {
2723 __map.serialize_entry("nonce", __v)?;
2724 }
2725 }
2726 if !::buffa::json_helpers::skip_if::is_empty_str(
2727 self.destination_address,
2728 ) {
2729 __map
2730 .serialize_entry(
2731 "destinationAddress",
2732 self.destination_address,
2733 )?;
2734 }
2735 if !::buffa::json_helpers::skip_if::is_empty_str(self.idempotency_key) {
2736 __map.serialize_entry("idempotencyKey", self.idempotency_key)?;
2737 }
2738 __map.end()
2739 }
2740 }
2741 impl<'a> ::buffa::MessageName for TradingWithdrawIntentPayloadView<'a> {
2742 const PACKAGE: &'static str = "chain.withdraw.v1";
2743 const NAME: &'static str = "TradingWithdrawIntentPayload";
2744 const FULL_NAME: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
2745 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
2746 }
2747 ::buffa::impl_default_view_instance!(TradingWithdrawIntentPayloadView);
2748 ::buffa::impl_view_reborrow!(TradingWithdrawIntentPayloadView);
2749 #[derive(Clone, Debug)]
2755 pub struct TradingWithdrawIntentPayloadOwnedView(
2756 ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2757 );
2758 impl TradingWithdrawIntentPayloadOwnedView {
2759 pub fn decode(
2769 bytes: ::buffa::bytes::Bytes,
2770 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2771 ::core::result::Result::Ok(
2772 TradingWithdrawIntentPayloadOwnedView(
2773 ::buffa::OwnedView::decode(bytes)?,
2774 ),
2775 )
2776 }
2777 pub fn decode_with_options(
2785 bytes: ::buffa::bytes::Bytes,
2786 opts: &::buffa::DecodeOptions,
2787 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2788 ::core::result::Result::Ok(
2789 TradingWithdrawIntentPayloadOwnedView(
2790 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
2791 ),
2792 )
2793 }
2794 pub fn from_owned(
2801 msg: &super::super::TradingWithdrawIntentPayload,
2802 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2803 ::core::result::Result::Ok(
2804 TradingWithdrawIntentPayloadOwnedView(
2805 ::buffa::OwnedView::from_owned(msg)?,
2806 ),
2807 )
2808 }
2809 #[must_use]
2811 pub fn view(&self) -> &TradingWithdrawIntentPayloadView<'_> {
2812 self.0.reborrow()
2813 }
2814 pub fn to_owned_message(
2821 &self,
2822 ) -> ::core::result::Result<
2823 super::super::TradingWithdrawIntentPayload,
2824 ::buffa::DecodeError,
2825 > {
2826 self.0.to_owned_message()
2827 }
2828 #[must_use]
2830 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2831 self.0.bytes()
2832 }
2833 #[must_use]
2835 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2836 self.0.into_bytes()
2837 }
2838 #[must_use]
2842 pub fn action(
2843 &self,
2844 ) -> ::buffa::EnumValue<super::super::TradingWithdrawAction> {
2845 self.0.reborrow().action
2846 }
2847 #[must_use]
2852 pub fn asset_id(&self) -> u32 {
2853 self.0.reborrow().asset_id
2854 }
2855 #[must_use]
2859 pub fn destination_chain_id(&self) -> u64 {
2860 self.0.reborrow().destination_chain_id
2861 }
2862 #[must_use]
2867 pub fn amount_e18(
2868 &self,
2869 ) -> &::buffa::MessageFieldView<
2870 super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
2871 '_,
2872 >,
2873 > {
2874 &self.0.reborrow().amount_e18
2875 }
2876 #[must_use]
2882 pub fn deadline_ts_sec(&self) -> u64 {
2883 self.0.reborrow().deadline_ts_sec
2884 }
2885 #[must_use]
2890 pub fn nonce(
2891 &self,
2892 ) -> &::buffa::MessageFieldView<
2893 super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
2894 '_,
2895 >,
2896 > {
2897 &self.0.reborrow().nonce
2898 }
2899 #[must_use]
2907 pub fn destination_address(&self) -> &'_ str {
2908 self.0.reborrow().destination_address
2909 }
2910 #[must_use]
2915 pub fn idempotency_key(&self) -> &'_ str {
2916 self.0.reborrow().idempotency_key
2917 }
2918 }
2919 impl ::core::convert::From<
2920 ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2921 > for TradingWithdrawIntentPayloadOwnedView {
2922 fn from(
2923 inner: ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2924 ) -> Self {
2925 TradingWithdrawIntentPayloadOwnedView(inner)
2926 }
2927 }
2928 impl ::core::convert::From<TradingWithdrawIntentPayloadOwnedView>
2929 for ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>> {
2930 fn from(wrapper: TradingWithdrawIntentPayloadOwnedView) -> Self {
2931 wrapper.0
2932 }
2933 }
2934 impl ::core::convert::AsRef<
2935 ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
2936 > for TradingWithdrawIntentPayloadOwnedView {
2937 fn as_ref(
2938 &self,
2939 ) -> &::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>> {
2940 &self.0
2941 }
2942 }
2943 impl ::buffa::HasMessageView for super::super::TradingWithdrawIntentPayload {
2944 type View<'a> = TradingWithdrawIntentPayloadView<'a>;
2945 type ViewHandle = TradingWithdrawIntentPayloadOwnedView;
2946 }
2947 impl ::serde::Serialize for TradingWithdrawIntentPayloadOwnedView {
2948 fn serialize<__S: ::serde::Serializer>(
2949 &self,
2950 __s: __S,
2951 ) -> ::core::result::Result<__S::Ok, __S::Error> {
2952 ::serde::Serialize::serialize(&self.0, __s)
2953 }
2954 }
2955 #[derive(Clone, Debug, Default)]
2958 pub struct CreateTradingWithdrawRequestView<'a> {
2959 pub payload: ::buffa::MessageFieldView<
2963 super::super::__buffa::view::TradingWithdrawIntentPayloadView<'a>,
2964 >,
2965 pub payload_signature: &'a [u8],
2969 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2970 }
2971 impl<'a> ::buffa::MessageView<'a> for CreateTradingWithdrawRequestView<'a> {
2972 type Owned = super::super::CreateTradingWithdrawRequest;
2973 fn decode_view(
2974 buf: &'a [u8],
2975 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2976 let __limit = ::core::cell::Cell::new(
2977 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
2978 );
2979 <Self as ::buffa::MessageView>::decode_view_ctx(
2980 buf,
2981 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
2982 )
2983 }
2984 fn decode_view_with_ctx(
2985 buf: &'a [u8],
2986 ctx: ::buffa::DecodeContext<'_>,
2987 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2988 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2989 }
2990 fn merge_view_field(
2991 &mut self,
2992 tag: ::buffa::encoding::Tag,
2993 cur: &'a [u8],
2994 before_tag: &'a [u8],
2995 ctx: ::buffa::DecodeContext<'_>,
2996 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2997 let _ = ctx;
2998 #[allow(unused_variables)]
2999 let view = self;
3000 let mut cur = cur;
3001 match tag.field_number() {
3002 1u32 => {
3003 ::buffa::encoding::check_wire_type(
3004 tag,
3005 ::buffa::encoding::WireType::LengthDelimited,
3006 )?;
3007 let __sub_ctx = ctx.descend()?;
3008 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
3009 match view.payload.as_mut() {
3010 Some(existing) => {
3011 ::buffa::MessageView::merge_into_view(
3012 existing,
3013 sub,
3014 __sub_ctx,
3015 )?
3016 }
3017 None => {
3018 view.payload = ::buffa::MessageFieldView::set(
3019 <super::super::__buffa::view::TradingWithdrawIntentPayloadView as ::buffa::MessageView>::decode_view_ctx(
3020 sub,
3021 __sub_ctx,
3022 )?,
3023 );
3024 }
3025 }
3026 }
3027 2u32 => {
3028 ::buffa::encoding::check_wire_type(
3029 tag,
3030 ::buffa::encoding::WireType::LengthDelimited,
3031 )?;
3032 view.payload_signature = ::buffa::types::borrow_bytes(&mut cur)?;
3033 }
3034 _ => {
3035 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
3036 let span_len = before_tag.len() - cur.len();
3037 view.__buffa_unknown_fields
3038 .push_record(before_tag, span_len, ctx)?;
3039 }
3040 }
3041 ::core::result::Result::Ok(cur)
3042 }
3043 fn to_owned_message(
3044 &self,
3045 ) -> ::core::result::Result<
3046 super::super::CreateTradingWithdrawRequest,
3047 ::buffa::DecodeError,
3048 > {
3049 self.to_owned_from_source(None)
3050 }
3051 #[allow(clippy::useless_conversion, clippy::needless_update)]
3052 fn to_owned_from_source(
3053 &self,
3054 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
3055 ) -> ::core::result::Result<
3056 super::super::CreateTradingWithdrawRequest,
3057 ::buffa::DecodeError,
3058 > {
3059 #[allow(unused_imports)]
3060 use ::buffa::alloc::string::ToString as _;
3061 let _ = __buffa_src;
3062 ::core::result::Result::Ok(super::super::CreateTradingWithdrawRequest {
3063 payload: match self.payload.as_option() {
3064 Some(v) => {
3065 ::buffa::MessageField::<
3066 super::super::TradingWithdrawIntentPayload,
3067 >::some(v.to_owned_from_source(__buffa_src)?)
3068 }
3069 None => ::buffa::MessageField::none(),
3070 },
3071 payload_signature: (self.payload_signature).to_vec(),
3072 __buffa_unknown_fields: self
3073 .__buffa_unknown_fields
3074 .to_owned()?
3075 .into(),
3076 ..::core::default::Default::default()
3077 })
3078 }
3079 }
3080 impl<'a> ::buffa::ViewEncode<'a> for CreateTradingWithdrawRequestView<'a> {
3081 #[allow(clippy::needless_borrow, clippy::let_and_return)]
3082 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3083 #[allow(unused_imports)]
3084 use ::buffa::Enumeration as _;
3085 let mut size = 0u32;
3086 if self.payload.is_set() {
3087 let __slot = __cache.reserve();
3088 let inner_size = self.payload.compute_size(__cache);
3089 __cache.set(__slot, inner_size);
3090 size
3091 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3092 + inner_size;
3093 }
3094 if !self.payload_signature.is_empty() {
3095 size
3096 += 1u32
3097 + ::buffa::types::bytes_encoded_len(&self.payload_signature)
3098 as u32;
3099 }
3100 size += self.__buffa_unknown_fields.encoded_len() as u32;
3101 size
3102 }
3103 #[allow(clippy::needless_borrow)]
3104 fn write_to(
3105 &self,
3106 __cache: &mut ::buffa::SizeCache,
3107 buf: &mut impl ::buffa::bytes::BufMut,
3108 ) {
3109 #[allow(unused_imports)]
3110 use ::buffa::Enumeration as _;
3111 if self.payload.is_set() {
3112 ::buffa::types::put_len_delimited_header(
3113 1u32,
3114 __cache.consume_next(),
3115 buf,
3116 );
3117 self.payload.write_to(__cache, buf);
3118 }
3119 if !self.payload_signature.is_empty() {
3120 ::buffa::types::put_bytes_field(2u32, &self.payload_signature, buf);
3121 }
3122 self.__buffa_unknown_fields.write_to(buf);
3123 }
3124 }
3125 impl<'__a> ::serde::Serialize for CreateTradingWithdrawRequestView<'__a> {
3137 fn serialize<__S: ::serde::Serializer>(
3138 &self,
3139 __s: __S,
3140 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3141 use ::serde::ser::SerializeMap as _;
3142 let mut __map = __s.serialize_map(::core::option::Option::None)?;
3143 {
3144 if let ::core::option::Option::Some(__v) = self.payload.as_option() {
3145 __map.serialize_entry("payload", __v)?;
3146 }
3147 }
3148 if !::buffa::json_helpers::skip_if::is_empty_bytes(
3149 self.payload_signature,
3150 ) {
3151 __map
3152 .serialize_entry(
3153 "payloadSignature",
3154 &::buffa::json_helpers::BytesJson(self.payload_signature),
3155 )?;
3156 }
3157 __map.end()
3158 }
3159 }
3160 impl<'a> ::buffa::MessageName for CreateTradingWithdrawRequestView<'a> {
3161 const PACKAGE: &'static str = "chain.withdraw.v1";
3162 const NAME: &'static str = "CreateTradingWithdrawRequest";
3163 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
3164 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
3165 }
3166 ::buffa::impl_default_view_instance!(CreateTradingWithdrawRequestView);
3167 ::buffa::impl_view_reborrow!(CreateTradingWithdrawRequestView);
3168 #[derive(Clone, Debug)]
3174 pub struct CreateTradingWithdrawRequestOwnedView(
3175 ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
3176 );
3177 impl CreateTradingWithdrawRequestOwnedView {
3178 pub fn decode(
3188 bytes: ::buffa::bytes::Bytes,
3189 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3190 ::core::result::Result::Ok(
3191 CreateTradingWithdrawRequestOwnedView(
3192 ::buffa::OwnedView::decode(bytes)?,
3193 ),
3194 )
3195 }
3196 pub fn decode_with_options(
3204 bytes: ::buffa::bytes::Bytes,
3205 opts: &::buffa::DecodeOptions,
3206 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3207 ::core::result::Result::Ok(
3208 CreateTradingWithdrawRequestOwnedView(
3209 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
3210 ),
3211 )
3212 }
3213 pub fn from_owned(
3220 msg: &super::super::CreateTradingWithdrawRequest,
3221 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3222 ::core::result::Result::Ok(
3223 CreateTradingWithdrawRequestOwnedView(
3224 ::buffa::OwnedView::from_owned(msg)?,
3225 ),
3226 )
3227 }
3228 #[must_use]
3230 pub fn view(&self) -> &CreateTradingWithdrawRequestView<'_> {
3231 self.0.reborrow()
3232 }
3233 pub fn to_owned_message(
3240 &self,
3241 ) -> ::core::result::Result<
3242 super::super::CreateTradingWithdrawRequest,
3243 ::buffa::DecodeError,
3244 > {
3245 self.0.to_owned_message()
3246 }
3247 #[must_use]
3249 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
3250 self.0.bytes()
3251 }
3252 #[must_use]
3254 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
3255 self.0.into_bytes()
3256 }
3257 #[must_use]
3261 pub fn payload(
3262 &self,
3263 ) -> &::buffa::MessageFieldView<
3264 super::super::__buffa::view::TradingWithdrawIntentPayloadView<'_>,
3265 > {
3266 &self.0.reborrow().payload
3267 }
3268 #[must_use]
3272 pub fn payload_signature(&self) -> &'_ [u8] {
3273 self.0.reborrow().payload_signature
3274 }
3275 }
3276 impl ::core::convert::From<
3277 ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
3278 > for CreateTradingWithdrawRequestOwnedView {
3279 fn from(
3280 inner: ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
3281 ) -> Self {
3282 CreateTradingWithdrawRequestOwnedView(inner)
3283 }
3284 }
3285 impl ::core::convert::From<CreateTradingWithdrawRequestOwnedView>
3286 for ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>> {
3287 fn from(wrapper: CreateTradingWithdrawRequestOwnedView) -> Self {
3288 wrapper.0
3289 }
3290 }
3291 impl ::core::convert::AsRef<
3292 ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
3293 > for CreateTradingWithdrawRequestOwnedView {
3294 fn as_ref(
3295 &self,
3296 ) -> &::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>> {
3297 &self.0
3298 }
3299 }
3300 impl ::buffa::HasMessageView for super::super::CreateTradingWithdrawRequest {
3301 type View<'a> = CreateTradingWithdrawRequestView<'a>;
3302 type ViewHandle = CreateTradingWithdrawRequestOwnedView;
3303 }
3304 impl ::serde::Serialize for CreateTradingWithdrawRequestOwnedView {
3305 fn serialize<__S: ::serde::Serializer>(
3306 &self,
3307 __s: __S,
3308 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3309 ::serde::Serialize::serialize(&self.0, __s)
3310 }
3311 }
3312 #[derive(Clone, Debug, Default)]
3315 pub struct CreateWalletTradingWithdrawRequestView<'a> {
3316 pub payload: ::buffa::MessageFieldView<
3320 super::super::__buffa::view::TradingWithdrawIntentPayloadView<'a>,
3321 >,
3322 pub subaccount_id: u64,
3326 pub signer_wallet: &'a str,
3330 pub payload_signature: &'a [u8],
3334 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3335 }
3336 impl<'a> ::buffa::MessageView<'a>
3337 for CreateWalletTradingWithdrawRequestView<'a> {
3338 type Owned = super::super::CreateWalletTradingWithdrawRequest;
3339 fn decode_view(
3340 buf: &'a [u8],
3341 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3342 let __limit = ::core::cell::Cell::new(
3343 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
3344 );
3345 <Self as ::buffa::MessageView>::decode_view_ctx(
3346 buf,
3347 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
3348 )
3349 }
3350 fn decode_view_with_ctx(
3351 buf: &'a [u8],
3352 ctx: ::buffa::DecodeContext<'_>,
3353 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3354 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
3355 }
3356 fn merge_view_field(
3357 &mut self,
3358 tag: ::buffa::encoding::Tag,
3359 cur: &'a [u8],
3360 before_tag: &'a [u8],
3361 ctx: ::buffa::DecodeContext<'_>,
3362 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
3363 let _ = ctx;
3364 #[allow(unused_variables)]
3365 let view = self;
3366 let mut cur = cur;
3367 match tag.field_number() {
3368 1u32 => {
3369 ::buffa::encoding::check_wire_type(
3370 tag,
3371 ::buffa::encoding::WireType::LengthDelimited,
3372 )?;
3373 let __sub_ctx = ctx.descend()?;
3374 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
3375 match view.payload.as_mut() {
3376 Some(existing) => {
3377 ::buffa::MessageView::merge_into_view(
3378 existing,
3379 sub,
3380 __sub_ctx,
3381 )?
3382 }
3383 None => {
3384 view.payload = ::buffa::MessageFieldView::set(
3385 <super::super::__buffa::view::TradingWithdrawIntentPayloadView as ::buffa::MessageView>::decode_view_ctx(
3386 sub,
3387 __sub_ctx,
3388 )?,
3389 );
3390 }
3391 }
3392 }
3393 2u32 => {
3394 ::buffa::encoding::check_wire_type(
3395 tag,
3396 ::buffa::encoding::WireType::Varint,
3397 )?;
3398 view.subaccount_id = ::buffa::types::decode_uint64(&mut cur)?;
3399 }
3400 3u32 => {
3401 ::buffa::encoding::check_wire_type(
3402 tag,
3403 ::buffa::encoding::WireType::LengthDelimited,
3404 )?;
3405 view.signer_wallet = ::buffa::types::borrow_str(&mut cur)?;
3406 }
3407 4u32 => {
3408 ::buffa::encoding::check_wire_type(
3409 tag,
3410 ::buffa::encoding::WireType::LengthDelimited,
3411 )?;
3412 view.payload_signature = ::buffa::types::borrow_bytes(&mut cur)?;
3413 }
3414 _ => {
3415 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
3416 let span_len = before_tag.len() - cur.len();
3417 view.__buffa_unknown_fields
3418 .push_record(before_tag, span_len, ctx)?;
3419 }
3420 }
3421 ::core::result::Result::Ok(cur)
3422 }
3423 fn to_owned_message(
3424 &self,
3425 ) -> ::core::result::Result<
3426 super::super::CreateWalletTradingWithdrawRequest,
3427 ::buffa::DecodeError,
3428 > {
3429 self.to_owned_from_source(None)
3430 }
3431 #[allow(clippy::useless_conversion, clippy::needless_update)]
3432 fn to_owned_from_source(
3433 &self,
3434 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
3435 ) -> ::core::result::Result<
3436 super::super::CreateWalletTradingWithdrawRequest,
3437 ::buffa::DecodeError,
3438 > {
3439 #[allow(unused_imports)]
3440 use ::buffa::alloc::string::ToString as _;
3441 let _ = __buffa_src;
3442 ::core::result::Result::Ok(super::super::CreateWalletTradingWithdrawRequest {
3443 payload: match self.payload.as_option() {
3444 Some(v) => {
3445 ::buffa::MessageField::<
3446 super::super::TradingWithdrawIntentPayload,
3447 >::some(v.to_owned_from_source(__buffa_src)?)
3448 }
3449 None => ::buffa::MessageField::none(),
3450 },
3451 subaccount_id: self.subaccount_id,
3452 signer_wallet: self.signer_wallet.to_string(),
3453 payload_signature: (self.payload_signature).to_vec(),
3454 __buffa_unknown_fields: self
3455 .__buffa_unknown_fields
3456 .to_owned()?
3457 .into(),
3458 ..::core::default::Default::default()
3459 })
3460 }
3461 }
3462 impl<'a> ::buffa::ViewEncode<'a> for CreateWalletTradingWithdrawRequestView<'a> {
3463 #[allow(clippy::needless_borrow, clippy::let_and_return)]
3464 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3465 #[allow(unused_imports)]
3466 use ::buffa::Enumeration as _;
3467 let mut size = 0u32;
3468 if self.payload.is_set() {
3469 let __slot = __cache.reserve();
3470 let inner_size = self.payload.compute_size(__cache);
3471 __cache.set(__slot, inner_size);
3472 size
3473 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3474 + inner_size;
3475 }
3476 if self.subaccount_id != 0u64 {
3477 size
3478 += 1u32
3479 + ::buffa::types::uint64_encoded_len(self.subaccount_id)
3480 as u32;
3481 }
3482 if !self.signer_wallet.is_empty() {
3483 size
3484 += 1u32
3485 + ::buffa::types::string_encoded_len(&self.signer_wallet)
3486 as u32;
3487 }
3488 if !self.payload_signature.is_empty() {
3489 size
3490 += 1u32
3491 + ::buffa::types::bytes_encoded_len(&self.payload_signature)
3492 as u32;
3493 }
3494 size += self.__buffa_unknown_fields.encoded_len() as u32;
3495 size
3496 }
3497 #[allow(clippy::needless_borrow)]
3498 fn write_to(
3499 &self,
3500 __cache: &mut ::buffa::SizeCache,
3501 buf: &mut impl ::buffa::bytes::BufMut,
3502 ) {
3503 #[allow(unused_imports)]
3504 use ::buffa::Enumeration as _;
3505 if self.payload.is_set() {
3506 ::buffa::types::put_len_delimited_header(
3507 1u32,
3508 __cache.consume_next(),
3509 buf,
3510 );
3511 self.payload.write_to(__cache, buf);
3512 }
3513 if self.subaccount_id != 0u64 {
3514 ::buffa::types::put_uint64_field(2u32, self.subaccount_id, buf);
3515 }
3516 if !self.signer_wallet.is_empty() {
3517 ::buffa::types::put_string_field(3u32, &self.signer_wallet, buf);
3518 }
3519 if !self.payload_signature.is_empty() {
3520 ::buffa::types::put_bytes_field(4u32, &self.payload_signature, buf);
3521 }
3522 self.__buffa_unknown_fields.write_to(buf);
3523 }
3524 }
3525 impl<'__a> ::serde::Serialize for CreateWalletTradingWithdrawRequestView<'__a> {
3537 fn serialize<__S: ::serde::Serializer>(
3538 &self,
3539 __s: __S,
3540 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3541 use ::serde::ser::SerializeMap as _;
3542 let mut __map = __s.serialize_map(::core::option::Option::None)?;
3543 {
3544 if let ::core::option::Option::Some(__v) = self.payload.as_option() {
3545 __map.serialize_entry("payload", __v)?;
3546 }
3547 }
3548 if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
3549 __map
3550 .serialize_entry(
3551 "subaccountId",
3552 &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
3553 )?;
3554 }
3555 if !::buffa::json_helpers::skip_if::is_empty_str(self.signer_wallet) {
3556 __map.serialize_entry("signerWallet", self.signer_wallet)?;
3557 }
3558 if !::buffa::json_helpers::skip_if::is_empty_bytes(
3559 self.payload_signature,
3560 ) {
3561 __map
3562 .serialize_entry(
3563 "payloadSignature",
3564 &::buffa::json_helpers::BytesJson(self.payload_signature),
3565 )?;
3566 }
3567 __map.end()
3568 }
3569 }
3570 impl<'a> ::buffa::MessageName for CreateWalletTradingWithdrawRequestView<'a> {
3571 const PACKAGE: &'static str = "chain.withdraw.v1";
3572 const NAME: &'static str = "CreateWalletTradingWithdrawRequest";
3573 const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
3574 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
3575 }
3576 ::buffa::impl_default_view_instance!(CreateWalletTradingWithdrawRequestView);
3577 ::buffa::impl_view_reborrow!(CreateWalletTradingWithdrawRequestView);
3578 #[derive(Clone, Debug)]
3584 pub struct CreateWalletTradingWithdrawRequestOwnedView(
3585 ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
3586 );
3587 impl CreateWalletTradingWithdrawRequestOwnedView {
3588 pub fn decode(
3598 bytes: ::buffa::bytes::Bytes,
3599 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3600 ::core::result::Result::Ok(
3601 CreateWalletTradingWithdrawRequestOwnedView(
3602 ::buffa::OwnedView::decode(bytes)?,
3603 ),
3604 )
3605 }
3606 pub fn decode_with_options(
3614 bytes: ::buffa::bytes::Bytes,
3615 opts: &::buffa::DecodeOptions,
3616 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3617 ::core::result::Result::Ok(
3618 CreateWalletTradingWithdrawRequestOwnedView(
3619 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
3620 ),
3621 )
3622 }
3623 pub fn from_owned(
3630 msg: &super::super::CreateWalletTradingWithdrawRequest,
3631 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3632 ::core::result::Result::Ok(
3633 CreateWalletTradingWithdrawRequestOwnedView(
3634 ::buffa::OwnedView::from_owned(msg)?,
3635 ),
3636 )
3637 }
3638 #[must_use]
3640 pub fn view(&self) -> &CreateWalletTradingWithdrawRequestView<'_> {
3641 self.0.reborrow()
3642 }
3643 pub fn to_owned_message(
3650 &self,
3651 ) -> ::core::result::Result<
3652 super::super::CreateWalletTradingWithdrawRequest,
3653 ::buffa::DecodeError,
3654 > {
3655 self.0.to_owned_message()
3656 }
3657 #[must_use]
3659 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
3660 self.0.bytes()
3661 }
3662 #[must_use]
3664 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
3665 self.0.into_bytes()
3666 }
3667 #[must_use]
3671 pub fn payload(
3672 &self,
3673 ) -> &::buffa::MessageFieldView<
3674 super::super::__buffa::view::TradingWithdrawIntentPayloadView<'_>,
3675 > {
3676 &self.0.reborrow().payload
3677 }
3678 #[must_use]
3682 pub fn subaccount_id(&self) -> u64 {
3683 self.0.reborrow().subaccount_id
3684 }
3685 #[must_use]
3689 pub fn signer_wallet(&self) -> &'_ str {
3690 self.0.reborrow().signer_wallet
3691 }
3692 #[must_use]
3696 pub fn payload_signature(&self) -> &'_ [u8] {
3697 self.0.reborrow().payload_signature
3698 }
3699 }
3700 impl ::core::convert::From<
3701 ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
3702 > for CreateWalletTradingWithdrawRequestOwnedView {
3703 fn from(
3704 inner: ::buffa::OwnedView<
3705 CreateWalletTradingWithdrawRequestView<'static>,
3706 >,
3707 ) -> Self {
3708 CreateWalletTradingWithdrawRequestOwnedView(inner)
3709 }
3710 }
3711 impl ::core::convert::From<CreateWalletTradingWithdrawRequestOwnedView>
3712 for ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>> {
3713 fn from(wrapper: CreateWalletTradingWithdrawRequestOwnedView) -> Self {
3714 wrapper.0
3715 }
3716 }
3717 impl ::core::convert::AsRef<
3718 ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
3719 > for CreateWalletTradingWithdrawRequestOwnedView {
3720 fn as_ref(
3721 &self,
3722 ) -> &::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>> {
3723 &self.0
3724 }
3725 }
3726 impl ::buffa::HasMessageView
3727 for super::super::CreateWalletTradingWithdrawRequest {
3728 type View<'a> = CreateWalletTradingWithdrawRequestView<'a>;
3729 type ViewHandle = CreateWalletTradingWithdrawRequestOwnedView;
3730 }
3731 impl ::serde::Serialize for CreateWalletTradingWithdrawRequestOwnedView {
3732 fn serialize<__S: ::serde::Serializer>(
3733 &self,
3734 __s: __S,
3735 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3736 ::serde::Serialize::serialize(&self.0, __s)
3737 }
3738 }
3739 #[derive(Clone, Debug, Default)]
3742 pub struct ValidateWithdrawDestinationRequestView<'a> {
3743 pub destination_chain_id: u64,
3747 pub destination_address: &'a str,
3751 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3752 }
3753 impl<'a> ::buffa::MessageView<'a>
3754 for ValidateWithdrawDestinationRequestView<'a> {
3755 type Owned = super::super::ValidateWithdrawDestinationRequest;
3756 fn decode_view(
3757 buf: &'a [u8],
3758 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3759 let __limit = ::core::cell::Cell::new(
3760 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
3761 );
3762 <Self as ::buffa::MessageView>::decode_view_ctx(
3763 buf,
3764 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
3765 )
3766 }
3767 fn decode_view_with_ctx(
3768 buf: &'a [u8],
3769 ctx: ::buffa::DecodeContext<'_>,
3770 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3771 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
3772 }
3773 fn merge_view_field(
3774 &mut self,
3775 tag: ::buffa::encoding::Tag,
3776 cur: &'a [u8],
3777 before_tag: &'a [u8],
3778 ctx: ::buffa::DecodeContext<'_>,
3779 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
3780 let _ = ctx;
3781 #[allow(unused_variables)]
3782 let view = self;
3783 let mut cur = cur;
3784 match tag.field_number() {
3785 1u32 => {
3786 ::buffa::encoding::check_wire_type(
3787 tag,
3788 ::buffa::encoding::WireType::Varint,
3789 )?;
3790 view.destination_chain_id = ::buffa::types::decode_uint64(
3791 &mut cur,
3792 )?;
3793 }
3794 2u32 => {
3795 ::buffa::encoding::check_wire_type(
3796 tag,
3797 ::buffa::encoding::WireType::LengthDelimited,
3798 )?;
3799 view.destination_address = ::buffa::types::borrow_str(&mut cur)?;
3800 }
3801 _ => {
3802 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
3803 let span_len = before_tag.len() - cur.len();
3804 view.__buffa_unknown_fields
3805 .push_record(before_tag, span_len, ctx)?;
3806 }
3807 }
3808 ::core::result::Result::Ok(cur)
3809 }
3810 fn to_owned_message(
3811 &self,
3812 ) -> ::core::result::Result<
3813 super::super::ValidateWithdrawDestinationRequest,
3814 ::buffa::DecodeError,
3815 > {
3816 self.to_owned_from_source(None)
3817 }
3818 #[allow(clippy::useless_conversion, clippy::needless_update)]
3819 fn to_owned_from_source(
3820 &self,
3821 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
3822 ) -> ::core::result::Result<
3823 super::super::ValidateWithdrawDestinationRequest,
3824 ::buffa::DecodeError,
3825 > {
3826 #[allow(unused_imports)]
3827 use ::buffa::alloc::string::ToString as _;
3828 let _ = __buffa_src;
3829 ::core::result::Result::Ok(super::super::ValidateWithdrawDestinationRequest {
3830 destination_chain_id: self.destination_chain_id,
3831 destination_address: self.destination_address.to_string(),
3832 __buffa_unknown_fields: self
3833 .__buffa_unknown_fields
3834 .to_owned()?
3835 .into(),
3836 ..::core::default::Default::default()
3837 })
3838 }
3839 }
3840 impl<'a> ::buffa::ViewEncode<'a> for ValidateWithdrawDestinationRequestView<'a> {
3841 #[allow(clippy::needless_borrow, clippy::let_and_return)]
3842 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3843 #[allow(unused_imports)]
3844 use ::buffa::Enumeration as _;
3845 let mut size = 0u32;
3846 if self.destination_chain_id != 0u64 {
3847 size
3848 += 1u32
3849 + ::buffa::types::uint64_encoded_len(
3850 self.destination_chain_id,
3851 ) as u32;
3852 }
3853 if !self.destination_address.is_empty() {
3854 size
3855 += 1u32
3856 + ::buffa::types::string_encoded_len(
3857 &self.destination_address,
3858 ) as u32;
3859 }
3860 size += self.__buffa_unknown_fields.encoded_len() as u32;
3861 size
3862 }
3863 #[allow(clippy::needless_borrow)]
3864 fn write_to(
3865 &self,
3866 _cache: &mut ::buffa::SizeCache,
3867 buf: &mut impl ::buffa::bytes::BufMut,
3868 ) {
3869 #[allow(unused_imports)]
3870 use ::buffa::Enumeration as _;
3871 if self.destination_chain_id != 0u64 {
3872 ::buffa::types::put_uint64_field(
3873 1u32,
3874 self.destination_chain_id,
3875 buf,
3876 );
3877 }
3878 if !self.destination_address.is_empty() {
3879 ::buffa::types::put_string_field(
3880 2u32,
3881 &self.destination_address,
3882 buf,
3883 );
3884 }
3885 self.__buffa_unknown_fields.write_to(buf);
3886 }
3887 }
3888 impl<'__a> ::serde::Serialize for ValidateWithdrawDestinationRequestView<'__a> {
3900 fn serialize<__S: ::serde::Serializer>(
3901 &self,
3902 __s: __S,
3903 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3904 use ::serde::ser::SerializeMap as _;
3905 let mut __map = __s.serialize_map(::core::option::Option::None)?;
3906 if !::buffa::json_helpers::skip_if::is_zero_u64(
3907 &self.destination_chain_id,
3908 ) {
3909 __map
3910 .serialize_entry(
3911 "destinationChainId",
3912 &::buffa::json_helpers::ProtoJson(&self.destination_chain_id),
3913 )?;
3914 }
3915 if !::buffa::json_helpers::skip_if::is_empty_str(
3916 self.destination_address,
3917 ) {
3918 __map
3919 .serialize_entry(
3920 "destinationAddress",
3921 self.destination_address,
3922 )?;
3923 }
3924 __map.end()
3925 }
3926 }
3927 impl<'a> ::buffa::MessageName for ValidateWithdrawDestinationRequestView<'a> {
3928 const PACKAGE: &'static str = "chain.withdraw.v1";
3929 const NAME: &'static str = "ValidateWithdrawDestinationRequest";
3930 const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationRequest";
3931 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest";
3932 }
3933 ::buffa::impl_default_view_instance!(ValidateWithdrawDestinationRequestView);
3934 ::buffa::impl_view_reborrow!(ValidateWithdrawDestinationRequestView);
3935 #[derive(Clone, Debug)]
3941 pub struct ValidateWithdrawDestinationRequestOwnedView(
3942 ::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>>,
3943 );
3944 impl ValidateWithdrawDestinationRequestOwnedView {
3945 pub fn decode(
3955 bytes: ::buffa::bytes::Bytes,
3956 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3957 ::core::result::Result::Ok(
3958 ValidateWithdrawDestinationRequestOwnedView(
3959 ::buffa::OwnedView::decode(bytes)?,
3960 ),
3961 )
3962 }
3963 pub fn decode_with_options(
3971 bytes: ::buffa::bytes::Bytes,
3972 opts: &::buffa::DecodeOptions,
3973 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3974 ::core::result::Result::Ok(
3975 ValidateWithdrawDestinationRequestOwnedView(
3976 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
3977 ),
3978 )
3979 }
3980 pub fn from_owned(
3987 msg: &super::super::ValidateWithdrawDestinationRequest,
3988 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3989 ::core::result::Result::Ok(
3990 ValidateWithdrawDestinationRequestOwnedView(
3991 ::buffa::OwnedView::from_owned(msg)?,
3992 ),
3993 )
3994 }
3995 #[must_use]
3997 pub fn view(&self) -> &ValidateWithdrawDestinationRequestView<'_> {
3998 self.0.reborrow()
3999 }
4000 pub fn to_owned_message(
4007 &self,
4008 ) -> ::core::result::Result<
4009 super::super::ValidateWithdrawDestinationRequest,
4010 ::buffa::DecodeError,
4011 > {
4012 self.0.to_owned_message()
4013 }
4014 #[must_use]
4016 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
4017 self.0.bytes()
4018 }
4019 #[must_use]
4021 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
4022 self.0.into_bytes()
4023 }
4024 #[must_use]
4028 pub fn destination_chain_id(&self) -> u64 {
4029 self.0.reborrow().destination_chain_id
4030 }
4031 #[must_use]
4035 pub fn destination_address(&self) -> &'_ str {
4036 self.0.reborrow().destination_address
4037 }
4038 }
4039 impl ::core::convert::From<
4040 ::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>>,
4041 > for ValidateWithdrawDestinationRequestOwnedView {
4042 fn from(
4043 inner: ::buffa::OwnedView<
4044 ValidateWithdrawDestinationRequestView<'static>,
4045 >,
4046 ) -> Self {
4047 ValidateWithdrawDestinationRequestOwnedView(inner)
4048 }
4049 }
4050 impl ::core::convert::From<ValidateWithdrawDestinationRequestOwnedView>
4051 for ::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>> {
4052 fn from(wrapper: ValidateWithdrawDestinationRequestOwnedView) -> Self {
4053 wrapper.0
4054 }
4055 }
4056 impl ::core::convert::AsRef<
4057 ::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>>,
4058 > for ValidateWithdrawDestinationRequestOwnedView {
4059 fn as_ref(
4060 &self,
4061 ) -> &::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>> {
4062 &self.0
4063 }
4064 }
4065 impl ::buffa::HasMessageView
4066 for super::super::ValidateWithdrawDestinationRequest {
4067 type View<'a> = ValidateWithdrawDestinationRequestView<'a>;
4068 type ViewHandle = ValidateWithdrawDestinationRequestOwnedView;
4069 }
4070 impl ::serde::Serialize for ValidateWithdrawDestinationRequestOwnedView {
4071 fn serialize<__S: ::serde::Serializer>(
4072 &self,
4073 __s: __S,
4074 ) -> ::core::result::Result<__S::Ok, __S::Error> {
4075 ::serde::Serialize::serialize(&self.0, __s)
4076 }
4077 }
4078 #[derive(Clone, Debug, Default)]
4081 pub struct ValidateWithdrawDestinationResponseView<'a> {
4082 pub valid: bool,
4086 pub code: ::buffa::EnumValue<
4090 super::super::WithdrawDestinationValidationCode,
4091 >,
4092 pub message: &'a str,
4096 pub canonical_destination_address: &'a str,
4100 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
4101 }
4102 impl<'a> ::buffa::MessageView<'a>
4103 for ValidateWithdrawDestinationResponseView<'a> {
4104 type Owned = super::super::ValidateWithdrawDestinationResponse;
4105 fn decode_view(
4106 buf: &'a [u8],
4107 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4108 let __limit = ::core::cell::Cell::new(
4109 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
4110 );
4111 <Self as ::buffa::MessageView>::decode_view_ctx(
4112 buf,
4113 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
4114 )
4115 }
4116 fn decode_view_with_ctx(
4117 buf: &'a [u8],
4118 ctx: ::buffa::DecodeContext<'_>,
4119 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4120 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
4121 }
4122 fn merge_view_field(
4123 &mut self,
4124 tag: ::buffa::encoding::Tag,
4125 cur: &'a [u8],
4126 before_tag: &'a [u8],
4127 ctx: ::buffa::DecodeContext<'_>,
4128 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
4129 let _ = ctx;
4130 #[allow(unused_variables)]
4131 let view = self;
4132 let mut cur = cur;
4133 match tag.field_number() {
4134 1u32 => {
4135 ::buffa::encoding::check_wire_type(
4136 tag,
4137 ::buffa::encoding::WireType::Varint,
4138 )?;
4139 view.valid = ::buffa::types::decode_bool(&mut cur)?;
4140 }
4141 2u32 => {
4142 ::buffa::encoding::check_wire_type(
4143 tag,
4144 ::buffa::encoding::WireType::Varint,
4145 )?;
4146 view.code = ::buffa::EnumValue::from(
4147 ::buffa::types::decode_int32(&mut cur)?,
4148 );
4149 }
4150 3u32 => {
4151 ::buffa::encoding::check_wire_type(
4152 tag,
4153 ::buffa::encoding::WireType::LengthDelimited,
4154 )?;
4155 view.message = ::buffa::types::borrow_str(&mut cur)?;
4156 }
4157 4u32 => {
4158 ::buffa::encoding::check_wire_type(
4159 tag,
4160 ::buffa::encoding::WireType::LengthDelimited,
4161 )?;
4162 view.canonical_destination_address = ::buffa::types::borrow_str(
4163 &mut cur,
4164 )?;
4165 }
4166 _ => {
4167 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
4168 let span_len = before_tag.len() - cur.len();
4169 view.__buffa_unknown_fields
4170 .push_record(before_tag, span_len, ctx)?;
4171 }
4172 }
4173 ::core::result::Result::Ok(cur)
4174 }
4175 fn to_owned_message(
4176 &self,
4177 ) -> ::core::result::Result<
4178 super::super::ValidateWithdrawDestinationResponse,
4179 ::buffa::DecodeError,
4180 > {
4181 self.to_owned_from_source(None)
4182 }
4183 #[allow(clippy::useless_conversion, clippy::needless_update)]
4184 fn to_owned_from_source(
4185 &self,
4186 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
4187 ) -> ::core::result::Result<
4188 super::super::ValidateWithdrawDestinationResponse,
4189 ::buffa::DecodeError,
4190 > {
4191 #[allow(unused_imports)]
4192 use ::buffa::alloc::string::ToString as _;
4193 let _ = __buffa_src;
4194 ::core::result::Result::Ok(super::super::ValidateWithdrawDestinationResponse {
4195 valid: self.valid,
4196 code: self.code,
4197 message: self.message.to_string(),
4198 canonical_destination_address: self
4199 .canonical_destination_address
4200 .to_string(),
4201 __buffa_unknown_fields: self
4202 .__buffa_unknown_fields
4203 .to_owned()?
4204 .into(),
4205 ..::core::default::Default::default()
4206 })
4207 }
4208 }
4209 impl<'a> ::buffa::ViewEncode<'a>
4210 for ValidateWithdrawDestinationResponseView<'a> {
4211 #[allow(clippy::needless_borrow, clippy::let_and_return)]
4212 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
4213 #[allow(unused_imports)]
4214 use ::buffa::Enumeration as _;
4215 let mut size = 0u32;
4216 if self.valid {
4217 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4218 }
4219 {
4220 let val = self.code.to_i32();
4221 if val != 0 {
4222 size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4223 }
4224 }
4225 if !self.message.is_empty() {
4226 size
4227 += 1u32
4228 + ::buffa::types::string_encoded_len(&self.message) as u32;
4229 }
4230 if !self.canonical_destination_address.is_empty() {
4231 size
4232 += 1u32
4233 + ::buffa::types::string_encoded_len(
4234 &self.canonical_destination_address,
4235 ) as u32;
4236 }
4237 size += self.__buffa_unknown_fields.encoded_len() as u32;
4238 size
4239 }
4240 #[allow(clippy::needless_borrow)]
4241 fn write_to(
4242 &self,
4243 _cache: &mut ::buffa::SizeCache,
4244 buf: &mut impl ::buffa::bytes::BufMut,
4245 ) {
4246 #[allow(unused_imports)]
4247 use ::buffa::Enumeration as _;
4248 if self.valid {
4249 ::buffa::types::put_bool_field(1u32, self.valid, buf);
4250 }
4251 {
4252 let val = self.code.to_i32();
4253 if val != 0 {
4254 ::buffa::types::put_int32_field(2u32, val, buf);
4255 }
4256 }
4257 if !self.message.is_empty() {
4258 ::buffa::types::put_string_field(3u32, &self.message, buf);
4259 }
4260 if !self.canonical_destination_address.is_empty() {
4261 ::buffa::types::put_string_field(
4262 4u32,
4263 &self.canonical_destination_address,
4264 buf,
4265 );
4266 }
4267 self.__buffa_unknown_fields.write_to(buf);
4268 }
4269 }
4270 impl<'__a> ::serde::Serialize for ValidateWithdrawDestinationResponseView<'__a> {
4282 fn serialize<__S: ::serde::Serializer>(
4283 &self,
4284 __s: __S,
4285 ) -> ::core::result::Result<__S::Ok, __S::Error> {
4286 use ::serde::ser::SerializeMap as _;
4287 let mut __map = __s.serialize_map(::core::option::Option::None)?;
4288 if self.valid {
4289 __map.serialize_entry("valid", &self.valid)?;
4290 }
4291 if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.code) {
4292 __map.serialize_entry("code", &self.code)?;
4293 }
4294 if !::buffa::json_helpers::skip_if::is_empty_str(self.message) {
4295 __map.serialize_entry("message", self.message)?;
4296 }
4297 if !::buffa::json_helpers::skip_if::is_empty_str(
4298 self.canonical_destination_address,
4299 ) {
4300 __map
4301 .serialize_entry(
4302 "canonicalDestinationAddress",
4303 self.canonical_destination_address,
4304 )?;
4305 }
4306 __map.end()
4307 }
4308 }
4309 impl<'a> ::buffa::MessageName for ValidateWithdrawDestinationResponseView<'a> {
4310 const PACKAGE: &'static str = "chain.withdraw.v1";
4311 const NAME: &'static str = "ValidateWithdrawDestinationResponse";
4312 const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationResponse";
4313 const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse";
4314 }
4315 ::buffa::impl_default_view_instance!(ValidateWithdrawDestinationResponseView);
4316 ::buffa::impl_view_reborrow!(ValidateWithdrawDestinationResponseView);
4317 #[derive(Clone, Debug)]
4323 pub struct ValidateWithdrawDestinationResponseOwnedView(
4324 ::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>>,
4325 );
4326 impl ValidateWithdrawDestinationResponseOwnedView {
4327 pub fn decode(
4337 bytes: ::buffa::bytes::Bytes,
4338 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4339 ::core::result::Result::Ok(
4340 ValidateWithdrawDestinationResponseOwnedView(
4341 ::buffa::OwnedView::decode(bytes)?,
4342 ),
4343 )
4344 }
4345 pub fn decode_with_options(
4353 bytes: ::buffa::bytes::Bytes,
4354 opts: &::buffa::DecodeOptions,
4355 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4356 ::core::result::Result::Ok(
4357 ValidateWithdrawDestinationResponseOwnedView(
4358 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
4359 ),
4360 )
4361 }
4362 pub fn from_owned(
4369 msg: &super::super::ValidateWithdrawDestinationResponse,
4370 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4371 ::core::result::Result::Ok(
4372 ValidateWithdrawDestinationResponseOwnedView(
4373 ::buffa::OwnedView::from_owned(msg)?,
4374 ),
4375 )
4376 }
4377 #[must_use]
4379 pub fn view(&self) -> &ValidateWithdrawDestinationResponseView<'_> {
4380 self.0.reborrow()
4381 }
4382 pub fn to_owned_message(
4389 &self,
4390 ) -> ::core::result::Result<
4391 super::super::ValidateWithdrawDestinationResponse,
4392 ::buffa::DecodeError,
4393 > {
4394 self.0.to_owned_message()
4395 }
4396 #[must_use]
4398 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
4399 self.0.bytes()
4400 }
4401 #[must_use]
4403 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
4404 self.0.into_bytes()
4405 }
4406 #[must_use]
4410 pub fn valid(&self) -> bool {
4411 self.0.reborrow().valid
4412 }
4413 #[must_use]
4417 pub fn code(
4418 &self,
4419 ) -> ::buffa::EnumValue<super::super::WithdrawDestinationValidationCode> {
4420 self.0.reborrow().code
4421 }
4422 #[must_use]
4426 pub fn message(&self) -> &'_ str {
4427 self.0.reborrow().message
4428 }
4429 #[must_use]
4433 pub fn canonical_destination_address(&self) -> &'_ str {
4434 self.0.reborrow().canonical_destination_address
4435 }
4436 }
4437 impl ::core::convert::From<
4438 ::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>>,
4439 > for ValidateWithdrawDestinationResponseOwnedView {
4440 fn from(
4441 inner: ::buffa::OwnedView<
4442 ValidateWithdrawDestinationResponseView<'static>,
4443 >,
4444 ) -> Self {
4445 ValidateWithdrawDestinationResponseOwnedView(inner)
4446 }
4447 }
4448 impl ::core::convert::From<ValidateWithdrawDestinationResponseOwnedView>
4449 for ::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>> {
4450 fn from(wrapper: ValidateWithdrawDestinationResponseOwnedView) -> Self {
4451 wrapper.0
4452 }
4453 }
4454 impl ::core::convert::AsRef<
4455 ::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>>,
4456 > for ValidateWithdrawDestinationResponseOwnedView {
4457 fn as_ref(
4458 &self,
4459 ) -> &::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>> {
4460 &self.0
4461 }
4462 }
4463 impl ::buffa::HasMessageView
4464 for super::super::ValidateWithdrawDestinationResponse {
4465 type View<'a> = ValidateWithdrawDestinationResponseView<'a>;
4466 type ViewHandle = ValidateWithdrawDestinationResponseOwnedView;
4467 }
4468 impl ::serde::Serialize for ValidateWithdrawDestinationResponseOwnedView {
4469 fn serialize<__S: ::serde::Serializer>(
4470 &self,
4471 __s: __S,
4472 ) -> ::core::result::Result<__S::Ok, __S::Error> {
4473 ::serde::Serialize::serialize(&self.0, __s)
4474 }
4475 }
4476 }
4477 pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
4479 reg.register_json_any(super::__CREATE_TRADING_WITHDRAW_RESPONSE_JSON_ANY);
4480 reg.register_json_any(super::__CREATE_WALLET_TRADING_WITHDRAW_RESPONSE_JSON_ANY);
4481 reg.register_json_any(super::__TRADING_WITHDRAW_INTENT_PAYLOAD_JSON_ANY);
4482 reg.register_json_any(super::__CREATE_TRADING_WITHDRAW_REQUEST_JSON_ANY);
4483 reg.register_json_any(super::__CREATE_WALLET_TRADING_WITHDRAW_REQUEST_JSON_ANY);
4484 reg.register_json_any(super::__VALIDATE_WITHDRAW_DESTINATION_REQUEST_JSON_ANY);
4485 reg.register_json_any(super::__VALIDATE_WITHDRAW_DESTINATION_RESPONSE_JSON_ANY);
4486 }
4487}
4488#[doc(inline)]
4489pub use self::__buffa::view::CreateTradingWithdrawResponseView;
4490#[doc(inline)]
4491pub use self::__buffa::view::CreateTradingWithdrawResponseOwnedView;
4492#[doc(inline)]
4493pub use self::__buffa::view::CreateWalletTradingWithdrawResponseView;
4494#[doc(inline)]
4495pub use self::__buffa::view::CreateWalletTradingWithdrawResponseOwnedView;
4496#[doc(inline)]
4497pub use self::__buffa::view::TradingWithdrawIntentPayloadView;
4498#[doc(inline)]
4499pub use self::__buffa::view::TradingWithdrawIntentPayloadOwnedView;
4500#[doc(inline)]
4501pub use self::__buffa::view::CreateTradingWithdrawRequestView;
4502#[doc(inline)]
4503pub use self::__buffa::view::CreateTradingWithdrawRequestOwnedView;
4504#[doc(inline)]
4505pub use self::__buffa::view::CreateWalletTradingWithdrawRequestView;
4506#[doc(inline)]
4507pub use self::__buffa::view::CreateWalletTradingWithdrawRequestOwnedView;
4508#[doc(inline)]
4509pub use self::__buffa::view::ValidateWithdrawDestinationRequestView;
4510#[doc(inline)]
4511pub use self::__buffa::view::ValidateWithdrawDestinationRequestOwnedView;
4512#[doc(inline)]
4513pub use self::__buffa::view::ValidateWithdrawDestinationResponseView;
4514#[doc(inline)]
4515pub use self::__buffa::view::ValidateWithdrawDestinationResponseOwnedView;
4516#[doc(inline)]
4517pub use self::__buffa::register_types;