diff --git a/.changelog/unreleased/features/167-ics721-impl.md b/.changelog/unreleased/features/167-ics721-impl.md new file mode 100644 index 00000000..1281b08b --- /dev/null +++ b/.changelog/unreleased/features/167-ics721-impl.md @@ -0,0 +1,2 @@ +- Add ICS-721 proto: ([\#167](https://github.com/cosmos/ibc-proto- + rs/issues/167)) \ No newline at end of file diff --git a/scripts/sync-protobuf.sh b/scripts/sync-protobuf.sh index a7fe7268..94ba2a03 100755 --- a/scripts/sync-protobuf.sh +++ b/scripts/sync-protobuf.sh @@ -26,14 +26,17 @@ CACHE_PATH="${XDG_CACHE_HOME:-$HOME/.cache}" COSMOS_SDK_GIT="${COSMOS_SDK_GIT:-$CACHE_PATH/cosmos/cosmos-sdk.git}" IBC_GO_GIT="${IBC_GO_GIT:-$CACHE_PATH/ibc-go.git}" COSMOS_ICS_GIT="${COSMOS_ICS_GIT:-$CACHE_PATH/cosmos/interchain-security.git}" +NFT_TRANSFER_GIT="${NFT_TRANSFER_GIT:-$CACHE_PATH/bianjieai/nft-transfer.git}" COSMOS_SDK_COMMIT="$(cat src/COSMOS_SDK_COMMIT)" IBC_GO_COMMIT="$(cat src/IBC_GO_COMMIT)" INTERCHAIN_SECURITY_COMMIT="$(cat src/INTERCHAIN_SECURITY_COMMIT)" +NFT_TRANSFER_COMMIT="$(cat src/NFT_TRANSFER_COMMIT)" echo "COSMOS_SDK_COMMIT: $COSMOS_SDK_COMMIT" echo "IBC_GO_COMMIT: $IBC_GO_COMMIT" echo "INTERCHAIN_SECURITY_COMMIT: $INTERCHAIN_SECURITY_COMMIT" +echo "NFT_TRANSFER_COMMIT: $NFT_TRANSFER_COMMIT" # Use either --ics-commit flag for commit ID, # or --ics-tag for git tag. Because we can't modify @@ -89,6 +92,15 @@ else echo "Using existing ibc-go bare git repository at $IBC_GO_GIT" fi +if [[ ! -e "$NFT_TRANSFER_GIT" ]] +then + echo "Cloning nft-transfer source code to as bare git repository to $NFT_TRANSFER_GIT" + git clone --mirror https://github.com/bianjieai/nft-transfer.git "$NFT_TRANSFER_GIT" +else + echo "Using existing nft-transfer bare git repository at $NFT_TRANSFER_GIT" +fi + + # Update the repositories using git fetch. This is so that # we keep local copies of the repositories up to sync first. pushd "$COSMOS_ICS_GIT" @@ -103,6 +115,10 @@ pushd "$IBC_GO_GIT" git fetch popd +pushd "$NFT_TRANSFER_GIT" +git fetch +popd + # Create a new temporary directory to check out the # actual source files from the bare git repositories. # This is so that we do not accidentally use an unclean @@ -154,6 +170,17 @@ cd proto buf export -v -o ../proto-include popd +NFT_TRANSFER_DIR=$(mktemp -d /tmp/nft-transfer-XXXXXXXX) + +pushd "$NFT_TRANSFER_DIR" +git clone "$NFT_TRANSFER_GIT" . +git checkout -b "$NFT_TRANSFER_COMMIT" "$NFT_TRANSFER_COMMIT" + +cd proto +buf export -v -o ../proto-include +rm ../proto-include/ibc/core/client/v1/client.proto +popd + # Remove the existing generated protobuf files # so that the newly generated code does not # contain removed files. @@ -173,6 +200,7 @@ cargo run -- compile \ --ics "$COSMOS_ICS_DIR/proto-include" \ --sdk "$COSMOS_SDK_DIR/proto-include" \ --ibc "$IBC_GO_DIR/proto-include" \ + --nft "$NFT_TRANSFER_DIR/proto-include" \ --out ../../src/prost cd ../.. @@ -192,3 +220,4 @@ rm -f src/prost/tendermint.abci.rs rm -rf "$COSMOS_ICS_DIR" rm -rf "$COSMOS_SDK_DIR" rm -rf "$IBC_GO_DIR" +rm -rf "$NFT_TRANSFER_DIR" diff --git a/src/NFT_TRANSFER_COMMIT b/src/NFT_TRANSFER_COMMIT new file mode 100644 index 00000000..9a642085 --- /dev/null +++ b/src/NFT_TRANSFER_COMMIT @@ -0,0 +1 @@ +986de3bb91434c9efc49a82544e3ba0b208e19a7 diff --git a/src/lib.rs b/src/lib.rs index 37e76f5b..77acae1f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,6 +34,9 @@ pub const IBC_GO_COMMIT: &str = include_str!("IBC_GO_COMMIT"); /// The version (commit hash) of Interchain Security used when generating this library. pub const INTERCHAIN_SECURITY_COMMIT: &str = include_str!("INTERCHAIN_SECURITY_COMMIT"); +/// The version (commit hash) of nft-transfer used when generating this library. +pub const NFT_TRANSFER_COMMIT: &str = include_str!("NFT_TRANSFER_COMMIT"); + /// File descriptor set of compiled proto. #[cfg(feature = "proto-descriptor")] pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("prost/proto_descriptor.bin"); @@ -296,6 +299,13 @@ pub mod ibc { } } } + pub mod nft_transfer { + pub mod v1 { + include_proto!("ibc.applications.nft_transfer.v1.rs"); + #[cfg(feature = "serde")] + include_proto!("ibc.applications.nft_transfer.v1.serde.rs"); + } + } } pub mod core { pub mod channel { diff --git a/src/prost/ibc.applications.nft_transfer.v1.rs b/src/prost/ibc.applications.nft_transfer.v1.rs new file mode 100644 index 00000000..bea5ee5a --- /dev/null +++ b/src/prost/ibc.applications.nft_transfer.v1.rs @@ -0,0 +1,1387 @@ +/// ClassTrace contains the base classID for ICS721 non-fungible tokens and the +/// source tracing information path. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClassTrace { + /// path defines the chain of port/channel identifiers used for tracing the + /// source of the non-fungible token. + #[prost(string, tag = "1")] + pub path: ::prost::alloc::string::String, + /// base classID of the relayed non-fungible token. + #[prost(string, tag = "2")] + pub base_class_id: ::prost::alloc::string::String, +} +impl ::prost::Name for ClassTrace { + const NAME: &'static str = "ClassTrace"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// Params defines the set of IBC nft-transfer parameters. +/// NOTE: To prevent a nft from being transferred, set the +/// TransfersEnabled parameter to false. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// send_enabled enables or disables all cross-chain nft transfers from this + /// chain. + #[prost(bool, tag = "1")] + pub send_enabled: bool, + /// receive_enabled enables or disables all cross-chain nft transfers to this + /// chain. + #[prost(bool, tag = "2")] + pub receive_enabled: bool, +} +impl ::prost::Name for Params { + const NAME: &'static str = "Params"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// MsgTransfer defines a msg to transfer non fungible tokens between +/// ICS721 enabled chains. See ICS Spec here: +/// +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgTransfer { + /// the port on which the packet will be sent + #[prost(string, tag = "1")] + pub source_port: ::prost::alloc::string::String, + /// the channel by which the packet will be sent + #[prost(string, tag = "2")] + pub source_channel: ::prost::alloc::string::String, + /// the class_id of tokens to be transferred + #[prost(string, tag = "3")] + pub class_id: ::prost::alloc::string::String, + /// the non fungible tokens to be transferred + #[prost(string, repeated, tag = "4")] + pub token_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// the sender address + #[prost(string, tag = "5")] + pub sender: ::prost::alloc::string::String, + /// the recipient address on the destination chain + #[prost(string, tag = "6")] + pub receiver: ::prost::alloc::string::String, + /// Timeout height relative to the current block height. + /// The timeout is disabled when set to 0. + #[prost(message, optional, tag = "7")] + pub timeout_height: ::core::option::Option< + super::super::super::core::client::v1::Height, + >, + /// Timeout timestamp in absolute nanoseconds since unix epoch. + /// The timeout is disabled when set to 0. + #[prost(uint64, tag = "8")] + pub timeout_timestamp: u64, + /// optional memo + #[prost(string, tag = "9")] + pub memo: ::prost::alloc::string::String, +} +impl ::prost::Name for MsgTransfer { + const NAME: &'static str = "MsgTransfer"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// MsgTransferResponse defines the Msg/Transfer response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgTransferResponse { + /// sequence number of the transfer packet sent + #[prost(uint64, tag = "1")] + pub sequence: u64, +} +impl ::prost::Name for MsgTransferResponse { + const NAME: &'static str = "MsgTransferResponse"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// MsgUpdateParams is the Msg/UpdateParams request type. +/// +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// authority is the address that controls the module (defaults to x/gov unless overwritten). + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the nft-transfer parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +impl ::prost::Name for MsgUpdateParamsResponse { + const NAME: &'static str = "MsgUpdateParamsResponse"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the ibc/nft-transfer Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Transfer defines a rpc handler method for MsgTransfer. + pub async fn transfer( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/ibc.applications.nft_transfer.v1.Msg/Transfer", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("ibc.applications.nft_transfer.v1.Msg", "Transfer"), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateParams defines a governance operation for updating the nft-transfer module parameters. + /// The authority is defined in the keeper. + /// + pub async fn update_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/ibc.applications.nft_transfer.v1.Msg/UpdateParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "ibc.applications.nft_transfer.v1.Msg", + "UpdateParams", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// Transfer defines a rpc handler method for MsgTransfer. + async fn transfer( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// UpdateParams defines a governance operation for updating the nft-transfer module parameters. + /// The authority is defined in the keeper. + /// + async fn update_params( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the ibc/nft-transfer Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + B: Body + Send + 'static, + B::Error: Into + Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + let inner = self.inner.clone(); + match req.uri().path() { + "/ibc.applications.nft_transfer.v1.Msg/Transfer" => { + #[allow(non_camel_case_types)] + struct TransferSvc(pub Arc); + impl tonic::server::UnaryService + for TransferSvc { + type Response = super::MsgTransferResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::transfer(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = TransferSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/ibc.applications.nft_transfer.v1.Msg/UpdateParams" => { + #[allow(non_camel_case_types)] + struct UpdateParamsSvc(pub Arc); + impl tonic::server::UnaryService + for UpdateParamsSvc { + type Response = super::MsgUpdateParamsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::update_params(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UpdateParamsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } + } + } + } + impl Clone for MsgServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + impl std::fmt::Debug for _Inner { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self.0) + } + } + impl tonic::server::NamedService for MsgServer { + const NAME: &'static str = "ibc.applications.nft_transfer.v1.Msg"; + } +} +/// NonFungibleTokenPacketData defines a struct for the packet payload +/// See NonFungibleTokenPacketData spec: +/// +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NonFungibleTokenPacketData { + /// the class_id of class to be transferred + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + /// the class_uri of class to be transferred + #[prost(string, tag = "2")] + pub class_uri: ::prost::alloc::string::String, + /// the class_data of class to be transferred + #[prost(string, tag = "3")] + pub class_data: ::prost::alloc::string::String, + /// the non fungible tokens to be transferred + #[prost(string, repeated, tag = "4")] + pub token_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// the non fungible tokens's uri to be transferred + #[prost(string, repeated, tag = "5")] + pub token_uris: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// the non fungible tokens's data to be transferred + #[prost(string, repeated, tag = "6")] + pub token_data: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// the sender address + #[prost(string, tag = "7")] + pub sender: ::prost::alloc::string::String, + /// the recipient address on the destination chain + #[prost(string, tag = "8")] + pub receiver: ::prost::alloc::string::String, + /// optional memo + #[prost(string, tag = "9")] + pub memo: ::prost::alloc::string::String, +} +impl ::prost::Name for NonFungibleTokenPacketData { + const NAME: &'static str = "NonFungibleTokenPacketData"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryClassTraceRequest is the request type for the Query/ClassDenom RPC +/// method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassTraceRequest { + /// hash (in hex format) or classID (full classID with ibc prefix) of the + /// denomination trace information. + #[prost(string, tag = "1")] + pub hash: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryClassTraceRequest { + const NAME: &'static str = "QueryClassTraceRequest"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryClassTraceResponse is the response type for the Query/ClassDenom RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassTraceResponse { + /// class_trace returns the requested class trace information. + #[prost(message, optional, tag = "1")] + pub class_trace: ::core::option::Option, +} +impl ::prost::Name for QueryClassTraceResponse { + const NAME: &'static str = "QueryClassTraceResponse"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryConnectionsRequest is the request type for the Query/ClassTraces RPC +/// method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassTracesRequest { + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryClassTracesRequest { + const NAME: &'static str = "QueryClassTracesRequest"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryClassTracesResponse is the response type for the Query/ClassTraces RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassTracesResponse { + /// class_traces returns all class trace information. + #[prost(message, repeated, tag = "1")] + pub class_traces: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryClassTracesResponse { + const NAME: &'static str = "QueryClassTracesResponse"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryClassHashRequest is the request type for the Query/ClassHash RPC +/// method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassHashRequest { + /// The class trace `([port_id]/[channel_id])+/[class]` + #[prost(string, tag = "1")] + pub trace: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryClassHashRequest { + const NAME: &'static str = "QueryClassHashRequest"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryClassHashResponse is the response type for the Query/ClassHash RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassHashResponse { + /// hash (in hex format) of the denomination trace information. + #[prost(string, tag = "1")] + pub hash: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryClassHashResponse { + const NAME: &'static str = "QueryClassHashResponse"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryEscrowAddressRequest is the request type for the EscrowAddress RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEscrowAddressRequest { + /// unique port identifier + #[prost(string, tag = "1")] + pub port_id: ::prost::alloc::string::String, + /// unique channel identifier + #[prost(string, tag = "2")] + pub channel_id: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryEscrowAddressRequest { + const NAME: &'static str = "QueryEscrowAddressRequest"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryEscrowAddressResponse is the response type of the EscrowAddress RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEscrowAddressResponse { + /// the escrow account address + #[prost(string, tag = "1")] + pub escrow_address: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryEscrowAddressResponse { + const NAME: &'static str = "QueryEscrowAddressResponse"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +impl ::prost::Name for QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryParamsResponse { + const NAME: &'static str = "QueryParamsResponse"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query provides defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// ClassTrace queries a class trace information. + pub async fn class_trace( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/ibc.applications.nft_transfer.v1.Query/ClassTrace", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "ibc.applications.nft_transfer.v1.Query", + "ClassTrace", + ), + ); + self.inner.unary(req, path, codec).await + } + /// ClassTraces queries all class traces. + pub async fn class_traces( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/ibc.applications.nft_transfer.v1.Query/ClassTraces", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "ibc.applications.nft_transfer.v1.Query", + "ClassTraces", + ), + ); + self.inner.unary(req, path, codec).await + } + /// ClassHash queries a class hash information. + pub async fn class_hash( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/ibc.applications.nft_transfer.v1.Query/ClassHash", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "ibc.applications.nft_transfer.v1.Query", + "ClassHash", + ), + ); + self.inner.unary(req, path, codec).await + } + /// EscrowAddress returns the escrow address for a particular port and channel + /// id. + pub async fn escrow_address( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/ibc.applications.nft_transfer.v1.Query/EscrowAddress", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "ibc.applications.nft_transfer.v1.Query", + "EscrowAddress", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Params queries all parameters of the nft-transfer module. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/ibc.applications.nft_transfer.v1.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("ibc.applications.nft_transfer.v1.Query", "Params"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod query_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with QueryServer. + #[async_trait] + pub trait Query: Send + Sync + 'static { + /// ClassTrace queries a class trace information. + async fn class_trace( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// ClassTraces queries all class traces. + async fn class_traces( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// ClassHash queries a class hash information. + async fn class_hash( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// EscrowAddress returns the escrow address for a particular port and channel + /// id. + async fn escrow_address( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Params queries all parameters of the nft-transfer module. + async fn params( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query provides defines the gRPC querier service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl QueryServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for QueryServer + where + T: Query, + B: Body + Send + 'static, + B::Error: Into + Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + let inner = self.inner.clone(); + match req.uri().path() { + "/ibc.applications.nft_transfer.v1.Query/ClassTrace" => { + #[allow(non_camel_case_types)] + struct ClassTraceSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ClassTraceSvc { + type Response = super::QueryClassTraceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::class_trace(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ClassTraceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/ibc.applications.nft_transfer.v1.Query/ClassTraces" => { + #[allow(non_camel_case_types)] + struct ClassTracesSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ClassTracesSvc { + type Response = super::QueryClassTracesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::class_traces(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ClassTracesSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/ibc.applications.nft_transfer.v1.Query/ClassHash" => { + #[allow(non_camel_case_types)] + struct ClassHashSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ClassHashSvc { + type Response = super::QueryClassHashResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::class_hash(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ClassHashSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/ibc.applications.nft_transfer.v1.Query/EscrowAddress" => { + #[allow(non_camel_case_types)] + struct EscrowAddressSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for EscrowAddressSvc { + type Response = super::QueryEscrowAddressResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::escrow_address(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = EscrowAddressSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/ibc.applications.nft_transfer.v1.Query/Params" => { + #[allow(non_camel_case_types)] + struct ParamsSvc(pub Arc); + impl tonic::server::UnaryService + for ParamsSvc { + type Response = super::QueryParamsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::params(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ParamsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } + } + } + } + impl Clone for QueryServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + impl std::fmt::Debug for _Inner { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self.0) + } + } + impl tonic::server::NamedService for QueryServer { + const NAME: &'static str = "ibc.applications.nft_transfer.v1.Query"; + } +} +/// GenesisState defines the ibc-nft-transfer genesis state +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(string, tag = "1")] + pub port_id: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "2")] + pub traces: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "ibc.applications.nft_transfer.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("ibc.applications.nft_transfer.v1.{}", Self::NAME) + } +} diff --git a/src/prost/ibc.applications.nft_transfer.v1.serde.rs b/src/prost/ibc.applications.nft_transfer.v1.serde.rs new file mode 100644 index 00000000..b7073db8 --- /dev/null +++ b/src/prost/ibc.applications.nft_transfer.v1.serde.rs @@ -0,0 +1,2014 @@ +impl serde::Serialize for ClassTrace { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.ClassTrace", len)?; + if true { + struct_ser.serialize_field("path", &self.path)?; + } + if true { + struct_ser.serialize_field("baseClassId", &self.base_class_id)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ClassTrace { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "path", + "base_class_id", + "baseClassId", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Path, + BaseClassId, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "path" => Ok(GeneratedField::Path), + "baseClassId" | "base_class_id" => Ok(GeneratedField::BaseClassId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ClassTrace; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.ClassTrace") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut path__ = None; + let mut base_class_id__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Path => { + if path__.is_some() { + return Err(serde::de::Error::duplicate_field("path")); + } + path__ = Some(map.next_value()?); + } + GeneratedField::BaseClassId => { + if base_class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("baseClassId")); + } + base_class_id__ = Some(map.next_value()?); + } + } + } + Ok(ClassTrace { + path: path__.unwrap_or_default(), + base_class_id: base_class_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.ClassTrace", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.GenesisState", len)?; + if true { + struct_ser.serialize_field("portId", &self.port_id)?; + } + if true { + struct_ser.serialize_field("traces", &self.traces)?; + } + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "port_id", + "portId", + "traces", + "params", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + PortId, + Traces, + Params, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "portId" | "port_id" => Ok(GeneratedField::PortId), + "traces" => Ok(GeneratedField::Traces), + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.GenesisState") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut port_id__ = None; + let mut traces__ = None; + let mut params__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::PortId => { + if port_id__.is_some() { + return Err(serde::de::Error::duplicate_field("portId")); + } + port_id__ = Some(map.next_value()?); + } + GeneratedField::Traces => { + if traces__.is_some() { + return Err(serde::de::Error::duplicate_field("traces")); + } + traces__ = Some(map.next_value()?); + } + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map.next_value()?; + } + } + } + Ok(GenesisState { + port_id: port_id__.unwrap_or_default(), + traces: traces__.unwrap_or_default(), + params: params__, + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.GenesisState", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for MsgTransfer { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.MsgTransfer", len)?; + if true { + struct_ser.serialize_field("sourcePort", &self.source_port)?; + } + if true { + struct_ser.serialize_field("sourceChannel", &self.source_channel)?; + } + if true { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if true { + struct_ser.serialize_field("tokenIds", &self.token_ids)?; + } + if true { + struct_ser.serialize_field("sender", &self.sender)?; + } + if true { + struct_ser.serialize_field("receiver", &self.receiver)?; + } + if let Some(v) = self.timeout_height.as_ref() { + struct_ser.serialize_field("timeoutHeight", v)?; + } + if true { + struct_ser.serialize_field("timeoutTimestamp", ::alloc::string::ToString::to_string(&self.timeout_timestamp).as_str())?; + } + if true { + struct_ser.serialize_field("memo", &self.memo)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for MsgTransfer { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "source_port", + "sourcePort", + "source_channel", + "sourceChannel", + "class_id", + "classId", + "token_ids", + "tokenIds", + "sender", + "receiver", + "timeout_height", + "timeoutHeight", + "timeout_timestamp", + "timeoutTimestamp", + "memo", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SourcePort, + SourceChannel, + ClassId, + TokenIds, + Sender, + Receiver, + TimeoutHeight, + TimeoutTimestamp, + Memo, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "sourcePort" | "source_port" => Ok(GeneratedField::SourcePort), + "sourceChannel" | "source_channel" => Ok(GeneratedField::SourceChannel), + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "tokenIds" | "token_ids" => Ok(GeneratedField::TokenIds), + "sender" => Ok(GeneratedField::Sender), + "receiver" => Ok(GeneratedField::Receiver), + "timeoutHeight" | "timeout_height" => Ok(GeneratedField::TimeoutHeight), + "timeoutTimestamp" | "timeout_timestamp" => Ok(GeneratedField::TimeoutTimestamp), + "memo" => Ok(GeneratedField::Memo), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgTransfer; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.MsgTransfer") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut source_port__ = None; + let mut source_channel__ = None; + let mut class_id__ = None; + let mut token_ids__ = None; + let mut sender__ = None; + let mut receiver__ = None; + let mut timeout_height__ = None; + let mut timeout_timestamp__ = None; + let mut memo__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::SourcePort => { + if source_port__.is_some() { + return Err(serde::de::Error::duplicate_field("sourcePort")); + } + source_port__ = Some(map.next_value()?); + } + GeneratedField::SourceChannel => { + if source_channel__.is_some() { + return Err(serde::de::Error::duplicate_field("sourceChannel")); + } + source_channel__ = Some(map.next_value()?); + } + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map.next_value()?); + } + GeneratedField::TokenIds => { + if token_ids__.is_some() { + return Err(serde::de::Error::duplicate_field("tokenIds")); + } + token_ids__ = Some(map.next_value()?); + } + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map.next_value()?); + } + GeneratedField::Receiver => { + if receiver__.is_some() { + return Err(serde::de::Error::duplicate_field("receiver")); + } + receiver__ = Some(map.next_value()?); + } + GeneratedField::TimeoutHeight => { + if timeout_height__.is_some() { + return Err(serde::de::Error::duplicate_field("timeoutHeight")); + } + timeout_height__ = map.next_value()?; + } + GeneratedField::TimeoutTimestamp => { + if timeout_timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("timeoutTimestamp")); + } + timeout_timestamp__ = + Some(map.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Memo => { + if memo__.is_some() { + return Err(serde::de::Error::duplicate_field("memo")); + } + memo__ = Some(map.next_value()?); + } + } + } + Ok(MsgTransfer { + source_port: source_port__.unwrap_or_default(), + source_channel: source_channel__.unwrap_or_default(), + class_id: class_id__.unwrap_or_default(), + token_ids: token_ids__.unwrap_or_default(), + sender: sender__.unwrap_or_default(), + receiver: receiver__.unwrap_or_default(), + timeout_height: timeout_height__, + timeout_timestamp: timeout_timestamp__.unwrap_or_default(), + memo: memo__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.MsgTransfer", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for MsgTransferResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.MsgTransferResponse", len)?; + if true { + struct_ser.serialize_field("sequence", ::alloc::string::ToString::to_string(&self.sequence).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for MsgTransferResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sequence", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sequence, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "sequence" => Ok(GeneratedField::Sequence), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgTransferResponse; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.MsgTransferResponse") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sequence__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Sequence => { + if sequence__.is_some() { + return Err(serde::de::Error::duplicate_field("sequence")); + } + sequence__ = + Some(map.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + } + } + Ok(MsgTransferResponse { + sequence: sequence__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.MsgTransferResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for MsgUpdateParams { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.MsgUpdateParams", len)?; + if true { + struct_ser.serialize_field("authority", &self.authority)?; + } + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for MsgUpdateParams { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "authority", + "params", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Authority, + Params, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "authority" => Ok(GeneratedField::Authority), + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateParams; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.MsgUpdateParams") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut authority__ = None; + let mut params__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Authority => { + if authority__.is_some() { + return Err(serde::de::Error::duplicate_field("authority")); + } + authority__ = Some(map.next_value()?); + } + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map.next_value()?; + } + } + } + Ok(MsgUpdateParams { + authority: authority__.unwrap_or_default(), + params: params__, + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.MsgUpdateParams", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for MsgUpdateParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.MsgUpdateParamsResponse", len)?; + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for MsgUpdateParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateParamsResponse; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.MsgUpdateParamsResponse") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map.next_key::()?.is_some() { + let _ = map.next_value::()?; + } + Ok(MsgUpdateParamsResponse { + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.MsgUpdateParamsResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for NonFungibleTokenPacketData { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.NonFungibleTokenPacketData", len)?; + if true { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if true { + struct_ser.serialize_field("classUri", &self.class_uri)?; + } + if true { + struct_ser.serialize_field("classData", &self.class_data)?; + } + if true { + struct_ser.serialize_field("tokenIds", &self.token_ids)?; + } + if true { + struct_ser.serialize_field("tokenUris", &self.token_uris)?; + } + if true { + struct_ser.serialize_field("tokenData", &self.token_data)?; + } + if true { + struct_ser.serialize_field("sender", &self.sender)?; + } + if true { + struct_ser.serialize_field("receiver", &self.receiver)?; + } + if true { + struct_ser.serialize_field("memo", &self.memo)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for NonFungibleTokenPacketData { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "class_id", + "classId", + "class_uri", + "classUri", + "class_data", + "classData", + "token_ids", + "tokenIds", + "token_uris", + "tokenUris", + "token_data", + "tokenData", + "sender", + "receiver", + "memo", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + ClassUri, + ClassData, + TokenIds, + TokenUris, + TokenData, + Sender, + Receiver, + Memo, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "classUri" | "class_uri" => Ok(GeneratedField::ClassUri), + "classData" | "class_data" => Ok(GeneratedField::ClassData), + "tokenIds" | "token_ids" => Ok(GeneratedField::TokenIds), + "tokenUris" | "token_uris" => Ok(GeneratedField::TokenUris), + "tokenData" | "token_data" => Ok(GeneratedField::TokenData), + "sender" => Ok(GeneratedField::Sender), + "receiver" => Ok(GeneratedField::Receiver), + "memo" => Ok(GeneratedField::Memo), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = NonFungibleTokenPacketData; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.NonFungibleTokenPacketData") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut class_uri__ = None; + let mut class_data__ = None; + let mut token_ids__ = None; + let mut token_uris__ = None; + let mut token_data__ = None; + let mut sender__ = None; + let mut receiver__ = None; + let mut memo__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map.next_value()?); + } + GeneratedField::ClassUri => { + if class_uri__.is_some() { + return Err(serde::de::Error::duplicate_field("classUri")); + } + class_uri__ = Some(map.next_value()?); + } + GeneratedField::ClassData => { + if class_data__.is_some() { + return Err(serde::de::Error::duplicate_field("classData")); + } + class_data__ = Some(map.next_value()?); + } + GeneratedField::TokenIds => { + if token_ids__.is_some() { + return Err(serde::de::Error::duplicate_field("tokenIds")); + } + token_ids__ = Some(map.next_value()?); + } + GeneratedField::TokenUris => { + if token_uris__.is_some() { + return Err(serde::de::Error::duplicate_field("tokenUris")); + } + token_uris__ = Some(map.next_value()?); + } + GeneratedField::TokenData => { + if token_data__.is_some() { + return Err(serde::de::Error::duplicate_field("tokenData")); + } + token_data__ = Some(map.next_value()?); + } + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map.next_value()?); + } + GeneratedField::Receiver => { + if receiver__.is_some() { + return Err(serde::de::Error::duplicate_field("receiver")); + } + receiver__ = Some(map.next_value()?); + } + GeneratedField::Memo => { + if memo__.is_some() { + return Err(serde::de::Error::duplicate_field("memo")); + } + memo__ = Some(map.next_value()?); + } + } + } + Ok(NonFungibleTokenPacketData { + class_id: class_id__.unwrap_or_default(), + class_uri: class_uri__.unwrap_or_default(), + class_data: class_data__.unwrap_or_default(), + token_ids: token_ids__.unwrap_or_default(), + token_uris: token_uris__.unwrap_or_default(), + token_data: token_data__.unwrap_or_default(), + sender: sender__.unwrap_or_default(), + receiver: receiver__.unwrap_or_default(), + memo: memo__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.NonFungibleTokenPacketData", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.Params", len)?; + if true { + struct_ser.serialize_field("sendEnabled", &self.send_enabled)?; + } + if true { + struct_ser.serialize_field("receiveEnabled", &self.receive_enabled)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "send_enabled", + "sendEnabled", + "receive_enabled", + "receiveEnabled", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SendEnabled, + ReceiveEnabled, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "sendEnabled" | "send_enabled" => Ok(GeneratedField::SendEnabled), + "receiveEnabled" | "receive_enabled" => Ok(GeneratedField::ReceiveEnabled), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.Params") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut send_enabled__ = None; + let mut receive_enabled__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::SendEnabled => { + if send_enabled__.is_some() { + return Err(serde::de::Error::duplicate_field("sendEnabled")); + } + send_enabled__ = Some(map.next_value()?); + } + GeneratedField::ReceiveEnabled => { + if receive_enabled__.is_some() { + return Err(serde::de::Error::duplicate_field("receiveEnabled")); + } + receive_enabled__ = Some(map.next_value()?); + } + } + } + Ok(Params { + send_enabled: send_enabled__.unwrap_or_default(), + receive_enabled: receive_enabled__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.Params", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryClassHashRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryClassHashRequest", len)?; + if true { + struct_ser.serialize_field("trace", &self.trace)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryClassHashRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "trace", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Trace, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "trace" => Ok(GeneratedField::Trace), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassHashRequest; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryClassHashRequest") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut trace__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Trace => { + if trace__.is_some() { + return Err(serde::de::Error::duplicate_field("trace")); + } + trace__ = Some(map.next_value()?); + } + } + } + Ok(QueryClassHashRequest { + trace: trace__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryClassHashRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryClassHashResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryClassHashResponse", len)?; + if true { + struct_ser.serialize_field("hash", &self.hash)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryClassHashResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "hash", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Hash, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "hash" => Ok(GeneratedField::Hash), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassHashResponse; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryClassHashResponse") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut hash__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Hash => { + if hash__.is_some() { + return Err(serde::de::Error::duplicate_field("hash")); + } + hash__ = Some(map.next_value()?); + } + } + } + Ok(QueryClassHashResponse { + hash: hash__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryClassHashResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryClassTraceRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryClassTraceRequest", len)?; + if true { + struct_ser.serialize_field("hash", &self.hash)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryClassTraceRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "hash", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Hash, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "hash" => Ok(GeneratedField::Hash), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassTraceRequest; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryClassTraceRequest") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut hash__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Hash => { + if hash__.is_some() { + return Err(serde::de::Error::duplicate_field("hash")); + } + hash__ = Some(map.next_value()?); + } + } + } + Ok(QueryClassTraceRequest { + hash: hash__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryClassTraceRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryClassTraceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryClassTraceResponse", len)?; + if let Some(v) = self.class_trace.as_ref() { + struct_ser.serialize_field("classTrace", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryClassTraceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "class_trace", + "classTrace", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassTrace, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "classTrace" | "class_trace" => Ok(GeneratedField::ClassTrace), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassTraceResponse; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryClassTraceResponse") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_trace__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::ClassTrace => { + if class_trace__.is_some() { + return Err(serde::de::Error::duplicate_field("classTrace")); + } + class_trace__ = map.next_value()?; + } + } + } + Ok(QueryClassTraceResponse { + class_trace: class_trace__, + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryClassTraceResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryClassTracesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryClassTracesRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryClassTracesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassTracesRequest; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryClassTracesRequest") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map.next_value()?; + } + } + } + Ok(QueryClassTracesRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryClassTracesRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryClassTracesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryClassTracesResponse", len)?; + if true { + struct_ser.serialize_field("classTraces", &self.class_traces)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryClassTracesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "class_traces", + "classTraces", + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassTraces, + Pagination, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "classTraces" | "class_traces" => Ok(GeneratedField::ClassTraces), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassTracesResponse; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryClassTracesResponse") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_traces__ = None; + let mut pagination__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::ClassTraces => { + if class_traces__.is_some() { + return Err(serde::de::Error::duplicate_field("classTraces")); + } + class_traces__ = Some(map.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map.next_value()?; + } + } + } + Ok(QueryClassTracesResponse { + class_traces: class_traces__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryClassTracesResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryEscrowAddressRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryEscrowAddressRequest", len)?; + if true { + struct_ser.serialize_field("portId", &self.port_id)?; + } + if true { + struct_ser.serialize_field("channelId", &self.channel_id)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryEscrowAddressRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "port_id", + "portId", + "channel_id", + "channelId", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + PortId, + ChannelId, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "portId" | "port_id" => Ok(GeneratedField::PortId), + "channelId" | "channel_id" => Ok(GeneratedField::ChannelId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryEscrowAddressRequest; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryEscrowAddressRequest") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut port_id__ = None; + let mut channel_id__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::PortId => { + if port_id__.is_some() { + return Err(serde::de::Error::duplicate_field("portId")); + } + port_id__ = Some(map.next_value()?); + } + GeneratedField::ChannelId => { + if channel_id__.is_some() { + return Err(serde::de::Error::duplicate_field("channelId")); + } + channel_id__ = Some(map.next_value()?); + } + } + } + Ok(QueryEscrowAddressRequest { + port_id: port_id__.unwrap_or_default(), + channel_id: channel_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryEscrowAddressRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryEscrowAddressResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryEscrowAddressResponse", len)?; + if true { + struct_ser.serialize_field("escrowAddress", &self.escrow_address)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryEscrowAddressResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "escrow_address", + "escrowAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + EscrowAddress, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "escrowAddress" | "escrow_address" => Ok(GeneratedField::EscrowAddress), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryEscrowAddressResponse; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryEscrowAddressResponse") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut escrow_address__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::EscrowAddress => { + if escrow_address__.is_some() { + return Err(serde::de::Error::duplicate_field("escrowAddress")); + } + escrow_address__ = Some(map.next_value()?); + } + } + } + Ok(QueryEscrowAddressResponse { + escrow_address: escrow_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryEscrowAddressResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryParamsRequest") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map.next_key::()?.is_some() { + let _ = map.next_value::()?; + } + Ok(QueryParamsRequest { + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryParamsRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("ibc.applications.nft_transfer.v1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "params", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct ibc.applications.nft_transfer.v1.QueryParamsResponse") + } + + fn visit_map(self, mut map: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map.next_value()?; + } + } + } + Ok(QueryParamsResponse { + params: params__, + }) + } + } + deserializer.deserialize_struct("ibc.applications.nft_transfer.v1.QueryParamsResponse", FIELDS, GeneratedVisitor) + } +} diff --git a/src/prost/proto_descriptor.bin b/src/prost/proto_descriptor.bin index 4b581654..ae805c55 100644 Binary files a/src/prost/proto_descriptor.bin and b/src/prost/proto_descriptor.bin differ diff --git a/tools/proto-compiler/src/cmd/clone.rs b/tools/proto-compiler/src/cmd/clone.rs index 79dbaa03..b7c742f2 100644 --- a/tools/proto-compiler/src/cmd/clone.rs +++ b/tools/proto-compiler/src/cmd/clone.rs @@ -24,6 +24,10 @@ pub struct CloneCmd { #[argh(option, short = 's')] ics_commit: Option, + /// commit to checkout for the nft-transfer repo + #[argh(option, short = 'n')] + nft_commit: Option, + /// where to checkout the repository #[argh(option, short = 'o')] out: PathBuf, @@ -32,6 +36,7 @@ pub struct CloneCmd { pub const COSMOS_SDK_URL: &str = "https://github.com/cosmos/cosmos-sdk"; pub const IBC_GO_URL: &str = "https://github.com/cosmos/ibc-go"; pub const ICS_URL: &str = "https://github.com/cosmos/interchain-security"; +pub const NFT_TRANSFER_URL: &str = "https://github.com/bianjieai/nft-transfer"; impl CloneCmd { pub fn validate(&self) { @@ -59,6 +64,12 @@ impl CloneCmd { ics_path } + pub fn nft_subdir(&self) -> PathBuf { + let mut nft_path = self.out.clone(); + nft_path.push("nft/"); + nft_path + } + pub fn run(&self) { self.validate(); @@ -164,6 +175,42 @@ impl CloneCmd { println!("[info ] No `-i`/`--ics_commit` option passed. Skipping the ICS repo.") } } + + match &self.nft_commit { + Some(nft_commit) => { + let nft_path = self.nft_subdir(); + let nft_repo = if nft_path.exists() { + println!( + "[info ] Found nft-transfer source at '{}'", + nft_path.display() + ); + + Repository::open(&nft_path).unwrap_or_else(|e| { + println!("[error] Failed to open repository: {}", e); + process::exit(1) + }) + } else { + Repository::clone(NFT_TRANSFER_URL, &nft_path).unwrap_or_else(|e| { + println!("[error] Failed to clone the nft-transfer repository: {}", e); + process::exit(1) + }) + }; + + println!("[info ] Cloned at '{}'", nft_path.display()); + checkout_commit(&nft_repo, nft_commit).unwrap_or_else(|e| { + println!( + "[error] Failed to checkout nft-transfer commit {}: {}", + nft_commit, e + ); + process::exit(1) + }); + } + None => { + println!( + "[info ] No `-n`/`--nft-commit` option passed. Skipping the nft-transfer repo." + ) + } + } } } diff --git a/tools/proto-compiler/src/cmd/compile.rs b/tools/proto-compiler/src/cmd/compile.rs index 41fcb0f8..4e021e14 100644 --- a/tools/proto-compiler/src/cmd/compile.rs +++ b/tools/proto-compiler/src/cmd/compile.rs @@ -21,6 +21,10 @@ pub struct CompileCmd { /// path to the Cosmos ICS proto files ics: PathBuf, + #[argh(option, short = 'n')] + /// path to the nft-transfer proto files + nft: PathBuf, + #[argh(option, short = 'o')] /// path to output the generated Rust sources into out: PathBuf, @@ -32,6 +36,7 @@ impl CompileCmd { self.ibc.as_ref(), self.sdk.as_ref(), self.ics.as_ref(), + self.nft.as_ref(), self.out.as_ref(), ) .unwrap_or_else(|e| { @@ -56,6 +61,7 @@ impl CompileCmd { ibc_dir: &Path, sdk_dir: &Path, ics_dir: &Path, + nft_dir: &Path, out_dir: &Path, ) -> Result<(), Box> { println!( @@ -82,12 +88,14 @@ impl CompileCmd { format!("{}/interchain_security/ccv/v1", ics_dir.display()), format!("{}/interchain_security/ccv/provider", ics_dir.display()), format!("{}/interchain_security/ccv/consumer", ics_dir.display()), + format!("{}/ibc", nft_dir.display()), ]; let proto_includes_paths = [ format!("{}", sdk_dir.display()), format!("{}", ibc_dir.display()), format!("{}", ics_dir.display()), + format!("{}", nft_dir.display()), format!("{}/../../definitions/mock", root), format!("{}/../../definitions/ibc/lightclients/localhost/v1", root), format!("{}/../../definitions/stride/interchainquery/v1", root), @@ -229,6 +237,13 @@ impl CompileCmd { "The denomination trace `([port_id]/[channel_id])+/[denom]`", )], ), + ( + "ibc.applications.nft_transfer.v1.rs", + &[( + "The class trace (\\[port_id\\]/[channel_id])+/\\[denom\\]", + "The class trace `([port_id]/[channel_id])+/[class]`", + )], + ), ]; for (file, patches) in PATCHES {