chore(utxorpc): update spec to v0.14 and update redeemer mapper (#559)

Co-authored-by: ricomiles <ricoquiblat@gmail.com>
This commit is contained in:
Santiago Carmuega 2024-12-14 16:16:42 -03:00 committed by GitHub
parent 2864ff45a9
commit 227b5781a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 1 deletions

View file

@ -1,5 +1,6 @@
use std::borrow::Cow;
use pallas_codec::minicbor;
use pallas_primitives::{alonzo, conway};
use crate::MultiEraRedeemer;
@ -78,4 +79,11 @@ impl<'b> MultiEraRedeemer<'b> {
})),
)
}
pub fn encode(&self) -> Vec<u8> {
match self {
MultiEraRedeemer::AlonzoCompatible(x) => minicbor::to_vec(x).unwrap(),
MultiEraRedeemer::Conway(k, v) => minicbor::to_vec((k, v)).unwrap(),
}
}
}

View file

@ -12,7 +12,7 @@ authors = ["Santiago Carmuega <santiago@carmuega.me>"]
[dependencies]
# utxorpc-spec = { path = "../../../utxorpc/spec/gen/rust" }
utxorpc-spec = { version = "0.11.0" }
utxorpc-spec = { version = "0.14.0" }
pallas-traverse = { version = "=0.31.0", path = "../pallas-traverse" }
pallas-primitives = { version = "=0.31.0", path = "../pallas-primitives" }

View file

@ -65,6 +65,12 @@ impl<C: LedgerContext> Mapper<C> {
u5c::Redeemer {
purpose: self.map_purpose(&x.tag()).into(),
payload: self.map_plutus_datum(x.data()).into(),
index: x.index().into(),
ex_units: Some(u5c::ExUnits {
steps: x.ex_units().steps,
memory: x.ex_units().mem,
}),
original_cbor: x.encode().into(),
}
}

View file

@ -22,6 +22,11 @@
"inputs": [
{
"redeemer": {
"exUnits": {
"memory": "2893153",
"steps": "1254988362"
},
"originalCbor": "hAAAGgAtxsCCGgAsJWEaSs2aSg==",
"payload": {
"bigInt": {
"int": "3000000"
@ -33,6 +38,12 @@
},
{
"redeemer": {
"exUnits": {
"memory": "29039",
"steps": "9759373"
},
"index": 1,
"originalCbor": "hAAB2HmAghlxbxoAlOqN",
"payload": {
"constr": {
"tag": 121
@ -45,6 +56,12 @@
{
"outputIndex": 2,
"redeemer": {
"exUnits": {
"memory": "23776",
"steps": "8949203"
},
"index": 2,
"originalCbor": "hAAC2HmAghlc4BoAiI3T",
"payload": {
"constr": {
"tag": 121
@ -1384,6 +1401,12 @@
},
{
"redeemer": {
"exUnits": {
"memory": "862260",
"steps": "283080173"
},
"index": 1,
"originalCbor": "hAAB2HmAghoADSg0GhDfde0=",
"payload": {
"constr": {
"tag": 121
@ -2018,6 +2041,12 @@
},
{
"redeemer": {
"exUnits": {
"memory": "312977",
"steps": "151500123"
},
"index": 1,
"originalCbor": "hAAB2HqfUCgL7p8Ifi1y1Y0n3fHPaAb/ghoABMaRGgkHtVs=",
"payload": {
"constr": {
"fields": [
@ -2043,6 +2072,11 @@
],
"policyId": "J5+ELDPu2QVLnjxwzWo7MimCWcJLeLiVy0HZGg==",
"redeemer": {
"exUnits": {
"memory": "56931",
"steps": "22622736"
},
"originalCbor": "hAEA2HmAghneYxoBWTIQ",
"payload": {
"constr": {
"tag": 121