feat(traverse): introduce small QoL improvements (#567)

This commit is contained in:
Santiago Carmuega 2024-12-29 15:17:08 -03:00 committed by GitHub
parent 21a92fc235
commit bd3120fabd
3 changed files with 16 additions and 4 deletions

View file

@ -53,6 +53,18 @@ impl<'b> MultiEraRedeemer<'b> {
}
}
pub fn into_conway_deprecated(&self) -> Option<conway::Redeemer> {
match self {
Self::AlonzoCompatible(_) => None,
Self::Conway(x, y) => Some(conway::Redeemer {
tag: x.tag,
index: x.index,
data: y.data.clone(),
ex_units: y.ex_units,
}),
}
}
pub fn from_alonzo_compatible(redeemer: &'b alonzo::Redeemer) -> Self {
Self::AlonzoCompatible(Box::new(Cow::Borrowed(redeemer)))
}