From a4356aa127542ef18f95faf1829614b0b462569a Mon Sep 17 00:00:00 2001 From: Satya Date: Wed, 18 Sep 2024 11:30:47 +0800 Subject: [PATCH] Update dependencies and migrate to Conway era transactions This commit updates several dependencies to their latest versions. Additionally, it migrates transaction handling from Babbage to Conway era, ensuring compatibility with the latest updates in the pallas_primitives crate. --- Cargo.toml | 15 ++++++++------- src/transaction.rs | 14 +++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cb69ad4..acd57ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "aiken-jna-wrapper" version = "0.6.0" +edition = "2021" authors = ["satran004", "matiwinnetou"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -10,8 +11,8 @@ crate-type = ["cdylib"] [dependencies] #aiken = "1.0.31-alpha" -uplc = "1.0.31-alpha" -aiken-lang = "1.0.31-alpha" +uplc = "1.1.2" +aiken-lang = "1.1.2" pallas-addresses = "0.30.1" pallas-codec = { version = "0.30.1", features = ["num-bigint"] } @@ -20,11 +21,11 @@ pallas-primitives = "0.30.1" pallas-traverse = "0.30.1" ffi-support = "0.4.4" -jni = "0.20.0" +jni = "0.21.1" hex = "0.4.3" -minicbor = "0.19.1" -serde = { version = "1.0.208", features = ["derive"] } -serde_json = { version = "1.0.127" } -anyhow = "1.0.75" +minicbor = "0.20.0" +serde = { version = "1.0.210", features = ["derive"] } +serde_json = { version = "1.0.128" } +anyhow = "1.0.89" diff --git a/src/transaction.rs b/src/transaction.rs index 31e7ce8..bf2ce65 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -1,9 +1,9 @@ extern crate uplc; extern crate pallas_primitives; -use pallas_primitives::babbage::CostMdls; +use pallas_primitives::conway::CostMdls; use pallas_primitives::{ - babbage::{TransactionInput, TransactionOutput}, + conway::{TransactionInput, TransactionOutput}, Fragment, }; use pallas_traverse::{Era, MultiEraTx}; @@ -26,9 +26,9 @@ pub fn eval_phase_two( let tx_bytes: &[u8] = tx_bytes.as_slice(); - let tx: MultiEraTx = MultiEraTx::decode(Era::Babbage, &tx_bytes) - .or_else(|_| MultiEraTx::decode(Era::Alonzo, &tx_bytes)) - .map_err(|err| anyhow!(format!("PALLAS: {:?}", err)))?; + let tx = MultiEraTx::decode_for_era(Era::Conway, tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, tx_bytes)) + .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, tx_bytes))?; let inputs_bytes: Vec = hex::decode(inputs).map_err(|err| anyhow!(format!("HEX: {:?}", err)))?; let outputs_bytes: Vec = hex::decode(outputs).map_err(|err| anyhow!(format!("HEX: {:?}", err)))?; @@ -54,9 +54,9 @@ pub fn eval_phase_two( let cost_mdls = CostMdls::decode_fragment(cost_mdls_bytes).map_err(|err| anyhow!(format!("PALLAS: {:?}", err)))?; - if let Some(tx_babbage) = tx.as_babbage() { + if let Some(tx_conway) = tx.as_conway() { let redeemers = tx::eval_phase_two( - tx_babbage, + tx_conway, &resolved_inputs, Some(&cost_mdls), Some(&ex_budget),