Skip to content

Commit

Permalink
Fix add codec and borsh for Acknowledgement , Receipt and ModuleEvent (
Browse files Browse the repository at this point in the history
…#312)

* Add parity-scale-code and borsh for Acknowledgement and ModuleEvent

* Add .changelog

* Add parity-scale-code and borsh to Receipt
  • Loading branch information
DaviRain-Su authored Jan 3, 2023
1 parent b413836 commit c58cdf5
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add codec and borsh for ics04_channel::msgs::Acknowledgement and
events::ModuleEvent ([#303](https://github.com/cosmos/ibc-rs/issues/303))
12 changes: 12 additions & 0 deletions crates/ibc/src/core/ics04_channel/msgs/acknowledgement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ use crate::tx_msg::Msg;
pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgAcknowledgement";

/// A generic Acknowledgement type that modules may interpret as they like.
#[cfg_attr(
feature = "parity-scale-codec",
derive(
parity_scale_codec::Encode,
parity_scale_codec::Decode,
scale_info::TypeInfo
)
)]
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq, From, Into)]
pub struct Acknowledgement(Vec<u8>);

Expand Down
12 changes: 12 additions & 0 deletions crates/ibc/src/core/ics04_channel/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ pub enum PacketResult {
Timeout(TimeoutPacketResult),
}

#[cfg_attr(
feature = "parity-scale-codec",
derive(
parity_scale_codec::Encode,
parity_scale_codec::Decode,
scale_info::TypeInfo
)
)]
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[derive(Clone, Debug)]
pub enum Receipt {
Ok,
Expand Down
24 changes: 24 additions & 0 deletions crates/ibc/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,18 @@ impl IbcEvent {
}
}

#[cfg_attr(
feature = "parity-scale-codec",
derive(
parity_scale_codec::Encode,
parity_scale_codec::Decode,
scale_info::TypeInfo
)
)]
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
pub struct ModuleEvent {
pub kind: String,
Expand Down Expand Up @@ -304,6 +316,18 @@ impl From<ModuleEvent> for IbcEvent {
}
}

#[cfg_attr(
feature = "parity-scale-codec",
derive(
parity_scale_codec::Encode,
parity_scale_codec::Decode,
scale_info::TypeInfo
)
)]
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
pub struct ModuleEventAttribute {
pub key: String,
Expand Down

0 comments on commit c58cdf5

Please sign in to comment.