Skip to content

Commit

Permalink
fix(ics-23): Auto-derive serde::Serialize for CommitmentPrefix (#…
Browse files Browse the repository at this point in the history
…1230)

* Auto-derive serde::Serialize for CommitmentPrefix

* Add changelog entry
  • Loading branch information
seanchen1991 committed May 21, 2024
1 parent 86a0ee0 commit 5873500
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [ics23] Auto-derive `serde::Serialize` for `CommitmentPrefix`.
([\#1229](https://github.com/cosmos/ibc-rs/issues/1229))
12 changes: 1 addition & 11 deletions ibc-core/ics23-commitment/types/src/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'a> TryFrom<&'a CommitmentProofBytes> for MerkleProof {
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct CommitmentPrefix {
Expand Down Expand Up @@ -183,13 +183,3 @@ impl fmt::Debug for CommitmentPrefix {
}
}
}

#[cfg(feature = "serde")]
impl serde::Serialize for CommitmentPrefix {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
format!("{self:?}").serialize(serializer)
}
}

0 comments on commit 5873500

Please sign in to comment.