@@ -5,6 +5,8 @@ use serde::Deserialize;
55
66use crate::framework::*;
77
8+ pub type CardanoRecord = cardano::Record;
9+
810#[derive(Stage)]
911#[stage(name = "filter-wasm", unit = "ChainEvent", worker = "Worker")]
1012pub struct Stage {
@@ -18,23 +20,20 @@ pub struct Stage {
1820}
1921
2022impl Stage {
21- fn map_record (&mut self, r: Record ) -> Result<Vec<Record>, Error> {
23+ fn map_cardano_record (&mut self, r: CardanoRecord ) -> Result<Vec<Record>, Error> {
2224 let extism::convert::Json::<serde_json::Value>(output) = match r {
23- Record ::CborBlock(x) => self.plugin.call("map_cbor_block", x).unwrap(),
24- Record ::CborTx(x) => self.plugin.call("map_cbor_tx", x).unwrap(),
25- Record ::ParsedTx(x) => self
25+ CardanoRecord ::CborBlock(x) => self.plugin.call("map_cbor_block", x).unwrap(),
26+ CardanoRecord ::CborTx(x) => self.plugin.call("map_cbor_tx", x).unwrap(),
27+ CardanoRecord ::ParsedTx(x) => self
2628 .plugin
2729 .call("map_u5c_tx", extism::convert::Json(x))
2830 .unwrap(),
29- Record ::ParsedBlock(x) => self
31+ CardanoRecord ::ParsedBlock(x) => self
3032 .plugin
3133 .call("map_u5c_block", extism::convert::Json(x))
3234 .unwrap(),
33- Record::GenericJson(x) => self
34- .plugin
35- .call("map_json", extism::convert::Json(x))
36- .unwrap(),
37- Record::OuraV1Event(x) => self
35+
36+ CardanoRecord::OuraV1Event(x) => self
3837 .plugin
3938 .call("map_json", extism::convert::Json(x))
4039 .unwrap(),
@@ -48,6 +47,13 @@ impl Stage {
4847
4948 Ok(output)
5049 }
50+
51+ fn map_record(&mut self, r: Record) -> Result<Vec<Record>, Error> {
52+ match r {
53+ Record::Cardano(x) => self.map_cardano_record(x),
54+ x => Ok(vec![x]),
55+ }
56+ }
5157}
5258
5359#[derive(Default)]
0 commit comments