Skip to content

Commit

Permalink
rusk: fix ChainEvent conversion to RuesEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Aug 8, 2024
1 parent 9279da7 commit 55637f8
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions rusk/src/lib/http/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,26 +883,14 @@ impl From<execution_core::Event> for RuesEvent {
#[cfg(feature = "node")]
impl From<node_data::events::Event> for RuesEvent {
fn from(value: node_data::events::Event) -> Self {
Self {
subscription: RuesSubscription {
component: value.component.into(),
entity: Some(value.entity),
topic: value.topic.into(),
},
let data = value.data.map_or(DataType::None, |j| DataType::Json(j));
let subscription = RuesSubscription {
component: value.component.into(),
entity: Some(value.entity),
topic: value.topic.into(),
};

data: ResponseData::new(value.data),
}
}
}
#[cfg(feature = "node")]
impl From<node_data::events::EventData> for DataType {
fn from(value: node_data::events::EventData) -> Self {
match value {
node_data::events::EventData::Binary(b) => b.into(),
node_data::events::EventData::Json(j) => j.into(),
node_data::events::EventData::Text(t) => t.into(),
node_data::events::EventData::None => DataType::None,
}
Self { subscription, data }
}
}

Expand Down

0 comments on commit 55637f8

Please sign in to comment.