Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with Aiken 1.1.2 #29

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[package]
name = "aiken-jna-wrapper"
version = "0.5.0"
authors = ["satran004", "matiwinnetou"]
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

[lib]
crate-type = ["cdylib"]

[dependencies]
aiken = "1.0.19-alpha"
uplc = "1.0.19-alpha"
aiken-lang = "1.0.19-alpha"
uplc = "1.1.2"
aiken-lang = "1.1.2"

pallas-addresses = "0.18.2"
pallas-codec = "0.18.2"
pallas-crypto = "0.18.2"
pallas-primitives = "0.18.2"
pallas-traverse = "0.18.2"
pallas-addresses = "0.30.1"
pallas-codec = { version = "0.30.1", features = ["num-bigint"] }
pallas-crypto = "0.30.1"
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.95", features = ["derive"] }
serde_json = { version = "1.0.95" }
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"

2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
extern crate core;
extern crate serde;
extern crate anyhow;

mod transaction;

Expand Down
17 changes: 10 additions & 7 deletions src/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use pallas_primitives::babbage::CostMdls;
extern crate uplc;
extern crate pallas_primitives;

use pallas_primitives::conway::CostMdls;
use pallas_primitives::{
babbage::{TransactionInput, TransactionOutput},
conway::{TransactionInput, TransactionOutput},
Fragment,
};
use pallas_traverse::{Era, MultiEraTx};
Expand All @@ -23,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 @@ -51,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
Loading