#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum TradingWithdrawAction {
ACTION_UNSPECIFIED = 0i32,
TO_FUNDING = 1i32,
TO_EXTERNAL_CHAIN = 2i32,
}
impl TradingWithdrawAction {
#[allow(non_upper_case_globals)]
pub const ActionUnspecified: Self = Self::ACTION_UNSPECIFIED;
#[allow(non_upper_case_globals)]
pub const ToFunding: Self = Self::TO_FUNDING;
#[allow(non_upper_case_globals)]
pub const ToExternalChain: Self = Self::TO_EXTERNAL_CHAIN;
}
impl ::core::default::Default for TradingWithdrawAction {
fn default() -> Self {
Self::ACTION_UNSPECIFIED
}
}
impl ::serde::Serialize for TradingWithdrawAction {
fn serialize<S: ::serde::Serializer>(
&self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
s.serialize_str(::buffa::Enumeration::proto_name(self))
}
}
impl<'de> ::serde::Deserialize<'de> for TradingWithdrawAction {
fn deserialize<D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
struct _V;
impl ::serde::de::Visitor<'_> for _V {
type Value = TradingWithdrawAction;
fn expecting(
&self,
f: &mut ::core::fmt::Formatter<'_>,
) -> ::core::fmt::Result {
f.write_str(
concat!(
"a string, integer, or null for ",
stringify!(TradingWithdrawAction)
),
)
}
fn visit_str<E: ::serde::de::Error>(
self,
v: &str,
) -> ::core::result::Result<TradingWithdrawAction, E> {
<TradingWithdrawAction as ::buffa::Enumeration>::from_proto_name(v)
.ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
}
fn visit_i64<E: ::serde::de::Error>(
self,
v: i64,
) -> ::core::result::Result<TradingWithdrawAction, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<TradingWithdrawAction as ::buffa::Enumeration>::from_i32(v32)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_u64<E: ::serde::de::Error>(
self,
v: u64,
) -> ::core::result::Result<TradingWithdrawAction, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<TradingWithdrawAction as ::buffa::Enumeration>::from_i32(v32)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_unit<E: ::serde::de::Error>(
self,
) -> ::core::result::Result<TradingWithdrawAction, E> {
::core::result::Result::Ok(::core::default::Default::default())
}
}
d.deserialize_any(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for TradingWithdrawAction {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
impl ::buffa::Enumeration for TradingWithdrawAction {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::ACTION_UNSPECIFIED),
1i32 => ::core::option::Option::Some(Self::TO_FUNDING),
2i32 => ::core::option::Option::Some(Self::TO_EXTERNAL_CHAIN),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::ACTION_UNSPECIFIED => "ACTION_UNSPECIFIED",
Self::TO_FUNDING => "TO_FUNDING",
Self::TO_EXTERNAL_CHAIN => "TO_EXTERNAL_CHAIN",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"ACTION_UNSPECIFIED" => {
::core::option::Option::Some(Self::ACTION_UNSPECIFIED)
}
"TO_FUNDING" => ::core::option::Option::Some(Self::TO_FUNDING),
"TO_EXTERNAL_CHAIN" => ::core::option::Option::Some(Self::TO_EXTERNAL_CHAIN),
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[Self::ACTION_UNSPECIFIED, Self::TO_FUNDING, Self::TO_EXTERNAL_CHAIN]
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum WithdrawDestinationValidationCode {
RESULT_UNSPECIFIED = 0i32,
VALID = 1i32,
INVALID_ADDRESS = 2i32,
UNSUPPORTED_CHAIN = 3i32,
POLYESTER_SMART_ACCOUNT = 4i32,
TOKEN_CONTRACT = 5i32,
DENYLISTED_ADDRESS = 6i32,
}
impl WithdrawDestinationValidationCode {
#[allow(non_upper_case_globals)]
pub const ResultUnspecified: Self = Self::RESULT_UNSPECIFIED;
#[allow(non_upper_case_globals)]
pub const Valid: Self = Self::VALID;
#[allow(non_upper_case_globals)]
pub const InvalidAddress: Self = Self::INVALID_ADDRESS;
#[allow(non_upper_case_globals)]
pub const UnsupportedChain: Self = Self::UNSUPPORTED_CHAIN;
#[allow(non_upper_case_globals)]
pub const PolyesterSmartAccount: Self = Self::POLYESTER_SMART_ACCOUNT;
#[allow(non_upper_case_globals)]
pub const TokenContract: Self = Self::TOKEN_CONTRACT;
#[allow(non_upper_case_globals)]
pub const DenylistedAddress: Self = Self::DENYLISTED_ADDRESS;
}
impl ::core::default::Default for WithdrawDestinationValidationCode {
fn default() -> Self {
Self::RESULT_UNSPECIFIED
}
}
impl ::serde::Serialize for WithdrawDestinationValidationCode {
fn serialize<S: ::serde::Serializer>(
&self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
s.serialize_str(::buffa::Enumeration::proto_name(self))
}
}
impl<'de> ::serde::Deserialize<'de> for WithdrawDestinationValidationCode {
fn deserialize<D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
struct _V;
impl ::serde::de::Visitor<'_> for _V {
type Value = WithdrawDestinationValidationCode;
fn expecting(
&self,
f: &mut ::core::fmt::Formatter<'_>,
) -> ::core::fmt::Result {
f.write_str(
concat!(
"a string, integer, or null for ",
stringify!(WithdrawDestinationValidationCode)
),
)
}
fn visit_str<E: ::serde::de::Error>(
self,
v: &str,
) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
<WithdrawDestinationValidationCode as ::buffa::Enumeration>::from_proto_name(
v,
)
.ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
}
fn visit_i64<E: ::serde::de::Error>(
self,
v: i64,
) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<WithdrawDestinationValidationCode as ::buffa::Enumeration>::from_i32(
v32,
)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_u64<E: ::serde::de::Error>(
self,
v: u64,
) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<WithdrawDestinationValidationCode as ::buffa::Enumeration>::from_i32(
v32,
)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_unit<E: ::serde::de::Error>(
self,
) -> ::core::result::Result<WithdrawDestinationValidationCode, E> {
::core::result::Result::Ok(::core::default::Default::default())
}
}
d.deserialize_any(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for WithdrawDestinationValidationCode {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
impl ::buffa::Enumeration for WithdrawDestinationValidationCode {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::RESULT_UNSPECIFIED),
1i32 => ::core::option::Option::Some(Self::VALID),
2i32 => ::core::option::Option::Some(Self::INVALID_ADDRESS),
3i32 => ::core::option::Option::Some(Self::UNSUPPORTED_CHAIN),
4i32 => ::core::option::Option::Some(Self::POLYESTER_SMART_ACCOUNT),
5i32 => ::core::option::Option::Some(Self::TOKEN_CONTRACT),
6i32 => ::core::option::Option::Some(Self::DENYLISTED_ADDRESS),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::RESULT_UNSPECIFIED => "RESULT_UNSPECIFIED",
Self::VALID => "VALID",
Self::INVALID_ADDRESS => "INVALID_ADDRESS",
Self::UNSUPPORTED_CHAIN => "UNSUPPORTED_CHAIN",
Self::POLYESTER_SMART_ACCOUNT => "POLYESTER_SMART_ACCOUNT",
Self::TOKEN_CONTRACT => "TOKEN_CONTRACT",
Self::DENYLISTED_ADDRESS => "DENYLISTED_ADDRESS",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"RESULT_UNSPECIFIED" => {
::core::option::Option::Some(Self::RESULT_UNSPECIFIED)
}
"VALID" => ::core::option::Option::Some(Self::VALID),
"INVALID_ADDRESS" => ::core::option::Option::Some(Self::INVALID_ADDRESS),
"UNSUPPORTED_CHAIN" => ::core::option::Option::Some(Self::UNSUPPORTED_CHAIN),
"POLYESTER_SMART_ACCOUNT" => {
::core::option::Option::Some(Self::POLYESTER_SMART_ACCOUNT)
}
"TOKEN_CONTRACT" => ::core::option::Option::Some(Self::TOKEN_CONTRACT),
"DENYLISTED_ADDRESS" => {
::core::option::Option::Some(Self::DENYLISTED_ADDRESS)
}
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[
Self::RESULT_UNSPECIFIED,
Self::VALID,
Self::INVALID_ADDRESS,
Self::UNSUPPORTED_CHAIN,
Self::POLYESTER_SMART_ACCOUNT,
Self::TOKEN_CONTRACT,
Self::DENYLISTED_ADDRESS,
]
}
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CreateTradingWithdrawResponse {
#[serde(
rename = "intentId",
alias = "intent_id",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub intent_id: ::buffa::alloc::string::String,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CreateTradingWithdrawResponse {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CreateTradingWithdrawResponse")
.field("intent_id", &self.intent_id)
.finish()
}
}
impl CreateTradingWithdrawResponse {
pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
}
::buffa::impl_default_instance!(CreateTradingWithdrawResponse);
impl ::buffa::MessageName for CreateTradingWithdrawResponse {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateTradingWithdrawResponse";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
}
impl ::buffa::Message for CreateTradingWithdrawResponse {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.intent_id.is_empty() {
size += 1u32 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.intent_id.is_empty() {
::buffa::types::put_string_field(1u32, &self.intent_id, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.intent_id, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.intent_id.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CreateTradingWithdrawResponse {
const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CreateTradingWithdrawResponse {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CREATE_TRADING_WITHDRAW_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse",
to_json: ::buffa::type_registry::any_to_json::<CreateTradingWithdrawResponse>,
from_json: ::buffa::type_registry::any_from_json::<CreateTradingWithdrawResponse>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CreateWalletTradingWithdrawResponse {
#[serde(
rename = "intentId",
alias = "intent_id",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub intent_id: ::buffa::alloc::string::String,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CreateWalletTradingWithdrawResponse {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CreateWalletTradingWithdrawResponse")
.field("intent_id", &self.intent_id)
.finish()
}
}
impl CreateWalletTradingWithdrawResponse {
pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
}
::buffa::impl_default_instance!(CreateWalletTradingWithdrawResponse);
impl ::buffa::MessageName for CreateWalletTradingWithdrawResponse {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateWalletTradingWithdrawResponse";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
}
impl ::buffa::Message for CreateWalletTradingWithdrawResponse {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.intent_id.is_empty() {
size += 1u32 + ::buffa::types::string_encoded_len(&self.intent_id) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.intent_id.is_empty() {
::buffa::types::put_string_field(1u32, &self.intent_id, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.intent_id, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.intent_id.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CreateWalletTradingWithdrawResponse {
const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CreateWalletTradingWithdrawResponse {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CREATE_WALLET_TRADING_WITHDRAW_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse",
to_json: ::buffa::type_registry::any_to_json::<CreateWalletTradingWithdrawResponse>,
from_json: ::buffa::type_registry::any_from_json::<
CreateWalletTradingWithdrawResponse,
>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct TradingWithdrawIntentPayload {
#[serde(
rename = "action",
with = "::buffa::json_helpers::proto_enum",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
)]
pub action: ::buffa::EnumValue<TradingWithdrawAction>,
#[serde(
rename = "assetId",
alias = "asset_id",
with = "::buffa::json_helpers::uint32",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
)]
pub asset_id: u32,
#[serde(
rename = "destinationChainId",
alias = "destination_chain_id",
with = "::buffa::json_helpers::uint64",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
)]
pub destination_chain_id: u64,
#[serde(
rename = "amountE18",
alias = "amount_e18",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub amount_e18: ::buffa::MessageField<
super::super::super::polyester::r#type::v1::U128,
>,
#[serde(
rename = "deadlineTsSec",
alias = "deadline_ts_sec",
with = "::buffa::json_helpers::uint64",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
)]
pub deadline_ts_sec: u64,
#[serde(
rename = "nonce",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub nonce: ::buffa::MessageField<super::super::super::polyester::r#type::v1::U128>,
#[serde(
rename = "destinationAddress",
alias = "destination_address",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub destination_address: ::buffa::alloc::string::String,
#[serde(
rename = "idempotencyKey",
alias = "idempotency_key",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub idempotency_key: ::buffa::alloc::string::String,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for TradingWithdrawIntentPayload {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("TradingWithdrawIntentPayload")
.field("action", &self.action)
.field("asset_id", &self.asset_id)
.field("destination_chain_id", &self.destination_chain_id)
.field("amount_e18", &self.amount_e18)
.field("deadline_ts_sec", &self.deadline_ts_sec)
.field("nonce", &self.nonce)
.field("destination_address", &self.destination_address)
.field("idempotency_key", &self.idempotency_key)
.finish()
}
}
impl TradingWithdrawIntentPayload {
pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
}
::buffa::impl_default_instance!(TradingWithdrawIntentPayload);
impl ::buffa::MessageName for TradingWithdrawIntentPayload {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "TradingWithdrawIntentPayload";
const FULL_NAME: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
}
impl ::buffa::Message for TradingWithdrawIntentPayload {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
{
let val = self.action.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
if self.asset_id != 0u32 {
size += 1u32 + ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
}
if self.destination_chain_id != 0u64 {
size
+= 1u32
+ ::buffa::types::uint64_encoded_len(self.destination_chain_id)
as u32;
}
if self.amount_e18.is_set() {
let __slot = __cache.reserve();
let inner_size = self.amount_e18.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if self.deadline_ts_sec != 0u64 {
size
+= 1u32
+ ::buffa::types::uint64_encoded_len(self.deadline_ts_sec) as u32;
}
if self.nonce.is_set() {
let __slot = __cache.reserve();
let inner_size = self.nonce.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if !self.destination_address.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.destination_address)
as u32;
}
if !self.idempotency_key.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.idempotency_key) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.action.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
if self.asset_id != 0u32 {
::buffa::types::put_uint32_field(2u32, self.asset_id, buf);
}
if self.destination_chain_id != 0u64 {
::buffa::types::put_uint64_field(3u32, self.destination_chain_id, buf);
}
if self.amount_e18.is_set() {
::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
self.amount_e18.write_to(__cache, buf);
}
if self.deadline_ts_sec != 0u64 {
::buffa::types::put_uint64_field(5u32, self.deadline_ts_sec, buf);
}
if self.nonce.is_set() {
::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf);
self.nonce.write_to(__cache, buf);
}
if !self.destination_address.is_empty() {
::buffa::types::put_string_field(7u32, &self.destination_address, buf);
}
if !self.idempotency_key.is_empty() {
::buffa::types::put_string_field(8u32, &self.idempotency_key, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.action = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.asset_id = ::buffa::types::decode_uint32(buf)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.destination_chain_id = ::buffa::types::decode_uint64(buf)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.amount_e18.get_or_insert_default(),
buf,
ctx,
)?;
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.deadline_ts_sec = ::buffa::types::decode_uint64(buf)?;
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.nonce.get_or_insert_default(),
buf,
ctx,
)?;
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.destination_address, buf)?;
}
8u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.idempotency_key, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.action = ::buffa::EnumValue::from(0);
self.asset_id = 0u32;
self.destination_chain_id = 0u64;
self.amount_e18 = ::buffa::MessageField::none();
self.deadline_ts_sec = 0u64;
self.nonce = ::buffa::MessageField::none();
self.destination_address.clear();
self.idempotency_key.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for TradingWithdrawIntentPayload {
const PROTO_FQN: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for TradingWithdrawIntentPayload {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __TRADING_WITHDRAW_INTENT_PAYLOAD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload",
to_json: ::buffa::type_registry::any_to_json::<TradingWithdrawIntentPayload>,
from_json: ::buffa::type_registry::any_from_json::<TradingWithdrawIntentPayload>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CreateTradingWithdrawRequest {
#[serde(
rename = "payload",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub payload: ::buffa::MessageField<TradingWithdrawIntentPayload>,
#[serde(
rename = "payloadSignature",
alias = "payload_signature",
with = "::buffa::json_helpers::bytes",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
)]
pub payload_signature: ::buffa::alloc::vec::Vec<u8>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CreateTradingWithdrawRequest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CreateTradingWithdrawRequest")
.field("payload", &self.payload)
.field("payload_signature", &self.payload_signature)
.finish()
}
}
impl CreateTradingWithdrawRequest {
pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
}
::buffa::impl_default_instance!(CreateTradingWithdrawRequest);
impl ::buffa::MessageName for CreateTradingWithdrawRequest {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateTradingWithdrawRequest";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
}
impl ::buffa::Message for CreateTradingWithdrawRequest {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.payload.is_set() {
let __slot = __cache.reserve();
let inner_size = self.payload.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if !self.payload_signature.is_empty() {
size
+= 1u32
+ ::buffa::types::bytes_encoded_len(&self.payload_signature) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.payload.is_set() {
::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
self.payload.write_to(__cache, buf);
}
if !self.payload_signature.is_empty() {
::buffa::types::put_bytes_field(2u32, &self.payload_signature, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.payload.get_or_insert_default(),
buf,
ctx,
)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_bytes(&mut self.payload_signature, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.payload = ::buffa::MessageField::none();
self.payload_signature.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CreateTradingWithdrawRequest {
const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CreateTradingWithdrawRequest {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CREATE_TRADING_WITHDRAW_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest",
to_json: ::buffa::type_registry::any_to_json::<CreateTradingWithdrawRequest>,
from_json: ::buffa::type_registry::any_from_json::<CreateTradingWithdrawRequest>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CreateWalletTradingWithdrawRequest {
#[serde(
rename = "payload",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub payload: ::buffa::MessageField<TradingWithdrawIntentPayload>,
#[serde(
rename = "subaccountId",
alias = "subaccount_id",
with = "::buffa::json_helpers::uint64",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
)]
pub subaccount_id: u64,
#[serde(
rename = "signerWallet",
alias = "signer_wallet",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub signer_wallet: ::buffa::alloc::string::String,
#[serde(
rename = "payloadSignature",
alias = "payload_signature",
with = "::buffa::json_helpers::bytes",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
)]
pub payload_signature: ::buffa::alloc::vec::Vec<u8>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CreateWalletTradingWithdrawRequest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CreateWalletTradingWithdrawRequest")
.field("payload", &self.payload)
.field("subaccount_id", &self.subaccount_id)
.field("signer_wallet", &self.signer_wallet)
.field("payload_signature", &self.payload_signature)
.finish()
}
}
impl CreateWalletTradingWithdrawRequest {
pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
}
::buffa::impl_default_instance!(CreateWalletTradingWithdrawRequest);
impl ::buffa::MessageName for CreateWalletTradingWithdrawRequest {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateWalletTradingWithdrawRequest";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
}
impl ::buffa::Message for CreateWalletTradingWithdrawRequest {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.payload.is_set() {
let __slot = __cache.reserve();
let inner_size = self.payload.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if self.subaccount_id != 0u64 {
size += 1u32 + ::buffa::types::uint64_encoded_len(self.subaccount_id) as u32;
}
if !self.signer_wallet.is_empty() {
size
+= 1u32 + ::buffa::types::string_encoded_len(&self.signer_wallet) as u32;
}
if !self.payload_signature.is_empty() {
size
+= 1u32
+ ::buffa::types::bytes_encoded_len(&self.payload_signature) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.payload.is_set() {
::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
self.payload.write_to(__cache, buf);
}
if self.subaccount_id != 0u64 {
::buffa::types::put_uint64_field(2u32, self.subaccount_id, buf);
}
if !self.signer_wallet.is_empty() {
::buffa::types::put_string_field(3u32, &self.signer_wallet, buf);
}
if !self.payload_signature.is_empty() {
::buffa::types::put_bytes_field(4u32, &self.payload_signature, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.payload.get_or_insert_default(),
buf,
ctx,
)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.subaccount_id = ::buffa::types::decode_uint64(buf)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.signer_wallet, buf)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_bytes(&mut self.payload_signature, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.payload = ::buffa::MessageField::none();
self.subaccount_id = 0u64;
self.signer_wallet.clear();
self.payload_signature.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CreateWalletTradingWithdrawRequest {
const PROTO_FQN: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CreateWalletTradingWithdrawRequest {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CREATE_WALLET_TRADING_WITHDRAW_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest",
to_json: ::buffa::type_registry::any_to_json::<CreateWalletTradingWithdrawRequest>,
from_json: ::buffa::type_registry::any_from_json::<
CreateWalletTradingWithdrawRequest,
>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct ValidateWithdrawDestinationRequest {
#[serde(
rename = "destinationChainId",
alias = "destination_chain_id",
with = "::buffa::json_helpers::uint64",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
)]
pub destination_chain_id: u64,
#[serde(
rename = "destinationAddress",
alias = "destination_address",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub destination_address: ::buffa::alloc::string::String,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for ValidateWithdrawDestinationRequest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("ValidateWithdrawDestinationRequest")
.field("destination_chain_id", &self.destination_chain_id)
.field("destination_address", &self.destination_address)
.finish()
}
}
impl ValidateWithdrawDestinationRequest {
pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest";
}
::buffa::impl_default_instance!(ValidateWithdrawDestinationRequest);
impl ::buffa::MessageName for ValidateWithdrawDestinationRequest {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "ValidateWithdrawDestinationRequest";
const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationRequest";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest";
}
impl ::buffa::Message for ValidateWithdrawDestinationRequest {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.destination_chain_id != 0u64 {
size
+= 1u32
+ ::buffa::types::uint64_encoded_len(self.destination_chain_id)
as u32;
}
if !self.destination_address.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.destination_address)
as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.destination_chain_id != 0u64 {
::buffa::types::put_uint64_field(1u32, self.destination_chain_id, buf);
}
if !self.destination_address.is_empty() {
::buffa::types::put_string_field(2u32, &self.destination_address, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.destination_chain_id = ::buffa::types::decode_uint64(buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.destination_address, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.destination_chain_id = 0u64;
self.destination_address.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for ValidateWithdrawDestinationRequest {
const PROTO_FQN: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationRequest";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for ValidateWithdrawDestinationRequest {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __VALIDATE_WITHDRAW_DESTINATION_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest",
to_json: ::buffa::type_registry::any_to_json::<ValidateWithdrawDestinationRequest>,
from_json: ::buffa::type_registry::any_from_json::<
ValidateWithdrawDestinationRequest,
>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct ValidateWithdrawDestinationResponse {
#[serde(
rename = "valid",
with = "::buffa::json_helpers::proto_bool",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
)]
pub valid: bool,
#[serde(
rename = "code",
with = "::buffa::json_helpers::proto_enum",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
)]
pub code: ::buffa::EnumValue<WithdrawDestinationValidationCode>,
#[serde(
rename = "message",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub message: ::buffa::alloc::string::String,
#[serde(
rename = "canonicalDestinationAddress",
alias = "canonical_destination_address",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub canonical_destination_address: ::buffa::alloc::string::String,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for ValidateWithdrawDestinationResponse {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("ValidateWithdrawDestinationResponse")
.field("valid", &self.valid)
.field("code", &self.code)
.field("message", &self.message)
.field("canonical_destination_address", &self.canonical_destination_address)
.finish()
}
}
impl ValidateWithdrawDestinationResponse {
pub const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse";
}
::buffa::impl_default_instance!(ValidateWithdrawDestinationResponse);
impl ::buffa::MessageName for ValidateWithdrawDestinationResponse {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "ValidateWithdrawDestinationResponse";
const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationResponse";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse";
}
impl ::buffa::Message for ValidateWithdrawDestinationResponse {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.valid {
size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
}
{
let val = self.code.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
if !self.message.is_empty() {
size += 1u32 + ::buffa::types::string_encoded_len(&self.message) as u32;
}
if !self.canonical_destination_address.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(
&self.canonical_destination_address,
) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.valid {
::buffa::types::put_bool_field(1u32, self.valid, buf);
}
{
let val = self.code.to_i32();
if val != 0 {
::buffa::types::put_int32_field(2u32, val, buf);
}
}
if !self.message.is_empty() {
::buffa::types::put_string_field(3u32, &self.message, buf);
}
if !self.canonical_destination_address.is_empty() {
::buffa::types::put_string_field(
4u32,
&self.canonical_destination_address,
buf,
);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.valid = ::buffa::types::decode_bool(buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.code = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.message, buf)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(
&mut self.canonical_destination_address,
buf,
)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.valid = false;
self.code = ::buffa::EnumValue::from(0);
self.message.clear();
self.canonical_destination_address.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for ValidateWithdrawDestinationResponse {
const PROTO_FQN: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationResponse";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for ValidateWithdrawDestinationResponse {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __VALIDATE_WITHDRAW_DESTINATION_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse",
to_json: ::buffa::type_registry::any_to_json::<ValidateWithdrawDestinationResponse>,
from_json: ::buffa::type_registry::any_from_json::<
ValidateWithdrawDestinationResponse,
>,
is_wkt: false,
};
#[allow(
non_camel_case_types,
dead_code,
unused_imports,
unused_qualifications,
clippy::derivable_impls,
clippy::match_single_binding,
clippy::uninlined_format_args,
clippy::doc_lazy_continuation,
clippy::module_inception
)]
pub mod __buffa {
#[allow(unused_imports)]
use super::*;
pub mod view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, Default)]
pub struct CreateTradingWithdrawResponseView<'a> {
pub intent_id: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for CreateTradingWithdrawResponseView<'a> {
type Owned = super::super::CreateTradingWithdrawResponse;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(
::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.intent_id = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateTradingWithdrawResponse,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::CreateTradingWithdrawResponse,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::CreateTradingWithdrawResponse {
intent_id: self.intent_id.to_string(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()?
.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for CreateTradingWithdrawResponseView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.intent_id.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.intent_id) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.intent_id.is_empty() {
::buffa::types::put_string_field(1u32, &self.intent_id, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for CreateTradingWithdrawResponseView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if !::buffa::json_helpers::skip_if::is_empty_str(self.intent_id) {
__map.serialize_entry("intentId", self.intent_id)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for CreateTradingWithdrawResponseView<'a> {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateTradingWithdrawResponse";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawResponse";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawResponse";
}
::buffa::impl_default_view_instance!(CreateTradingWithdrawResponseView);
::buffa::impl_view_reborrow!(CreateTradingWithdrawResponseView);
#[derive(Clone, Debug)]
pub struct CreateTradingWithdrawResponseOwnedView(
::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
);
impl CreateTradingWithdrawResponseOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateTradingWithdrawResponseOwnedView(
::buffa::OwnedView::decode(bytes)?,
),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateTradingWithdrawResponseOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::CreateTradingWithdrawResponse,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateTradingWithdrawResponseOwnedView(
::buffa::OwnedView::from_owned(msg)?,
),
)
}
#[must_use]
pub fn view(&self) -> &CreateTradingWithdrawResponseView<'_> {
self.0.reborrow()
}
pub fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateTradingWithdrawResponse,
::buffa::DecodeError,
> {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn intent_id(&self) -> &'_ str {
self.0.reborrow().intent_id
}
}
impl ::core::convert::From<
::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
> for CreateTradingWithdrawResponseOwnedView {
fn from(
inner: ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
) -> Self {
CreateTradingWithdrawResponseOwnedView(inner)
}
}
impl ::core::convert::From<CreateTradingWithdrawResponseOwnedView>
for ::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>> {
fn from(wrapper: CreateTradingWithdrawResponseOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<
::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>>,
> for CreateTradingWithdrawResponseOwnedView {
fn as_ref(
&self,
) -> &::buffa::OwnedView<CreateTradingWithdrawResponseView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::CreateTradingWithdrawResponse {
type View<'a> = CreateTradingWithdrawResponseView<'a>;
type ViewHandle = CreateTradingWithdrawResponseOwnedView;
}
impl ::serde::Serialize for CreateTradingWithdrawResponseOwnedView {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
::serde::Serialize::serialize(&self.0, __s)
}
}
#[derive(Clone, Debug, Default)]
pub struct CreateWalletTradingWithdrawResponseView<'a> {
pub intent_id: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a>
for CreateWalletTradingWithdrawResponseView<'a> {
type Owned = super::super::CreateWalletTradingWithdrawResponse;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(
::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.intent_id = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateWalletTradingWithdrawResponse,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::CreateWalletTradingWithdrawResponse,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::CreateWalletTradingWithdrawResponse {
intent_id: self.intent_id.to_string(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()?
.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a>
for CreateWalletTradingWithdrawResponseView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.intent_id.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.intent_id) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.intent_id.is_empty() {
::buffa::types::put_string_field(1u32, &self.intent_id, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for CreateWalletTradingWithdrawResponseView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if !::buffa::json_helpers::skip_if::is_empty_str(self.intent_id) {
__map.serialize_entry("intentId", self.intent_id)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for CreateWalletTradingWithdrawResponseView<'a> {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateWalletTradingWithdrawResponse";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawResponse";
}
::buffa::impl_default_view_instance!(CreateWalletTradingWithdrawResponseView);
::buffa::impl_view_reborrow!(CreateWalletTradingWithdrawResponseView);
#[derive(Clone, Debug)]
pub struct CreateWalletTradingWithdrawResponseOwnedView(
::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
);
impl CreateWalletTradingWithdrawResponseOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateWalletTradingWithdrawResponseOwnedView(
::buffa::OwnedView::decode(bytes)?,
),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateWalletTradingWithdrawResponseOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::CreateWalletTradingWithdrawResponse,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateWalletTradingWithdrawResponseOwnedView(
::buffa::OwnedView::from_owned(msg)?,
),
)
}
#[must_use]
pub fn view(&self) -> &CreateWalletTradingWithdrawResponseView<'_> {
self.0.reborrow()
}
pub fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateWalletTradingWithdrawResponse,
::buffa::DecodeError,
> {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn intent_id(&self) -> &'_ str {
self.0.reborrow().intent_id
}
}
impl ::core::convert::From<
::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
> for CreateWalletTradingWithdrawResponseOwnedView {
fn from(
inner: ::buffa::OwnedView<
CreateWalletTradingWithdrawResponseView<'static>,
>,
) -> Self {
CreateWalletTradingWithdrawResponseOwnedView(inner)
}
}
impl ::core::convert::From<CreateWalletTradingWithdrawResponseOwnedView>
for ::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>> {
fn from(wrapper: CreateWalletTradingWithdrawResponseOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<
::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>>,
> for CreateWalletTradingWithdrawResponseOwnedView {
fn as_ref(
&self,
) -> &::buffa::OwnedView<CreateWalletTradingWithdrawResponseView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView
for super::super::CreateWalletTradingWithdrawResponse {
type View<'a> = CreateWalletTradingWithdrawResponseView<'a>;
type ViewHandle = CreateWalletTradingWithdrawResponseOwnedView;
}
impl ::serde::Serialize for CreateWalletTradingWithdrawResponseOwnedView {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
::serde::Serialize::serialize(&self.0, __s)
}
}
#[derive(Clone, Debug, Default)]
pub struct TradingWithdrawIntentPayloadView<'a> {
pub action: ::buffa::EnumValue<super::super::TradingWithdrawAction>,
pub asset_id: u32,
pub destination_chain_id: u64,
pub amount_e18: ::buffa::MessageFieldView<
super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
'a,
>,
>,
pub deadline_ts_sec: u64,
pub nonce: ::buffa::MessageFieldView<
super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
'a,
>,
>,
pub destination_address: &'a str,
pub idempotency_key: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for TradingWithdrawIntentPayloadView<'a> {
type Owned = super::super::TradingWithdrawIntentPayload;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(
::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.action = ::buffa::EnumValue::from(
::buffa::types::decode_int32(&mut cur)?,
);
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.asset_id = ::buffa::types::decode_uint32(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.destination_chain_id = ::buffa::types::decode_uint64(
&mut cur,
)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.amount_e18.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(
existing,
sub,
__sub_ctx,
)?
}
None => {
view.amount_e18 = ::buffa::MessageFieldView::set(
<super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.deadline_ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.nonce.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(
existing,
sub,
__sub_ctx,
)?
}
None => {
view.nonce = ::buffa::MessageFieldView::set(
<super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.destination_address = ::buffa::types::borrow_str(&mut cur)?;
}
8u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.idempotency_key = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::TradingWithdrawIntentPayload,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::TradingWithdrawIntentPayload,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::TradingWithdrawIntentPayload {
action: self.action,
asset_id: self.asset_id,
destination_chain_id: self.destination_chain_id,
amount_e18: match self.amount_e18.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::super::super::super::polyester::r#type::v1::U128,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
deadline_ts_sec: self.deadline_ts_sec,
nonce: match self.nonce.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::super::super::super::polyester::r#type::v1::U128,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
destination_address: self.destination_address.to_string(),
idempotency_key: self.idempotency_key.to_string(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()?
.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for TradingWithdrawIntentPayloadView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
{
let val = self.action.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
if self.asset_id != 0u32 {
size
+= 1u32
+ ::buffa::types::uint32_encoded_len(self.asset_id) as u32;
}
if self.destination_chain_id != 0u64 {
size
+= 1u32
+ ::buffa::types::uint64_encoded_len(
self.destination_chain_id,
) as u32;
}
if self.amount_e18.is_set() {
let __slot = __cache.reserve();
let inner_size = self.amount_e18.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if self.deadline_ts_sec != 0u64 {
size
+= 1u32
+ ::buffa::types::uint64_encoded_len(self.deadline_ts_sec)
as u32;
}
if self.nonce.is_set() {
let __slot = __cache.reserve();
let inner_size = self.nonce.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if !self.destination_address.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(
&self.destination_address,
) as u32;
}
if !self.idempotency_key.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.idempotency_key)
as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.action.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
if self.asset_id != 0u32 {
::buffa::types::put_uint32_field(2u32, self.asset_id, buf);
}
if self.destination_chain_id != 0u64 {
::buffa::types::put_uint64_field(
3u32,
self.destination_chain_id,
buf,
);
}
if self.amount_e18.is_set() {
::buffa::types::put_len_delimited_header(
4u32,
__cache.consume_next(),
buf,
);
self.amount_e18.write_to(__cache, buf);
}
if self.deadline_ts_sec != 0u64 {
::buffa::types::put_uint64_field(5u32, self.deadline_ts_sec, buf);
}
if self.nonce.is_set() {
::buffa::types::put_len_delimited_header(
6u32,
__cache.consume_next(),
buf,
);
self.nonce.write_to(__cache, buf);
}
if !self.destination_address.is_empty() {
::buffa::types::put_string_field(
7u32,
&self.destination_address,
buf,
);
}
if !self.idempotency_key.is_empty() {
::buffa::types::put_string_field(8u32, &self.idempotency_key, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for TradingWithdrawIntentPayloadView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.action) {
__map.serialize_entry("action", &self.action)?;
}
if !::buffa::json_helpers::skip_if::is_zero_u32(&self.asset_id) {
__map
.serialize_entry(
"assetId",
&::buffa::json_helpers::ProtoJson(&self.asset_id),
)?;
}
if !::buffa::json_helpers::skip_if::is_zero_u64(
&self.destination_chain_id,
) {
__map
.serialize_entry(
"destinationChainId",
&::buffa::json_helpers::ProtoJson(&self.destination_chain_id),
)?;
}
{
if let ::core::option::Option::Some(__v) = self
.amount_e18
.as_option()
{
__map.serialize_entry("amountE18", __v)?;
}
}
if !::buffa::json_helpers::skip_if::is_zero_u64(&self.deadline_ts_sec) {
__map
.serialize_entry(
"deadlineTsSec",
&::buffa::json_helpers::ProtoJson(&self.deadline_ts_sec),
)?;
}
{
if let ::core::option::Option::Some(__v) = self.nonce.as_option() {
__map.serialize_entry("nonce", __v)?;
}
}
if !::buffa::json_helpers::skip_if::is_empty_str(
self.destination_address,
) {
__map
.serialize_entry(
"destinationAddress",
self.destination_address,
)?;
}
if !::buffa::json_helpers::skip_if::is_empty_str(self.idempotency_key) {
__map.serialize_entry("idempotencyKey", self.idempotency_key)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for TradingWithdrawIntentPayloadView<'a> {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "TradingWithdrawIntentPayload";
const FULL_NAME: &'static str = "chain.withdraw.v1.TradingWithdrawIntentPayload";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.TradingWithdrawIntentPayload";
}
::buffa::impl_default_view_instance!(TradingWithdrawIntentPayloadView);
::buffa::impl_view_reborrow!(TradingWithdrawIntentPayloadView);
#[derive(Clone, Debug)]
pub struct TradingWithdrawIntentPayloadOwnedView(
::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
);
impl TradingWithdrawIntentPayloadOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
TradingWithdrawIntentPayloadOwnedView(
::buffa::OwnedView::decode(bytes)?,
),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
TradingWithdrawIntentPayloadOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::TradingWithdrawIntentPayload,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
TradingWithdrawIntentPayloadOwnedView(
::buffa::OwnedView::from_owned(msg)?,
),
)
}
#[must_use]
pub fn view(&self) -> &TradingWithdrawIntentPayloadView<'_> {
self.0.reborrow()
}
pub fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::TradingWithdrawIntentPayload,
::buffa::DecodeError,
> {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn action(
&self,
) -> ::buffa::EnumValue<super::super::TradingWithdrawAction> {
self.0.reborrow().action
}
#[must_use]
pub fn asset_id(&self) -> u32 {
self.0.reborrow().asset_id
}
#[must_use]
pub fn destination_chain_id(&self) -> u64 {
self.0.reborrow().destination_chain_id
}
#[must_use]
pub fn amount_e18(
&self,
) -> &::buffa::MessageFieldView<
super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
'_,
>,
> {
&self.0.reborrow().amount_e18
}
#[must_use]
pub fn deadline_ts_sec(&self) -> u64 {
self.0.reborrow().deadline_ts_sec
}
#[must_use]
pub fn nonce(
&self,
) -> &::buffa::MessageFieldView<
super::super::super::super::super::polyester::r#type::v1::__buffa::view::U128View<
'_,
>,
> {
&self.0.reborrow().nonce
}
#[must_use]
pub fn destination_address(&self) -> &'_ str {
self.0.reborrow().destination_address
}
#[must_use]
pub fn idempotency_key(&self) -> &'_ str {
self.0.reborrow().idempotency_key
}
}
impl ::core::convert::From<
::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
> for TradingWithdrawIntentPayloadOwnedView {
fn from(
inner: ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
) -> Self {
TradingWithdrawIntentPayloadOwnedView(inner)
}
}
impl ::core::convert::From<TradingWithdrawIntentPayloadOwnedView>
for ::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>> {
fn from(wrapper: TradingWithdrawIntentPayloadOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<
::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>>,
> for TradingWithdrawIntentPayloadOwnedView {
fn as_ref(
&self,
) -> &::buffa::OwnedView<TradingWithdrawIntentPayloadView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::TradingWithdrawIntentPayload {
type View<'a> = TradingWithdrawIntentPayloadView<'a>;
type ViewHandle = TradingWithdrawIntentPayloadOwnedView;
}
impl ::serde::Serialize for TradingWithdrawIntentPayloadOwnedView {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
::serde::Serialize::serialize(&self.0, __s)
}
}
#[derive(Clone, Debug, Default)]
pub struct CreateTradingWithdrawRequestView<'a> {
pub payload: ::buffa::MessageFieldView<
super::super::__buffa::view::TradingWithdrawIntentPayloadView<'a>,
>,
pub payload_signature: &'a [u8],
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a> for CreateTradingWithdrawRequestView<'a> {
type Owned = super::super::CreateTradingWithdrawRequest;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(
::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.payload.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(
existing,
sub,
__sub_ctx,
)?
}
None => {
view.payload = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::TradingWithdrawIntentPayloadView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.payload_signature = ::buffa::types::borrow_bytes(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateTradingWithdrawRequest,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::CreateTradingWithdrawRequest,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::CreateTradingWithdrawRequest {
payload: match self.payload.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::TradingWithdrawIntentPayload,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
payload_signature: (self.payload_signature).to_vec(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()?
.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for CreateTradingWithdrawRequestView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.payload.is_set() {
let __slot = __cache.reserve();
let inner_size = self.payload.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if !self.payload_signature.is_empty() {
size
+= 1u32
+ ::buffa::types::bytes_encoded_len(&self.payload_signature)
as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.payload.is_set() {
::buffa::types::put_len_delimited_header(
1u32,
__cache.consume_next(),
buf,
);
self.payload.write_to(__cache, buf);
}
if !self.payload_signature.is_empty() {
::buffa::types::put_bytes_field(2u32, &self.payload_signature, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for CreateTradingWithdrawRequestView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
{
if let ::core::option::Option::Some(__v) = self.payload.as_option() {
__map.serialize_entry("payload", __v)?;
}
}
if !::buffa::json_helpers::skip_if::is_empty_bytes(
self.payload_signature,
) {
__map
.serialize_entry(
"payloadSignature",
&::buffa::json_helpers::BytesJson(self.payload_signature),
)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for CreateTradingWithdrawRequestView<'a> {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateTradingWithdrawRequest";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateTradingWithdrawRequest";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateTradingWithdrawRequest";
}
::buffa::impl_default_view_instance!(CreateTradingWithdrawRequestView);
::buffa::impl_view_reborrow!(CreateTradingWithdrawRequestView);
#[derive(Clone, Debug)]
pub struct CreateTradingWithdrawRequestOwnedView(
::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
);
impl CreateTradingWithdrawRequestOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateTradingWithdrawRequestOwnedView(
::buffa::OwnedView::decode(bytes)?,
),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateTradingWithdrawRequestOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::CreateTradingWithdrawRequest,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateTradingWithdrawRequestOwnedView(
::buffa::OwnedView::from_owned(msg)?,
),
)
}
#[must_use]
pub fn view(&self) -> &CreateTradingWithdrawRequestView<'_> {
self.0.reborrow()
}
pub fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateTradingWithdrawRequest,
::buffa::DecodeError,
> {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn payload(
&self,
) -> &::buffa::MessageFieldView<
super::super::__buffa::view::TradingWithdrawIntentPayloadView<'_>,
> {
&self.0.reborrow().payload
}
#[must_use]
pub fn payload_signature(&self) -> &'_ [u8] {
self.0.reborrow().payload_signature
}
}
impl ::core::convert::From<
::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
> for CreateTradingWithdrawRequestOwnedView {
fn from(
inner: ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
) -> Self {
CreateTradingWithdrawRequestOwnedView(inner)
}
}
impl ::core::convert::From<CreateTradingWithdrawRequestOwnedView>
for ::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>> {
fn from(wrapper: CreateTradingWithdrawRequestOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<
::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>>,
> for CreateTradingWithdrawRequestOwnedView {
fn as_ref(
&self,
) -> &::buffa::OwnedView<CreateTradingWithdrawRequestView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::CreateTradingWithdrawRequest {
type View<'a> = CreateTradingWithdrawRequestView<'a>;
type ViewHandle = CreateTradingWithdrawRequestOwnedView;
}
impl ::serde::Serialize for CreateTradingWithdrawRequestOwnedView {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
::serde::Serialize::serialize(&self.0, __s)
}
}
#[derive(Clone, Debug, Default)]
pub struct CreateWalletTradingWithdrawRequestView<'a> {
pub payload: ::buffa::MessageFieldView<
super::super::__buffa::view::TradingWithdrawIntentPayloadView<'a>,
>,
pub subaccount_id: u64,
pub signer_wallet: &'a str,
pub payload_signature: &'a [u8],
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a>
for CreateWalletTradingWithdrawRequestView<'a> {
type Owned = super::super::CreateWalletTradingWithdrawRequest;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(
::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.payload.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(
existing,
sub,
__sub_ctx,
)?
}
None => {
view.payload = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::TradingWithdrawIntentPayloadView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.subaccount_id = ::buffa::types::decode_uint64(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.signer_wallet = ::buffa::types::borrow_str(&mut cur)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.payload_signature = ::buffa::types::borrow_bytes(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateWalletTradingWithdrawRequest,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::CreateWalletTradingWithdrawRequest,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::CreateWalletTradingWithdrawRequest {
payload: match self.payload.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::TradingWithdrawIntentPayload,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
subaccount_id: self.subaccount_id,
signer_wallet: self.signer_wallet.to_string(),
payload_signature: (self.payload_signature).to_vec(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()?
.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for CreateWalletTradingWithdrawRequestView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.payload.is_set() {
let __slot = __cache.reserve();
let inner_size = self.payload.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if self.subaccount_id != 0u64 {
size
+= 1u32
+ ::buffa::types::uint64_encoded_len(self.subaccount_id)
as u32;
}
if !self.signer_wallet.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.signer_wallet)
as u32;
}
if !self.payload_signature.is_empty() {
size
+= 1u32
+ ::buffa::types::bytes_encoded_len(&self.payload_signature)
as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.payload.is_set() {
::buffa::types::put_len_delimited_header(
1u32,
__cache.consume_next(),
buf,
);
self.payload.write_to(__cache, buf);
}
if self.subaccount_id != 0u64 {
::buffa::types::put_uint64_field(2u32, self.subaccount_id, buf);
}
if !self.signer_wallet.is_empty() {
::buffa::types::put_string_field(3u32, &self.signer_wallet, buf);
}
if !self.payload_signature.is_empty() {
::buffa::types::put_bytes_field(4u32, &self.payload_signature, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for CreateWalletTradingWithdrawRequestView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
{
if let ::core::option::Option::Some(__v) = self.payload.as_option() {
__map.serialize_entry("payload", __v)?;
}
}
if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
__map
.serialize_entry(
"subaccountId",
&::buffa::json_helpers::ProtoJson(&self.subaccount_id),
)?;
}
if !::buffa::json_helpers::skip_if::is_empty_str(self.signer_wallet) {
__map.serialize_entry("signerWallet", self.signer_wallet)?;
}
if !::buffa::json_helpers::skip_if::is_empty_bytes(
self.payload_signature,
) {
__map
.serialize_entry(
"payloadSignature",
&::buffa::json_helpers::BytesJson(self.payload_signature),
)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for CreateWalletTradingWithdrawRequestView<'a> {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "CreateWalletTradingWithdrawRequest";
const FULL_NAME: &'static str = "chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.CreateWalletTradingWithdrawRequest";
}
::buffa::impl_default_view_instance!(CreateWalletTradingWithdrawRequestView);
::buffa::impl_view_reborrow!(CreateWalletTradingWithdrawRequestView);
#[derive(Clone, Debug)]
pub struct CreateWalletTradingWithdrawRequestOwnedView(
::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
);
impl CreateWalletTradingWithdrawRequestOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateWalletTradingWithdrawRequestOwnedView(
::buffa::OwnedView::decode(bytes)?,
),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateWalletTradingWithdrawRequestOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::CreateWalletTradingWithdrawRequest,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
CreateWalletTradingWithdrawRequestOwnedView(
::buffa::OwnedView::from_owned(msg)?,
),
)
}
#[must_use]
pub fn view(&self) -> &CreateWalletTradingWithdrawRequestView<'_> {
self.0.reborrow()
}
pub fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::CreateWalletTradingWithdrawRequest,
::buffa::DecodeError,
> {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn payload(
&self,
) -> &::buffa::MessageFieldView<
super::super::__buffa::view::TradingWithdrawIntentPayloadView<'_>,
> {
&self.0.reborrow().payload
}
#[must_use]
pub fn subaccount_id(&self) -> u64 {
self.0.reborrow().subaccount_id
}
#[must_use]
pub fn signer_wallet(&self) -> &'_ str {
self.0.reborrow().signer_wallet
}
#[must_use]
pub fn payload_signature(&self) -> &'_ [u8] {
self.0.reborrow().payload_signature
}
}
impl ::core::convert::From<
::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
> for CreateWalletTradingWithdrawRequestOwnedView {
fn from(
inner: ::buffa::OwnedView<
CreateWalletTradingWithdrawRequestView<'static>,
>,
) -> Self {
CreateWalletTradingWithdrawRequestOwnedView(inner)
}
}
impl ::core::convert::From<CreateWalletTradingWithdrawRequestOwnedView>
for ::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>> {
fn from(wrapper: CreateWalletTradingWithdrawRequestOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<
::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>>,
> for CreateWalletTradingWithdrawRequestOwnedView {
fn as_ref(
&self,
) -> &::buffa::OwnedView<CreateWalletTradingWithdrawRequestView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView
for super::super::CreateWalletTradingWithdrawRequest {
type View<'a> = CreateWalletTradingWithdrawRequestView<'a>;
type ViewHandle = CreateWalletTradingWithdrawRequestOwnedView;
}
impl ::serde::Serialize for CreateWalletTradingWithdrawRequestOwnedView {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
::serde::Serialize::serialize(&self.0, __s)
}
}
#[derive(Clone, Debug, Default)]
pub struct ValidateWithdrawDestinationRequestView<'a> {
pub destination_chain_id: u64,
pub destination_address: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a>
for ValidateWithdrawDestinationRequestView<'a> {
type Owned = super::super::ValidateWithdrawDestinationRequest;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(
::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.destination_chain_id = ::buffa::types::decode_uint64(
&mut cur,
)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.destination_address = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::ValidateWithdrawDestinationRequest,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::ValidateWithdrawDestinationRequest,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::ValidateWithdrawDestinationRequest {
destination_chain_id: self.destination_chain_id,
destination_address: self.destination_address.to_string(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()?
.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for ValidateWithdrawDestinationRequestView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.destination_chain_id != 0u64 {
size
+= 1u32
+ ::buffa::types::uint64_encoded_len(
self.destination_chain_id,
) as u32;
}
if !self.destination_address.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(
&self.destination_address,
) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.destination_chain_id != 0u64 {
::buffa::types::put_uint64_field(
1u32,
self.destination_chain_id,
buf,
);
}
if !self.destination_address.is_empty() {
::buffa::types::put_string_field(
2u32,
&self.destination_address,
buf,
);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for ValidateWithdrawDestinationRequestView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if !::buffa::json_helpers::skip_if::is_zero_u64(
&self.destination_chain_id,
) {
__map
.serialize_entry(
"destinationChainId",
&::buffa::json_helpers::ProtoJson(&self.destination_chain_id),
)?;
}
if !::buffa::json_helpers::skip_if::is_empty_str(
self.destination_address,
) {
__map
.serialize_entry(
"destinationAddress",
self.destination_address,
)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for ValidateWithdrawDestinationRequestView<'a> {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "ValidateWithdrawDestinationRequest";
const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationRequest";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationRequest";
}
::buffa::impl_default_view_instance!(ValidateWithdrawDestinationRequestView);
::buffa::impl_view_reborrow!(ValidateWithdrawDestinationRequestView);
#[derive(Clone, Debug)]
pub struct ValidateWithdrawDestinationRequestOwnedView(
::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>>,
);
impl ValidateWithdrawDestinationRequestOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ValidateWithdrawDestinationRequestOwnedView(
::buffa::OwnedView::decode(bytes)?,
),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ValidateWithdrawDestinationRequestOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::ValidateWithdrawDestinationRequest,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ValidateWithdrawDestinationRequestOwnedView(
::buffa::OwnedView::from_owned(msg)?,
),
)
}
#[must_use]
pub fn view(&self) -> &ValidateWithdrawDestinationRequestView<'_> {
self.0.reborrow()
}
pub fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::ValidateWithdrawDestinationRequest,
::buffa::DecodeError,
> {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn destination_chain_id(&self) -> u64 {
self.0.reborrow().destination_chain_id
}
#[must_use]
pub fn destination_address(&self) -> &'_ str {
self.0.reborrow().destination_address
}
}
impl ::core::convert::From<
::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>>,
> for ValidateWithdrawDestinationRequestOwnedView {
fn from(
inner: ::buffa::OwnedView<
ValidateWithdrawDestinationRequestView<'static>,
>,
) -> Self {
ValidateWithdrawDestinationRequestOwnedView(inner)
}
}
impl ::core::convert::From<ValidateWithdrawDestinationRequestOwnedView>
for ::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>> {
fn from(wrapper: ValidateWithdrawDestinationRequestOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<
::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>>,
> for ValidateWithdrawDestinationRequestOwnedView {
fn as_ref(
&self,
) -> &::buffa::OwnedView<ValidateWithdrawDestinationRequestView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView
for super::super::ValidateWithdrawDestinationRequest {
type View<'a> = ValidateWithdrawDestinationRequestView<'a>;
type ViewHandle = ValidateWithdrawDestinationRequestOwnedView;
}
impl ::serde::Serialize for ValidateWithdrawDestinationRequestOwnedView {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
::serde::Serialize::serialize(&self.0, __s)
}
}
#[derive(Clone, Debug, Default)]
pub struct ValidateWithdrawDestinationResponseView<'a> {
pub valid: bool,
pub code: ::buffa::EnumValue<
super::super::WithdrawDestinationValidationCode,
>,
pub message: &'a str,
pub canonical_destination_address: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ::buffa::MessageView<'a>
for ValidateWithdrawDestinationResponseView<'a> {
type Owned = super::super::ValidateWithdrawDestinationResponse;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(
::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.valid = ::buffa::types::decode_bool(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.code = ::buffa::EnumValue::from(
::buffa::types::decode_int32(&mut cur)?,
);
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.message = ::buffa::types::borrow_str(&mut cur)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.canonical_destination_address = ::buffa::types::borrow_str(
&mut cur,
)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::ValidateWithdrawDestinationResponse,
::buffa::DecodeError,
> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<
super::super::ValidateWithdrawDestinationResponse,
::buffa::DecodeError,
> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::ValidateWithdrawDestinationResponse {
valid: self.valid,
code: self.code,
message: self.message.to_string(),
canonical_destination_address: self
.canonical_destination_address
.to_string(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()?
.into(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a>
for ValidateWithdrawDestinationResponseView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.valid {
size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
}
{
let val = self.code.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
if !self.message.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.message) as u32;
}
if !self.canonical_destination_address.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(
&self.canonical_destination_address,
) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.valid {
::buffa::types::put_bool_field(1u32, self.valid, buf);
}
{
let val = self.code.to_i32();
if val != 0 {
::buffa::types::put_int32_field(2u32, val, buf);
}
}
if !self.message.is_empty() {
::buffa::types::put_string_field(3u32, &self.message, buf);
}
if !self.canonical_destination_address.is_empty() {
::buffa::types::put_string_field(
4u32,
&self.canonical_destination_address,
buf,
);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for ValidateWithdrawDestinationResponseView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if self.valid {
__map.serialize_entry("valid", &self.valid)?;
}
if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.code) {
__map.serialize_entry("code", &self.code)?;
}
if !::buffa::json_helpers::skip_if::is_empty_str(self.message) {
__map.serialize_entry("message", self.message)?;
}
if !::buffa::json_helpers::skip_if::is_empty_str(
self.canonical_destination_address,
) {
__map
.serialize_entry(
"canonicalDestinationAddress",
self.canonical_destination_address,
)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for ValidateWithdrawDestinationResponseView<'a> {
const PACKAGE: &'static str = "chain.withdraw.v1";
const NAME: &'static str = "ValidateWithdrawDestinationResponse";
const FULL_NAME: &'static str = "chain.withdraw.v1.ValidateWithdrawDestinationResponse";
const TYPE_URL: &'static str = "type.googleapis.com/chain.withdraw.v1.ValidateWithdrawDestinationResponse";
}
::buffa::impl_default_view_instance!(ValidateWithdrawDestinationResponseView);
::buffa::impl_view_reborrow!(ValidateWithdrawDestinationResponseView);
#[derive(Clone, Debug)]
pub struct ValidateWithdrawDestinationResponseOwnedView(
::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>>,
);
impl ValidateWithdrawDestinationResponseOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ValidateWithdrawDestinationResponseOwnedView(
::buffa::OwnedView::decode(bytes)?,
),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ValidateWithdrawDestinationResponseOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::ValidateWithdrawDestinationResponse,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ValidateWithdrawDestinationResponseOwnedView(
::buffa::OwnedView::from_owned(msg)?,
),
)
}
#[must_use]
pub fn view(&self) -> &ValidateWithdrawDestinationResponseView<'_> {
self.0.reborrow()
}
pub fn to_owned_message(
&self,
) -> ::core::result::Result<
super::super::ValidateWithdrawDestinationResponse,
::buffa::DecodeError,
> {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn valid(&self) -> bool {
self.0.reborrow().valid
}
#[must_use]
pub fn code(
&self,
) -> ::buffa::EnumValue<super::super::WithdrawDestinationValidationCode> {
self.0.reborrow().code
}
#[must_use]
pub fn message(&self) -> &'_ str {
self.0.reborrow().message
}
#[must_use]
pub fn canonical_destination_address(&self) -> &'_ str {
self.0.reborrow().canonical_destination_address
}
}
impl ::core::convert::From<
::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>>,
> for ValidateWithdrawDestinationResponseOwnedView {
fn from(
inner: ::buffa::OwnedView<
ValidateWithdrawDestinationResponseView<'static>,
>,
) -> Self {
ValidateWithdrawDestinationResponseOwnedView(inner)
}
}
impl ::core::convert::From<ValidateWithdrawDestinationResponseOwnedView>
for ::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>> {
fn from(wrapper: ValidateWithdrawDestinationResponseOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<
::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>>,
> for ValidateWithdrawDestinationResponseOwnedView {
fn as_ref(
&self,
) -> &::buffa::OwnedView<ValidateWithdrawDestinationResponseView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView
for super::super::ValidateWithdrawDestinationResponse {
type View<'a> = ValidateWithdrawDestinationResponseView<'a>;
type ViewHandle = ValidateWithdrawDestinationResponseOwnedView;
}
impl ::serde::Serialize for ValidateWithdrawDestinationResponseOwnedView {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
::serde::Serialize::serialize(&self.0, __s)
}
}
}
pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
reg.register_json_any(super::__CREATE_TRADING_WITHDRAW_RESPONSE_JSON_ANY);
reg.register_json_any(super::__CREATE_WALLET_TRADING_WITHDRAW_RESPONSE_JSON_ANY);
reg.register_json_any(super::__TRADING_WITHDRAW_INTENT_PAYLOAD_JSON_ANY);
reg.register_json_any(super::__CREATE_TRADING_WITHDRAW_REQUEST_JSON_ANY);
reg.register_json_any(super::__CREATE_WALLET_TRADING_WITHDRAW_REQUEST_JSON_ANY);
reg.register_json_any(super::__VALIDATE_WITHDRAW_DESTINATION_REQUEST_JSON_ANY);
reg.register_json_any(super::__VALIDATE_WITHDRAW_DESTINATION_RESPONSE_JSON_ANY);
}
}
#[doc(inline)]
pub use self::__buffa::view::CreateTradingWithdrawResponseView;
#[doc(inline)]
pub use self::__buffa::view::CreateTradingWithdrawResponseOwnedView;
#[doc(inline)]
pub use self::__buffa::view::CreateWalletTradingWithdrawResponseView;
#[doc(inline)]
pub use self::__buffa::view::CreateWalletTradingWithdrawResponseOwnedView;
#[doc(inline)]
pub use self::__buffa::view::TradingWithdrawIntentPayloadView;
#[doc(inline)]
pub use self::__buffa::view::TradingWithdrawIntentPayloadOwnedView;
#[doc(inline)]
pub use self::__buffa::view::CreateTradingWithdrawRequestView;
#[doc(inline)]
pub use self::__buffa::view::CreateTradingWithdrawRequestOwnedView;
#[doc(inline)]
pub use self::__buffa::view::CreateWalletTradingWithdrawRequestView;
#[doc(inline)]
pub use self::__buffa::view::CreateWalletTradingWithdrawRequestOwnedView;
#[doc(inline)]
pub use self::__buffa::view::ValidateWithdrawDestinationRequestView;
#[doc(inline)]
pub use self::__buffa::view::ValidateWithdrawDestinationRequestOwnedView;
#[doc(inline)]
pub use self::__buffa::view::ValidateWithdrawDestinationResponseView;
#[doc(inline)]
pub use self::__buffa::view::ValidateWithdrawDestinationResponseOwnedView;
#[doc(inline)]
pub use self::__buffa::register_types;