Skip to content

Commit

Permalink
Update dependencies and migrate to Conway era transactions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
satran004 committed Sep 18, 2024
1 parent a01f422 commit a4356aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"] }
Expand All @@ -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"

14 changes: 7 additions & 7 deletions src/transaction.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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<u8> = hex::decode(inputs).map_err(|err| anyhow!(format!("HEX: {:?}", err)))?;
let outputs_bytes: Vec<u8> = hex::decode(outputs).map_err(|err| anyhow!(format!("HEX: {:?}", err)))?;
Expand All @@ -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),
Expand Down

0 comments on commit a4356aa

Please sign in to comment.