As discussed here, I had null values in the encoded NonFungibleTokenPacketData. We can opt-out them by #[serde(skip_serializing_if = "Option::is_none")].
@@ -14,9 +14,11 @@ pub struct NonFungibleTokenPacketData {
pub class_id: ClassId,
/// Optional URL that points to metadata about the
/// collection. Must be non-empty if provided.
+ #[serde(skip_serializing_if = "Option::is_none")]
pub class_uri: Option<String>,
/// Optional base64 encoded field which contains on-chain metadata
/// about the NFT class. Must be non-empty if provided.
+ #[serde(skip_serializing_if = "Option::is_none")]
pub class_data: Option<Binary>,
/// Uniquely identifies the tokens in the NFT collection being
/// transfered. This MUST be non-empty.
@@ -25,11 +27,13 @@ pub struct NonFungibleTokenPacketData {
/// transfered. `tokenUris[N]` should hold the metadata for
/// `tokenIds[N]` and both lists should have the same if
/// provided. Must be non-empty if provided.
+ #[serde(skip_serializing_if = "Option::is_none")]
pub token_uris: Option<Vec<String>>,
/// Optional base64 encoded metadata for the tokens being
/// transfered. `tokenData[N]` should hold metadata for
/// `tokenIds[N]` and both lists should have the same length if
/// provided. Must be non-empty if provided.
+ #[serde(skip_serializing_if = "Option::is_none")]
pub token_data: Option<Vec<Binary>>,
/// The address sending the tokens on the sending chain.
@@ -38,6 +42,7 @@ pub struct NonFungibleTokenPacketData {
/// chain.
pub receiver: String,
/// Memo to add custom string to the msg
+ #[serde(skip_serializing_if = "Option::is_none")]
pub memo: Option<String>,
}
As discussed here, I had null values in the encoded
NonFungibleTokenPacketData
. We can opt-out them by#[serde(skip_serializing_if = "Option::is_none")]
.