feat: centralize some Cargo.toml configs at root and upgrade to edition 2024

This commit is contained in:
rvcas 2025-03-23 21:06:13 -04:00 committed by Lucas
parent 5f9b5ac781
commit 824431371e
92 changed files with 440 additions and 426 deletions

View File

@ -2,6 +2,21 @@
members = ["crates/*"] members = ["crates/*"]
resolver = "2" resolver = "2"
[workspace.package]
description = "Cardano smart contract language and toolchain"
documentation = "https://aiken-lang.org"
version = "1.1.15"
edition = "2024"
repository = "https://github.com/aiken-lang/aiken"
homepage = "https://github.com/aiken-lang/aiken"
license = "Apache-2.0"
authors = [
"Lucas Rosa <x@rvcas.dev>",
"Kasey White <kwhitemsg@gmail.com>",
"KtorZ <matthias.benkort@gmail.com>",
]
rust-version = "1.85.0"
[workspace.metadata.release] [workspace.metadata.release]
shared-version = true shared-version = true
tag-name = "v{{version}}" tag-name = "v{{version}}"
@ -17,7 +32,12 @@ installers = ["shell", "powershell", "npm", "homebrew"]
# A GitHub repo to push Homebrew formulas to # A GitHub repo to push Homebrew formulas to
tap = "aiken-lang/homebrew-tap" tap = "aiken-lang/homebrew-tap"
# Target platforms to build apps for (Rust target-triple syntax) # Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"] targets = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-musl",
"x86_64-pc-windows-msvc",
]
# The archive format to use for windows builds (defaults .zip) # The archive format to use for windows builds (defaults .zip)
windows-archive = ".tar.gz" windows-archive = ".tar.gz"
# The archive format to use for non-windows builds (defaults .tar.xz) # The archive format to use for non-windows builds (defaults .tar.xz)

View File

@ -1,17 +1,15 @@
[package] [package]
name = "aiken-lang" name = "aiken-lang"
description = "The Aiken compiler" version.workspace = true
version = "1.1.15" edition.workspace = true
edition = "2021" description.workspace = true
repository = "https://github.com/aiken-lang/aiken" license.workspace = true
homepage = "https://github.com/aiken-lang/aiken" authors.workspace = true
license = "Apache-2.0" repository.workspace = true
authors = [ homepage.workspace = true
"Lucas Rosa <x@rvcas.dev>", documentation.workspace = true
"Kasey White <kwhitemsg@gmail.com>", rust-version.workspace = true
"KtorZ <matthias.benkort@gmail.com>",
]
rust-version = "1.80.0"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]

View File

@ -17,7 +17,7 @@ use std::{
rc::Rc, rc::Rc,
}; };
use uplc::machine::runtime::Compressable; use uplc::machine::runtime::Compressable;
use vec1::{vec1, Vec1}; use vec1::{Vec1, vec1};
pub const BACKPASS_VARIABLE: &str = "_backpass"; pub const BACKPASS_VARIABLE: &str = "_backpass";
pub const CAPTURE_VARIABLE: &str = "_capture"; pub const CAPTURE_VARIABLE: &str = "_capture";
@ -956,7 +956,7 @@ pub struct CallArg<A> {
impl CallArg<UntypedExpr> { impl CallArg<UntypedExpr> {
pub fn is_capture_hole(&self) -> bool { pub fn is_capture_hole(&self) -> bool {
match &self.value { match &self.value {
UntypedExpr::Var { ref name, .. } => name.contains(CAPTURE_VARIABLE), UntypedExpr::Var { name, .. } => name.contains(CAPTURE_VARIABLE),
_ => false, _ => false,
} }
} }

View File

@ -1,16 +1,15 @@
use crate::{ use crate::{
aiken_fn, IdGenerator, aiken_fn,
ast::{ ast::{
well_known, Annotation, ArgName, CallArg, DataType, DataTypeKey, Function, Annotation, ArgName, CallArg, DataType, DataTypeKey, Function, FunctionAccessKey,
FunctionAccessKey, ModuleKind, OnTestFailure, RecordConstructor, RecordConstructorArg, ModuleKind, OnTestFailure, RecordConstructor, RecordConstructorArg, Span, TypedArg,
Span, TypedArg, TypedDataType, TypedFunction, UnOp, TypedDataType, TypedFunction, UnOp, well_known,
}, },
expr::TypedExpr, expr::TypedExpr,
tipo::{ tipo::{
fields::FieldMap, Type, TypeConstructor, TypeInfo, ValueConstructor, Type, TypeConstructor, TypeInfo, ValueConstructor, ValueConstructorVariant,
ValueConstructorVariant, fields::FieldMap,
}, },
IdGenerator,
}; };
use std::{collections::BTreeSet, sync::LazyLock}; use std::{collections::BTreeSet, sync::LazyLock};

View File

@ -9,17 +9,17 @@ pub(crate) use crate::{
}, },
parser::token::Base, parser::token::Base,
tipo::{ tipo::{
check_replaceable_opaque_type, convert_opaque_type, lookup_data_type_by_tipo,
ModuleValueConstructor, Type, TypeVar, ValueConstructor, ValueConstructorVariant, ModuleValueConstructor, Type, TypeVar, ValueConstructor, ValueConstructorVariant,
check_replaceable_opaque_type, convert_opaque_type, lookup_data_type_by_tipo,
}, },
}; };
use indexmap::IndexMap; use indexmap::IndexMap;
use pallas_primitives::alonzo::{Constr, PlutusData}; use pallas_primitives::alonzo::{Constr, PlutusData};
use std::{fmt::Debug, rc::Rc}; use std::{fmt::Debug, rc::Rc};
use uplc::{ use uplc::{
KeyValuePairs,
ast::Data, ast::Data,
machine::{runtime::convert_tag_to_constr, value::from_pallas_bigint}, machine::{runtime::convert_tag_to_constr, value::from_pallas_bigint},
KeyValuePairs,
}; };
use vec1::Vec1; use vec1::Vec1;
@ -1219,31 +1219,23 @@ impl UntypedExpr {
name: constructor.name.to_string(), name: constructor.name.to_string(),
}) })
} else { } else {
let arguments = let arguments = fields
fields .to_vec()
.to_vec() .into_iter()
.into_iter() .zip(constructor.arguments.iter())
.zip(constructor.arguments.iter()) .map(|(field, RecordConstructorArg { label, tipo, .. })| {
.map( UntypedExpr::do_reify_data(
|( generics, data_types, field, tipo,
field,
RecordConstructorArg {
ref label,
ref tipo,
..
},
)| {
UntypedExpr::do_reify_data(
generics, data_types, field, tipo,
)
.map(|value| CallArg {
label: label.clone(),
location: Span::empty(),
value,
})
},
) )
.collect::<Result<Vec<_>, _>>()?; .map(|value| {
CallArg {
label: label.clone(),
location: Span::empty(),
value,
}
})
})
.collect::<Result<Vec<_>, _>>()?;
Ok(UntypedExpr::Call { Ok(UntypedExpr::Call {
location: Span::empty(), location: Span::empty(),

View File

@ -1,20 +1,20 @@
use crate::{ use crate::{
ast::{ ast::{
Annotation, ArgBy, ArgName, ArgVia, AssignmentKind, AssignmentPattern, BinOp, Annotation, ArgBy, ArgName, ArgVia, AssignmentKind, AssignmentPattern, BinOp,
ByteArrayFormatPreference, CallArg, CurveType, DataType, Definition, Function, ByteArrayFormatPreference, CAPTURE_VARIABLE, CallArg, CurveType, DataType, Definition,
LogicalOpChainKind, ModuleConstant, Namespace, OnTestFailure, Pattern, RecordConstructor, Function, LogicalOpChainKind, ModuleConstant, Namespace, OnTestFailure, Pattern,
RecordConstructorArg, RecordUpdateSpread, Span, TraceKind, TypeAlias, TypedArg, RecordConstructor, RecordConstructorArg, RecordUpdateSpread, Span, TraceKind, TypeAlias,
TypedValidator, UnOp, UnqualifiedImport, UntypedArg, UntypedArgVia, UntypedAssignmentKind, TypedArg, TypedValidator, UnOp, UnqualifiedImport, UntypedArg, UntypedArgVia,
UntypedClause, UntypedDefinition, UntypedFunction, UntypedIfBranch, UntypedModule, UntypedAssignmentKind, UntypedClause, UntypedDefinition, UntypedFunction, UntypedIfBranch,
UntypedPattern, UntypedRecordUpdateArg, Use, Validator, CAPTURE_VARIABLE, UntypedModule, UntypedPattern, UntypedRecordUpdateArg, Use, Validator,
}, },
docvec, docvec,
expr::{FnStyle, TypedExpr, UntypedExpr, DEFAULT_ERROR_STR, DEFAULT_TODO_STR}, expr::{DEFAULT_ERROR_STR, DEFAULT_TODO_STR, FnStyle, TypedExpr, UntypedExpr},
parser::{ parser::{
extra::{Comment, ModuleExtra}, extra::{Comment, ModuleExtra},
token::Base, token::Base,
}, },
pretty::{break_, concat, flex_break, join, line, lines, nil, Document, Documentable}, pretty::{Document, Documentable, break_, concat, flex_break, join, line, lines, nil},
tipo::{self, Type}, tipo::{self, Type},
}; };
use itertools::Itertools; use itertools::Itertools;
@ -84,7 +84,10 @@ impl<'comments> Formatter<'comments> {
// Pop comments that occur before a byte-index in the source, consuming // Pop comments that occur before a byte-index in the source, consuming
// and retaining any empty lines contained within. // and retaining any empty lines contained within.
fn pop_comments(&mut self, limit: usize) -> impl Iterator<Item = Option<&'comments str>> { fn pop_comments(
&mut self,
limit: usize,
) -> impl Iterator<Item = Option<&'comments str>> + use<'comments> {
let (popped, rest, empty_lines) = let (popped, rest, empty_lines) =
comments_before(self.comments, self.empty_lines, limit, true); comments_before(self.comments, self.empty_lines, limit, true);
@ -2130,11 +2133,7 @@ impl<'a> Documentable<'a> for &'a ArgName {
} }
fn pub_(public: bool) -> Document<'static> { fn pub_(public: bool) -> Document<'static> {
if public { if public { "pub ".to_doc() } else { nil() }
"pub ".to_doc()
} else {
nil()
}
} }
impl<'a> Documentable<'a> for &'a UnqualifiedImport { impl<'a> Documentable<'a> for &'a UnqualifiedImport {

View File

@ -8,13 +8,14 @@ pub mod tree;
use self::{ use self::{
air::Air, air::Air,
builder::{ builder::{
AssignmentProperties, CodeGenSpecialFuncs, CycleFunctionNames, HoistableFunction, Variant,
cast_validator_args, convert_type_to_data, extract_constant, modify_cyclic_calls, cast_validator_args, convert_type_to_data, extract_constant, modify_cyclic_calls,
modify_self_calls, AssignmentProperties, CodeGenSpecialFuncs, CycleFunctionNames, modify_self_calls,
HoistableFunction, Variant,
}, },
tree::{AirTree, TreePath}, tree::{AirTree, TreePath},
}; };
use crate::{ use crate::{
IdGenerator,
ast::{ ast::{
AssignmentKind, BinOp, Bls12_381Point, Curve, DataTypeKey, FunctionAccessKey, Pattern, AssignmentKind, BinOp, Bls12_381Point, Curve, DataTypeKey, FunctionAccessKey, Pattern,
Span, TraceLevel, Tracing, TypedArg, TypedDataType, TypedFunction, TypedPattern, Span, TraceLevel, Tracing, TypedArg, TypedDataType, TypedFunction, TypedPattern,
@ -25,30 +26,29 @@ use crate::{
gen_uplc::{ gen_uplc::{
air::ExpectLevel, air::ExpectLevel,
builder::{ builder::{
erase_opaque_type_operations, get_generic_variant_name, get_line_columns_by_span, CodeGenFunction, erase_opaque_type_operations, get_generic_variant_name,
get_src_code_by_span, known_data_to_type, monomorphize, wrap_validator_condition, get_line_columns_by_span, get_src_code_by_span, known_data_to_type, monomorphize,
CodeGenFunction, wrap_validator_condition,
}, },
}, },
line_numbers::LineNumbers, line_numbers::LineNumbers,
plutus_version::PlutusVersion, plutus_version::PlutusVersion,
tipo::{ tipo::{
check_replaceable_opaque_type, convert_opaque_type, find_and_replace_generics,
get_arg_type_name, get_generic_id_and_type, lookup_data_type_by_tipo,
ModuleValueConstructor, PatternConstructor, Type, TypeInfo, ValueConstructor, ModuleValueConstructor, PatternConstructor, Type, TypeInfo, ValueConstructor,
ValueConstructorVariant, ValueConstructorVariant, check_replaceable_opaque_type, convert_opaque_type,
find_and_replace_generics, get_arg_type_name, get_generic_id_and_type,
lookup_data_type_by_tipo,
}, },
IdGenerator,
}; };
use builder::{ use builder::{
introduce_name, introduce_pattern, pop_pattern, softcast_data_to_type_otherwise, DISCARDED, introduce_name, introduce_pattern, pop_pattern, softcast_data_to_type_otherwise,
unknown_data_to_type, DISCARDED, unknown_data_to_type,
}; };
use decision_tree::{get_tipo_by_path, Assigned, CaseTest, DecisionTree, TreeGen}; use decision_tree::{Assigned, CaseTest, DecisionTree, TreeGen, get_tipo_by_path};
use indexmap::IndexMap; use indexmap::IndexMap;
use interner::AirInterner; use interner::AirInterner;
use itertools::Itertools; use itertools::Itertools;
use petgraph::{algo, Graph}; use petgraph::{Graph, algo};
use std::{collections::HashMap, rc::Rc}; use std::{collections::HashMap, rc::Rc};
use stick_break_set::{Builtins, TreeSet}; use stick_break_set::{Builtins, TreeSet};
use tree::Fields; use tree::Fields;
@ -2451,7 +2451,7 @@ impl<'a> CodeGenerator<'a> {
let last_clause = if data_type let last_clause = if data_type
.as_ref() .as_ref()
.map_or(true, |d| d.constructors.len() != cases.len()) .is_none_or(|d| d.constructors.len() != cases.len())
{ {
*default.unwrap() *default.unwrap()
} else { } else {

View File

@ -10,19 +10,19 @@ use crate::{
}, },
line_numbers::{LineColumn, LineNumbers}, line_numbers::{LineColumn, LineNumbers},
tipo::{ tipo::{
check_replaceable_opaque_type, convert_opaque_type, find_and_replace_generics, Type, Type, ValueConstructor, ValueConstructorVariant, check_replaceable_opaque_type,
ValueConstructor, ValueConstructorVariant, convert_opaque_type, find_and_replace_generics,
}, },
}; };
use indexmap::IndexMap; use indexmap::IndexMap;
use itertools::{Itertools, Position}; use itertools::{Itertools, Position};
use std::{ops::Deref, rc::Rc}; use std::{ops::Deref, rc::Rc};
use uplc::{ use uplc::{
KeyValuePairs, PlutusData,
ast::{Constant as UplcConstant, Data, Name, Term, Type as UplcType}, ast::{Constant as UplcConstant, Data, Name, Term, Type as UplcType},
builder::{CONSTR_FIELDS_EXPOSER, CONSTR_INDEX_EXPOSER}, builder::{CONSTR_FIELDS_EXPOSER, CONSTR_INDEX_EXPOSER},
builtins::DefaultFunction, builtins::DefaultFunction,
machine::{runtime::Compressable, value::to_pallas_bigint}, machine::{runtime::Compressable, value::to_pallas_bigint},
KeyValuePairs, PlutusData,
}; };
pub type Variant = String; pub type Variant = String;

View File

@ -7,7 +7,7 @@ use itertools::{Either, Itertools, Position};
use crate::{ use crate::{
ast::{DataTypeKey, Pattern, TypedClause, TypedDataType, TypedPattern}, ast::{DataTypeKey, Pattern, TypedClause, TypedDataType, TypedPattern},
expr::{lookup_data_type_by_tipo, Type, TypeVar, TypedExpr}, expr::{Type, TypeVar, TypedExpr, lookup_data_type_by_tipo},
}; };
use super::{interner::AirInterner, tree::AirTree}; use super::{interner::AirInterner, tree::AirTree};
@ -726,10 +726,12 @@ impl<'a, 'b> TreeGen<'a, 'b> {
// First step make sure all rows have same number of columns // First step make sure all rows have same number of columns
// or something went wrong // or something went wrong
assert!(matrix assert!(
.rows matrix
.iter() .rows
.all(|row| { row.columns.len() == column_length })); .iter()
.all(|row| { row.columns.len() == column_length })
);
// Find which column has the most important pattern // Find which column has the most important pattern
let occurrence_col = highest_occurrence(&matrix, column_length); let occurrence_col = highest_occurrence(&matrix, column_length);
@ -1367,6 +1369,7 @@ mod tester {
use indexmap::IndexMap; use indexmap::IndexMap;
use crate::{ use crate::{
IdGenerator,
ast::{ ast::{
Definition, ModuleKind, Span, TraceLevel, Tracing, TypedModule, TypedPattern, Definition, ModuleKind, Span, TraceLevel, Tracing, TypedModule, TypedPattern,
UntypedModule, UntypedModule,
@ -1376,7 +1379,7 @@ mod tester {
gen_uplc::{decision_tree::TreeGen, interner::AirInterner}, gen_uplc::{decision_tree::TreeGen, interner::AirInterner},
parser, parser,
tipo::error::{Error, Warning}, tipo::error::{Error, Warning},
utils, IdGenerator, utils,
}; };
fn parse(source_code: &str) -> UntypedModule { fn parse(source_code: &str) -> UntypedModule {

View File

@ -1,6 +1,6 @@
use std::collections::HashMap; use std::collections::HashMap;
use vec1::{vec1, Vec1}; use vec1::{Vec1, vec1};
#[derive(Clone)] #[derive(Clone)]
pub struct AirInterner { pub struct AirInterner {

View File

@ -6,7 +6,7 @@ use uplc::{builder::CONSTR_FIELDS_EXPOSER, builtins::DefaultFunction};
use crate::expr::Type; use crate::expr::Type;
use super::{ use super::{
decision_tree::{get_tipo_by_path, CaseTest, Path}, decision_tree::{CaseTest, Path, get_tipo_by_path},
tree::AirTree, tree::AirTree,
}; };

View File

@ -1,6 +1,6 @@
use std::sync::{ use std::sync::{
atomic::{AtomicU64, Ordering},
Arc, Arc,
atomic::{AtomicU64, Ordering},
}; };
pub mod ast; pub mod ast;

View File

@ -2,7 +2,7 @@ use super::Chain;
use crate::{ use crate::{
ast::CallArg, ast::CallArg,
expr::UntypedExpr, expr::UntypedExpr,
parser::{token::Token, ParseError}, parser::{ParseError, token::Token},
}; };
use chumsky::prelude::*; use chumsky::prelude::*;

View File

@ -1,7 +1,7 @@
use super::Chain; use super::Chain;
use crate::{ use crate::{
ast::well_known, ast::well_known,
parser::{token::Token, ParseError}, parser::{ParseError, token::Token},
}; };
use chumsky::prelude::*; use chumsky::prelude::*;

View File

@ -1,7 +1,7 @@
use chumsky::prelude::*; use chumsky::prelude::*;
use super::Chain; use super::Chain;
use crate::parser::{token::Token, ParseError}; use crate::parser::{ParseError, token::Token};
pub(crate) fn parser() -> impl Parser<Token, Chain, Error = ParseError> { pub(crate) fn parser() -> impl Parser<Token, Chain, Error = ParseError> {
just(Token::Dot) just(Token::Dot)

View File

@ -84,8 +84,8 @@ pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError
) )
} }
fn labeled_constructor_type_args( fn labeled_constructor_type_args()
) -> impl Parser<Token, Vec<ast::RecordConstructorArg<()>>, Error = ParseError> { -> impl Parser<Token, Vec<ast::RecordConstructorArg<()>>, Error = ParseError> {
select! {Token::Name {name} => name} select! {Token::Name {name} => name}
.then_ignore(just(Token::Colon)) .then_ignore(just(Token::Colon))
.then(annotation()) .then(annotation())

View File

@ -4,7 +4,7 @@ use crate::{
expr::UntypedExpr, expr::UntypedExpr,
parser::{ parser::{
annotation, annotation,
chain::{call::parser as call, field_access, tuple_index::parser as tuple_index, Chain}, chain::{Chain, call::parser as call, field_access, tuple_index::parser as tuple_index},
error::ParseError, error::ParseError,
expr::{self, bytearray, int as uint, list, string, tuple, var}, expr::{self, bytearray, int as uint, list, string, tuple, var},
pattern, pattern,

View File

@ -9,7 +9,7 @@ use super::{
use crate::{ use crate::{
expr::UntypedExpr, expr::UntypedExpr,
parser::{ parser::{
chain::{call::parser as call, field_access, tuple_index::parser as tuple_index, Chain}, chain::{Chain, call::parser as call, field_access, tuple_index::parser as tuple_index},
error::ParseError, error::ParseError,
token::Token, token::Token,
}, },

View File

@ -1,5 +1,5 @@
use crate::{ use crate::{
ast::{well_known, TraceKind}, ast::{TraceKind, well_known},
expr::UntypedExpr, expr::UntypedExpr,
parser::{ parser::{
error::{ParseError, Pattern}, error::{ParseError, Pattern},

View File

@ -158,8 +158,8 @@ pub fn hex_string() -> impl Parser<
}) })
} }
pub fn utf8_string( pub fn utf8_string()
) -> impl Parser<Token, (ast::ByteArrayFormatPreference, Vec<u8>), Error = ParseError> { -> impl Parser<Token, (ast::ByteArrayFormatPreference, Vec<u8>), Error = ParseError> {
select! {Token::ByteString {value} => value.into_bytes() } select! {Token::ByteString {value} => value.into_bytes() }
.map(|token| (ast::ByteArrayFormatPreference::Utf8String, token)) .map(|token| (ast::ByteArrayFormatPreference::Utf8String, token))
} }

View File

@ -1,5 +1,5 @@
use crate::{ use crate::{
ast::{well_known, UntypedPattern}, ast::{UntypedPattern, well_known},
parser::{error::ParseError, token::Token}, parser::{error::ParseError, token::Token},
}; };
use chumsky::prelude::*; use chumsky::prelude::*;

View File

@ -4,7 +4,7 @@ use crate::{
format::Formatter, format::Formatter,
gen_uplc::CodeGenerator, gen_uplc::CodeGenerator,
plutus_version::PlutusVersion, plutus_version::PlutusVersion,
tipo::{convert_opaque_type, Type}, tipo::{Type, convert_opaque_type},
}; };
use cryptoxide::{blake2b::Blake2b, digest::Digest}; use cryptoxide::{blake2b::Blake2b, digest::Digest};
use indexmap::IndexMap; use indexmap::IndexMap;
@ -26,7 +26,7 @@ use uplc::{
ast::{Constant, Data, Name, NamedDeBruijn, Program, Term}, ast::{Constant, Data, Name, NamedDeBruijn, Program, Term},
machine::{cost_model::ExBudget, eval_result::EvalResult}, machine::{cost_model::ExBudget, eval_result::EvalResult},
}; };
use vec1::{vec1, Vec1}; use vec1::{Vec1, vec1};
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum RunnableKind { pub enum RunnableKind {
@ -531,7 +531,9 @@ impl Benchmark {
match prng.sample(&fuzzer) { match prng.sample(&fuzzer) {
Ok(None) => { Ok(None) => {
panic!("A seeded PRNG returned 'None' which indicates a sampler is ill-formed and implemented wrongly; please contact library's authors."); panic!(
"A seeded PRNG returned 'None' which indicates a sampler is ill-formed and implemented wrongly; please contact library's authors."
);
} }
Ok(Some((new_prng, value))) => { Ok(Some((new_prng, value))) => {
@ -689,8 +691,10 @@ impl Prng {
fn as_prng(cst: &PlutusData) -> Prng { fn as_prng(cst: &PlutusData) -> Prng {
if let PlutusData::Constr(Constr { tag, fields, .. }) = cst { if let PlutusData::Constr(Constr { tag, fields, .. }) = cst {
if *tag == 121 + Prng::SEEDED { if *tag == 121 + Prng::SEEDED {
if let [PlutusData::BoundedBytes(bytes), PlutusData::BoundedBytes(choices)] = if let [
&fields[..] PlutusData::BoundedBytes(bytes),
PlutusData::BoundedBytes(choices),
] = &fields[..]
{ {
return Prng::Seeded { return Prng::Seeded {
choices: choices.to_vec(), choices: choices.to_vec(),
@ -1124,21 +1128,17 @@ impl<U, T> TestResult<U, T> {
pub fn module(&self) -> &str { pub fn module(&self) -> &str {
match self { match self {
TestResult::UnitTestResult(UnitTestResult { ref test, .. }) => test.module.as_str(), TestResult::UnitTestResult(UnitTestResult { test, .. }) => test.module.as_str(),
TestResult::PropertyTestResult(PropertyTestResult { ref test, .. }) => { TestResult::PropertyTestResult(PropertyTestResult { test, .. }) => test.module.as_str(),
test.module.as_str() TestResult::BenchmarkResult(BenchmarkResult { bench, .. }) => bench.module.as_str(),
}
TestResult::BenchmarkResult(BenchmarkResult { ref bench, .. }) => bench.module.as_str(),
} }
} }
pub fn title(&self) -> &str { pub fn title(&self) -> &str {
match self { match self {
TestResult::UnitTestResult(UnitTestResult { ref test, .. }) => test.name.as_str(), TestResult::UnitTestResult(UnitTestResult { test, .. }) => test.name.as_str(),
TestResult::PropertyTestResult(PropertyTestResult { ref test, .. }) => { TestResult::PropertyTestResult(PropertyTestResult { test, .. }) => test.name.as_str(),
test.name.as_str() TestResult::BenchmarkResult(BenchmarkResult { bench, .. }) => bench.name.as_str(),
}
TestResult::BenchmarkResult(BenchmarkResult { ref bench, .. }) => bench.name.as_str(),
} }
} }
@ -1279,9 +1279,11 @@ impl TryFrom<TypedExpr> for Assertion<TypedExpr> {
final_else, final_else,
.. ..
} => { } => {
if let [IfBranch { if let [
condition, body, .. IfBranch {
}] = &branches[..] condition, body, ..
},
] = &branches[..]
{ {
let then_is_true = match body { let then_is_true = match body {
TypedExpr::Var { TypedExpr::Var {

View File

@ -1,4 +1,5 @@
use crate::{ use crate::{
IdGenerator,
ast::{ ast::{
Definition, ModuleKind, Pattern, TraceLevel, Tracing, TypedModule, UntypedModule, Definition, ModuleKind, Pattern, TraceLevel, Tracing, TypedModule, UntypedModule,
UntypedPattern, UntypedPattern,
@ -7,7 +8,6 @@ use crate::{
expr::{CallArg, Span, TypedExpr}, expr::{CallArg, Span, TypedExpr},
parser, parser,
tipo::error::{Error, UnifyErrorSituation, Warning}, tipo::error::{Error, UnifyErrorSituation, Warning},
IdGenerator,
}; };
use std::collections::HashMap; use std::collections::HashMap;
@ -43,7 +43,9 @@ fn check_module(
let mut warnings = vec![]; let mut warnings = vec![];
if module.name == DEFAULT_MODULE_NAME { if module.name == DEFAULT_MODULE_NAME {
panic!("passed extra modules with default name! Use 'parse_as' to define tests instead of 'parse'."); panic!(
"passed extra modules with default name! Use 'parse_as' to define tests instead of 'parse'."
);
} }
let typed_module = module let typed_module = module
@ -2976,7 +2978,7 @@ fn correct_span_for_backpassing_args() {
let (warnings, _ast) = check(parse(source_code)).unwrap(); let (warnings, _ast) = check(parse(source_code)).unwrap();
assert!( assert!(
matches!(&warnings[0], Warning::UnusedVariable { ref name, location } if name == "b" && location.start == 245 && location.end == 246) matches!(&warnings[0], Warning::UnusedVariable { name, location } if name == "b" && location.start == 245 && location.end == 246)
); );
} }
@ -3407,7 +3409,7 @@ fn side_effects() {
assert!(warnings.is_empty(), "no warnings: {warnings:#?}"); assert!(warnings.is_empty(), "no warnings: {warnings:#?}");
if let Some(Definition::Fn(ref foo)) = ast.definitions().last() { if let Some(Definition::Fn(foo)) = ast.definitions().last() {
if let TypedExpr::Sequence { if let TypedExpr::Sequence {
ref expressions, .. ref expressions, ..
} = foo.body } = foo.body

View File

@ -1,8 +1,8 @@
use self::{environment::Environment, pretty::Printer}; use self::{environment::Environment, pretty::Printer};
use crate::{ use crate::{
ast::{ ast::{
well_known, Annotation, DataType, DataTypeKey, DefinitionLocation, ModuleKind, Span, Annotation, DataType, DataTypeKey, DefinitionLocation, ModuleKind, Span, TypedDataType,
TypedDataType, well_known,
}, },
tipo::fields::FieldMap, tipo::fields::FieldMap,
}; };
@ -212,8 +212,8 @@ impl Type {
match self { match self {
Type::App { module, name, .. } => Some((module.to_string(), name.to_string())), Type::App { module, name, .. } => Some((module.to_string(), name.to_string())),
Type::Fn { .. } => None, Type::Fn { .. } => None,
Type::Var { ref tipo, .. } => match &*tipo.borrow() { Type::Var { tipo, .. } => match &*tipo.borrow() {
TypeVar::Link { ref tipo } => tipo.qualifier(), TypeVar::Link { tipo } => tipo.qualifier(),
_ => None, _ => None,
}, },
Type::Tuple { .. } => Some((String::new(), "Tuple".to_string())), Type::Tuple { .. } => Some((String::new(), "Tuple".to_string())),
@ -1109,11 +1109,13 @@ impl TypeVar {
Self::Link { tipo } => tipo.get_inner_types(), Self::Link { tipo } => tipo.get_inner_types(),
Self::Unbound { .. } => vec![], Self::Unbound { .. } => vec![],
var => { var => {
vec![Type::Var { vec![
tipo: RefCell::new(var.clone()).into(), Type::Var {
alias: None, tipo: RefCell::new(var.clone()).into(),
} alias: None,
.into()] }
.into(),
]
} }
} }
} }

View File

@ -1,19 +1,19 @@
use super::{ use super::{
error::{Error, Warning},
exhaustive::{simplify, Matrix, PatternStack},
hydrator::Hydrator,
AccessorsMap, RecordAccessor, Type, TypeConstructor, TypeInfo, TypeVar, ValueConstructor, AccessorsMap, RecordAccessor, Type, TypeConstructor, TypeInfo, TypeVar, ValueConstructor,
ValueConstructorVariant, ValueConstructorVariant,
error::{Error, Warning},
exhaustive::{Matrix, PatternStack, simplify},
hydrator::Hydrator,
}; };
use crate::{ use crate::{
IdGenerator,
ast::{ ast::{
self, Annotation, CallArg, DataType, Definition, Function, ModuleConstant, ModuleKind, self, Annotation, CallArg, DataType, Definition, Function, ModuleConstant, ModuleKind,
Namespace, RecordConstructor, RecordConstructorArg, Span, TypeAlias, TypedDefinition, Namespace, PIPE_VARIABLE, RecordConstructor, RecordConstructorArg, Span, TypeAlias,
TypedFunction, TypedPattern, TypedValidator, UnqualifiedImport, UntypedArg, TypedDefinition, TypedFunction, TypedPattern, TypedValidator, UnqualifiedImport,
UntypedDefinition, UntypedFunction, Use, Validator, PIPE_VARIABLE, UntypedArg, UntypedDefinition, UntypedFunction, Use, Validator,
}, },
tipo::{fields::FieldMap, TypeAliasAnnotation}, tipo::{TypeAliasAnnotation, fields::FieldMap},
IdGenerator,
}; };
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
@ -1157,7 +1157,7 @@ impl<'a> Environment<'a> {
let first_error = unknowns.first().cloned(); let first_error = unknowns.first().cloned();
unknowns.retain(|err| { unknowns.retain(|err| {
if let Error::UnknownType { ref name, .. } = err { if let Error::UnknownType { name, .. } = err {
!type_definitions.contains(&Some(name)) !type_definitions.contains(&Some(name))
} else { } else {
false false

View File

@ -1662,9 +1662,7 @@ pub enum Warning {
"I discovered an unused constructor: {}", "I discovered an unused constructor: {}",
name.if_supports_color(Stderr, |s| s.default_color()) name.if_supports_color(Stderr, |s| s.default_color())
)] )]
#[diagnostic(help( #[diagnostic(help("No big deal, but you might want to remove it to get rid of that warning."))]
"No big deal, but you might want to remove it to get rid of that warning."
))]
#[diagnostic(code("unused::constructor"))] #[diagnostic(code("unused::constructor"))]
UnusedConstructor { UnusedConstructor {
#[label("unused constructor")] #[label("unused constructor")]
@ -1676,9 +1674,7 @@ pub enum Warning {
"I discovered an unused imported module: {}", "I discovered an unused imported module: {}",
name.if_supports_color(Stderr, |s| s.default_color()), name.if_supports_color(Stderr, |s| s.default_color()),
)] )]
#[diagnostic(help( #[diagnostic(help("No big deal, but you might want to remove it to get rid of that warning."))]
"No big deal, but you might want to remove it to get rid of that warning."
))]
#[diagnostic(code("unused::import::module"))] #[diagnostic(code("unused::import::module"))]
UnusedImportedModule { UnusedImportedModule {
#[label("unused module")] #[label("unused module")]
@ -1690,9 +1686,7 @@ pub enum Warning {
"I discovered an unused imported value: {}", "I discovered an unused imported value: {}",
name.if_supports_color(Stderr, |s| s.default_color()), name.if_supports_color(Stderr, |s| s.default_color()),
)] )]
#[diagnostic(help( #[diagnostic(help("No big deal, but you might want to remove it to get rid of that warning."))]
"No big deal, but you might want to remove it to get rid of that warning."
))]
#[diagnostic(code("unused:import::value"))] #[diagnostic(code("unused:import::value"))]
UnusedImportedValueOrType { UnusedImportedValueOrType {
#[label("unused import")] #[label("unused import")]
@ -1867,7 +1861,9 @@ pub enum Warning {
}, },
#[error("I noticed a (compact) dynamic trace label which is not a string")] #[error("I noticed a (compact) dynamic trace label which is not a string")]
#[diagnostic(help("Compiling with a compact trace-level, you are probably expecting compact traces although here, the entire label will need to be serialise *at runtime* which will add a significant overhead.\n\nAs a reminder, trace arguments are fully ignored in compact tracing. Hence, you probably want to put a cute little label here and move the current trace as argument!"))] #[diagnostic(help(
"Compiling with a compact trace-level, you are probably expecting compact traces although here, the entire label will need to be serialise *at runtime* which will add a significant overhead.\n\nAs a reminder, trace arguments are fully ignored in compact tracing. Hence, you probably want to put a cute little label here and move the current trace as argument!"
))]
#[diagnostic(code("trace::label_is_not_string"))] #[diagnostic(code("trace::label_is_not_string"))]
#[diagnostic(url("https://aiken-lang.org/language-tour/troubleshooting#traces"))] #[diagnostic(url("https://aiken-lang.org/language-tour/troubleshooting#traces"))]
CompactTraceLabelIsNotstring { CompactTraceLabelIsNotstring {

View File

@ -1,6 +1,6 @@
use crate::{ use crate::{
ast, ast,
tipo::{self, environment::Environment, error::Error, Type}, tipo::{self, Type, environment::Environment, error::Error},
}; };
use itertools::Itertools; use itertools::Itertools;
use std::{collections::BTreeMap, iter, ops::Deref}; use std::{collections::BTreeMap, iter, ops::Deref};
@ -407,11 +407,7 @@ impl Pattern {
.filter_map(|(index, p)| { .filter_map(|(index, p)| {
if index == 1 { if index == 1 {
let tail = pretty_tail(p); let tail = pretty_tail(p);
if tail == "[]" { if tail == "[]" { None } else { Some(tail) }
None
} else {
Some(tail)
}
} else { } else {
Some(p.pretty()) Some(p.pretty())
} }

View File

@ -1,14 +1,15 @@
use super::{ use super::{
RecordAccessor, Type, ValueConstructor, ValueConstructorVariant,
environment::{ environment::{
assert_no_labeled_arguments, collapse_links, generalise, EntityKind, Environment, EntityKind, Environment, assert_no_labeled_arguments, collapse_links, generalise,
}, },
error::{Error, Warning}, error::{Error, Warning},
hydrator::Hydrator, hydrator::Hydrator,
pattern::PatternTyper, pattern::PatternTyper,
pipe::PipeTyper, pipe::PipeTyper,
RecordAccessor, Type, ValueConstructor, ValueConstructorVariant,
}; };
use crate::{ use crate::{
IdGenerator,
ast::{ ast::{
self, Annotation, ArgName, AssignmentKind, AssignmentPattern, BinOp, Bls12_381Point, self, Annotation, ArgName, AssignmentKind, AssignmentPattern, BinOp, Bls12_381Point,
ByteArrayFormatPreference, CallArg, Curve, Function, IfBranch, LogicalOpChainKind, ByteArrayFormatPreference, CallArg, Curve, Function, IfBranch, LogicalOpChainKind,
@ -17,14 +18,13 @@ use crate::{
TypedValidator, UnOp, UntypedArg, UntypedAssignmentKind, UntypedClause, UntypedFunction, TypedValidator, UnOp, UntypedArg, UntypedAssignmentKind, UntypedClause, UntypedFunction,
UntypedIfBranch, UntypedPattern, UntypedRecordUpdateArg, UntypedIfBranch, UntypedPattern, UntypedRecordUpdateArg,
}, },
builtins::{from_default_function, BUILTIN}, builtins::{BUILTIN, from_default_function},
expr::{FnStyle, TypedExpr, UntypedExpr}, expr::{FnStyle, TypedExpr, UntypedExpr},
format, format,
parser::token::Base, parser::token::Base,
tipo::{ tipo::{
fields::FieldMap, DefaultFunction, ModuleKind, PatternConstructor, TypeConstructor, TypeVar, DefaultFunction, ModuleKind, PatternConstructor, TypeConstructor, TypeVar, fields::FieldMap,
}, },
IdGenerator,
}; };
use std::{ use std::{
cmp::Ordering, cmp::Ordering,
@ -970,7 +970,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
location, location,
} => { } => {
if let UntypedExpr::Var { if let UntypedExpr::Var {
name: ref module, name: module,
location: module_location, location: module_location,
} = container.as_ref() } = container.as_ref()
{ {
@ -1091,7 +1091,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
container: ref type_container, container: ref type_container,
} if TypeConstructor::might_be(type_name) => { } if TypeConstructor::might_be(type_name) => {
if let UntypedExpr::Var { if let UntypedExpr::Var {
name: ref module_name, name: module_name,
location: module_location, location: module_location,
} = type_container.as_ref() } = type_container.as_ref()
{ {

View File

@ -1,7 +1,7 @@
use super::{ use super::{
Type, TypeConstructor,
environment::Environment, environment::Environment,
error::{Error, Warning}, error::{Error, Warning},
Type, TypeConstructor,
}; };
use crate::{ast::Annotation, tipo::Span}; use crate::{ast::Annotation, tipo::Span};
use std::{collections::HashMap, rc::Rc}; use std::{collections::HashMap, rc::Rc};

View File

@ -1,11 +1,12 @@
use super::{ use super::{
TypeInfo, ValueConstructor, ValueConstructorVariant,
environment::{EntityKind, Environment}, environment::{EntityKind, Environment},
error::{Error, UnifyErrorSituation, Warning}, error::{Error, UnifyErrorSituation, Warning},
expr::ExprTyper, expr::ExprTyper,
hydrator::Hydrator, hydrator::Hydrator,
TypeInfo, ValueConstructor, ValueConstructorVariant,
}; };
use crate::{ use crate::{
IdGenerator,
ast::{ ast::{
Annotation, ArgBy, ArgName, ArgVia, DataType, Definition, Function, ModuleConstant, Annotation, ArgBy, ArgName, ArgVia, DataType, Definition, Function, ModuleConstant,
ModuleKind, RecordConstructor, RecordConstructorArg, Tracing, TypeAlias, TypedArg, ModuleKind, RecordConstructor, RecordConstructorArg, Tracing, TypeAlias, TypedArg,
@ -14,8 +15,7 @@ use crate::{
}, },
expr::{TypedExpr, UntypedAssignmentKind, UntypedExpr}, expr::{TypedExpr, UntypedAssignmentKind, UntypedExpr},
parser::token::Token, parser::token::Token,
tipo::{expr::infer_function, Span, Type, TypeVar}, tipo::{Span, Type, TypeVar, expr::infer_function},
IdGenerator,
}; };
use std::{ use std::{
borrow::Borrow, borrow::Borrow,
@ -758,8 +758,8 @@ where
.get_mut(&f.name) .get_mut(&f.name)
.expect("Could not find preregistered type for test"); .expect("Could not find preregistered type for test");
if let Type::Fn { if let Type::Fn {
ref ret, ret,
ref alias, alias,
args: _, args: _,
} = scope.tipo.as_ref() } = scope.tipo.as_ref()
{ {

View File

@ -1,10 +1,10 @@
//! Type inference and checking of patterns used in case expressions //! Type inference and checking of patterns used in case expressions
//! and variables bindings. //! and variables bindings.
use super::{ use super::{
environment::{assert_no_labeled_arguments, collapse_links, EntityKind, Environment}, PatternConstructor, Type, ValueConstructorVariant,
environment::{EntityKind, Environment, assert_no_labeled_arguments, collapse_links},
error::{Error, Warning}, error::{Error, Warning},
hydrator::Hydrator, hydrator::Hydrator,
PatternConstructor, Type, ValueConstructorVariant,
}; };
use crate::ast::{CallArg, Namespace, Pattern, Span, TypedPattern, UntypedPattern}; use crate::ast::{CallArg, Namespace, Pattern, Span, TypedPattern, UntypedPattern};
use itertools::Itertools; use itertools::Itertools;

View File

@ -1,10 +1,10 @@
use super::{ use super::{
Type, ValueConstructor, ValueConstructorVariant,
error::{Error, UnifyErrorSituation}, error::{Error, UnifyErrorSituation},
expr::ExprTyper, expr::ExprTyper,
Type, ValueConstructor, ValueConstructorVariant,
}; };
use crate::{ use crate::{
ast::{AssignmentKind, CallArg, Pattern, Span, PIPE_VARIABLE}, ast::{AssignmentKind, CallArg, PIPE_VARIABLE, Pattern, Span},
expr::{TypedExpr, UntypedExpr}, expr::{TypedExpr, UntypedExpr},
}; };
use std::{ops::Deref, rc::Rc}; use std::{ops::Deref, rc::Rc};

View File

@ -136,7 +136,7 @@ impl Printer {
fn type_var_doc<'a>(&mut self, typ: &TypeVar) -> Document<'a> { fn type_var_doc<'a>(&mut self, typ: &TypeVar) -> Document<'a> {
match typ { match typ {
TypeVar::Link { tipo: ref typ, .. } => self.print(typ), TypeVar::Link { tipo: typ, .. } => self.print(typ),
TypeVar::Generic { id, .. } => self.generic_type_var(*id), TypeVar::Generic { id, .. } => self.generic_type_var(*id),
TypeVar::Unbound { .. } => "?".to_doc(), TypeVar::Unbound { .. } => "?".to_doc(),
} }

View File

@ -1,13 +1,14 @@
[package] [package]
name = "aiken-lsp" name = "aiken-lsp"
version = "1.1.15" version.workspace = true
edition = "2021" edition.workspace = true
description = "Cardano smart contract language and toolchain" description.workspace = true
repository = "https://github.com/aiken-lang/aiken" license.workspace = true
homepage = "https://github.com/aiken-lang/aiken" authors.workspace = true
license = "Apache-2.0" repository.workspace = true
authors = ["Lucas Rosa <x@rvcas.dev>"] homepage.workspace = true
rust-version = "1.70.0" documentation.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]
crossbeam-channel = "0.5.7" crossbeam-channel = "0.5.7"

View File

@ -238,7 +238,7 @@ fn unknown_identifier(
) -> Vec<AnnotatedEdit> { ) -> Vec<AnnotatedEdit> {
let mut edits = Vec::new(); let mut edits = Vec::new();
if let Some(serde_json::Value::String(ref var_name)) = data { if let Some(serde_json::Value::String(var_name)) = data {
for module in compiler.project.modules() { for module in compiler.project.modules() {
if module.ast.has_definition(var_name) { if module.ast.has_definition(var_name) {
if let Some(edit) = parsed_document.import(&module, Some(var_name)) { if let Some(edit) = parsed_document.import(&module, Some(var_name)) {
@ -263,7 +263,7 @@ fn unknown_constructor(
) -> Vec<AnnotatedEdit> { ) -> Vec<AnnotatedEdit> {
let mut edits = Vec::new(); let mut edits = Vec::new();
if let Some(serde_json::Value::String(ref constructor_name)) = data { if let Some(serde_json::Value::String(constructor_name)) = data {
for module in compiler.project.modules() { for module in compiler.project.modules() {
if module.ast.has_constructor(constructor_name) { if module.ast.has_constructor(constructor_name) {
if let Some(edit) = parsed_document.import(&module, Some(constructor_name)) { if let Some(edit) = parsed_document.import(&module, Some(constructor_name)) {
@ -316,7 +316,7 @@ fn unknown_module(
) -> Vec<AnnotatedEdit> { ) -> Vec<AnnotatedEdit> {
let mut edits = Vec::new(); let mut edits = Vec::new();
if let Some(serde_json::Value::String(ref module_name)) = data { if let Some(serde_json::Value::String(module_name)) = data {
for module in compiler.project.modules() { for module in compiler.project.modules() {
if module.name.ends_with(module_name) { if module.name.ends_with(module_name) {
if let Some(edit) = parsed_document.import(&module, None) { if let Some(edit) = parsed_document.import(&module, None) {
@ -336,7 +336,7 @@ fn unused_imports(
let mut edits = Vec::new(); let mut edits = Vec::new();
for data in datas.iter().rev().flatten() { for data in datas.iter().rev().flatten() {
if let serde_json::Value::String(ref args) = data { if let serde_json::Value::String(args) = data {
let args = args.split(',').collect::<Vec<&str>>(); let args = args.split(',').collect::<Vec<&str>>();
match args.as_slice() { match args.as_slice() {
&[is_qualified, start] => { &[is_qualified, start] => {
@ -362,7 +362,7 @@ fn unused_imports(
fn utf8_byte_array_is_hex_string(diagnostic: &lsp_types::Diagnostic) -> Vec<AnnotatedEdit> { fn utf8_byte_array_is_hex_string(diagnostic: &lsp_types::Diagnostic) -> Vec<AnnotatedEdit> {
let mut edits = Vec::new(); let mut edits = Vec::new();
if let Some(serde_json::Value::String(ref value)) = diagnostic.data.as_ref() { if let Some(serde_json::Value::String(value)) = diagnostic.data.as_ref() {
edits.push(AnnotatedEdit::SimpleEdit( edits.push(AnnotatedEdit::SimpleEdit(
"Prefix with #".to_string(), "Prefix with #".to_string(),
lsp_types::TextEdit { lsp_types::TextEdit {

View File

@ -5,8 +5,8 @@ use crate::{
quickfix, quickfix,
quickfix::Quickfix, quickfix::Quickfix,
utils::{ utils::{
path_to_uri, span_to_lsp_range, text_edit_replace, uri_to_module_name, COMPILING_PROGRESS_TOKEN, CREATE_COMPILING_PROGRESS_TOKEN, path_to_uri, span_to_lsp_range,
COMPILING_PROGRESS_TOKEN, CREATE_COMPILING_PROGRESS_TOKEN, text_edit_replace, uri_to_module_name,
}, },
}; };
use aiken_lang::{ use aiken_lang::{
@ -25,6 +25,7 @@ use indoc::formatdoc;
use itertools::Itertools; use itertools::Itertools;
use lsp_server::{Connection, Message}; use lsp_server::{Connection, Message};
use lsp_types::{ use lsp_types::{
DocumentFormattingParams, InitializeParams, TextEdit,
notification::{ notification::{
DidChangeTextDocument, DidChangeWatchedFiles, DidCloseTextDocument, DidSaveTextDocument, DidChangeTextDocument, DidChangeWatchedFiles, DidCloseTextDocument, DidSaveTextDocument,
Notification, Progress, PublishDiagnostics, ShowMessage, Notification, Progress, PublishDiagnostics, ShowMessage,
@ -33,7 +34,6 @@ use lsp_types::{
CodeActionRequest, Completion, Formatting, GotoDefinition, HoverRequest, Request, CodeActionRequest, Completion, Formatting, GotoDefinition, HoverRequest, Request,
WorkDoneProgressCreate, WorkDoneProgressCreate,
}, },
DocumentFormattingParams, InitializeParams, TextEdit,
}; };
use miette::Diagnostic; use miette::Diagnostic;
use std::{ use std::{

View File

@ -1,5 +1,7 @@
use aiken_lang::{ast::Tracing, line_numbers::LineNumbers, test_framework::PropertyTest}; use aiken_lang::{ast::Tracing, line_numbers::LineNumbers, test_framework::PropertyTest};
use aiken_project::{config::ProjectConfig, error::Error as ProjectError, module::CheckedModule, Project}; use aiken_project::{
Project, config::ProjectConfig, error::Error as ProjectError, module::CheckedModule,
};
use std::{collections::HashMap, path::PathBuf}; use std::{collections::HashMap, path::PathBuf};
#[derive(Debug)] #[derive(Debug)]

View File

@ -1,7 +1,7 @@
use crate::error::Error; use crate::error::Error;
use aiken_lang::{ast::Span, line_numbers::LineNumbers}; use aiken_lang::{ast::Span, line_numbers::LineNumbers};
use itertools::Itertools; use itertools::Itertools;
use lsp_types::{notification::Notification, TextEdit}; use lsp_types::{TextEdit, notification::Notification};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use urlencoding::decode; use urlencoding::decode;

View File

@ -1,17 +1,15 @@
[package] [package]
name = "aiken-project" name = "aiken-project"
description = "Aiken project utilities" version.workspace = true
version = "1.1.15" edition.workspace = true
edition = "2021" description.workspace = true
repository = "https://github.com/aiken-lang/aiken" license.workspace = true
homepage = "https://github.com/aiken-lang/aiken" authors.workspace = true
license = "Apache-2.0" repository.workspace = true
authors = [ homepage.workspace = true
"Lucas Rosa <x@rvcas.dev>", documentation.workspace = true
"Kasey White <kwhitemsg@gmail.com>", rust-version.workspace = true
"KtorZ <matthias.benkort@gmail.com>",
]
rust-version = "1.80.0"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]

View File

@ -1,11 +1,11 @@
use crate::{ use crate::{
Annotated, Schema,
blueprint::{ blueprint::{
parameter::Parameter, parameter::Parameter,
schema::{Data, Declaration, Items}, schema::{Data, Declaration, Items},
}, },
Annotated, Schema,
}; };
use aiken_lang::tipo::{pretty::resolve_alias, Type, TypeAliasAnnotation, TypeVar}; use aiken_lang::tipo::{Type, TypeAliasAnnotation, TypeVar, pretty::resolve_alias};
use itertools::Itertools; use itertools::Itertools;
use serde::{ use serde::{
self, self,
@ -176,7 +176,7 @@ impl Definitions<Annotated<Schema>> {
dependencies.insert(src); dependencies.insert(src);
} }
} }
Declaration::Inline(ref schema) => traverse(src, schema, usage), Declaration::Inline(schema) => traverse(src, schema, usage),
} }
} }
@ -260,16 +260,16 @@ impl Definitions<Annotated<Schema>> {
fn schema_to_data(schema: &mut Schema) { fn schema_to_data(schema: &mut Schema) {
let items = match schema { let items = match schema {
Schema::Data(_) => None, Schema::Data(_) => None,
Schema::Pair(ref mut left, ref mut right) => { Schema::Pair(left, right) => {
let left = swap_declaration(left); let left = swap_declaration(left);
let right = swap_declaration(right); let right = swap_declaration(right);
Some(Items::Many(vec![left, right])) Some(Items::Many(vec![left, right]))
} }
Schema::List(Items::One(ref mut item)) => { Schema::List(Items::One(item)) => {
let item = swap_declaration(item); let item = swap_declaration(item);
Some(Items::One(item)) Some(Items::One(item))
} }
Schema::List(Items::Many(ref mut items)) => Some(Items::Many( Schema::List(Items::Many(items)) => Some(Items::Many(
items.iter_mut().map(swap_declaration).collect(), items.iter_mut().map(swap_declaration).collect(),
)), )),
Schema::Integer => { Schema::Integer => {
@ -300,7 +300,7 @@ impl Definitions<Annotated<Schema>> {
} }
for (_, entry) in self.inner.iter_mut() { for (_, entry) in self.inner.iter_mut() {
if let Some(ref mut annotated) = entry { if let Some(annotated) = entry {
schema_to_data(&mut annotated.annotated); schema_to_data(&mut annotated.annotated);
} }
} }

View File

@ -6,7 +6,7 @@ pub mod schema;
pub mod validator; pub mod validator;
use crate::{ use crate::{
config::{self, ProjectConfig, PlutusVersion}, config::{self, PlutusVersion, ProjectConfig},
module::CheckedModules, module::CheckedModules,
}; };
use aiken_lang::gen_uplc::CodeGenerator; use aiken_lang::gen_uplc::CodeGenerator;

View File

@ -5,8 +5,8 @@ use super::{
}; };
use std::{iter, ops::Deref}; use std::{iter, ops::Deref};
use uplc::{ use uplc::{
ast::{Constant, Data as UplcData},
PlutusData, PlutusData,
ast::{Constant, Data as UplcData},
}; };
#[derive(Debug, PartialEq, Eq, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, PartialEq, Eq, Clone, serde::Serialize, serde::Deserialize)]
@ -34,7 +34,7 @@ impl Parameter {
) -> Result<(), Error> { ) -> Result<(), Error> {
let schema = match &self.schema { let schema = match &self.schema {
Declaration::Inline(schema) => schema, Declaration::Inline(schema) => schema,
Declaration::Referenced(ref link) => { Declaration::Referenced(link) => {
&definitions &definitions
.lookup(link) .lookup(link)
.map(Ok) .map(Ok)
@ -353,11 +353,13 @@ fn expect_data_constr(term: &Constant, index: usize) -> Result<Vec<Constant>, Er
Err(mismatch( Err(mismatch(
term, term,
Schema::Data(Data::AnyOf(vec![Constructor { Schema::Data(Data::AnyOf(vec![
index, Constructor {
fields: vec![], index,
} fields: vec![],
.into()])), }
.into(),
])),
)) ))
} }

View File

@ -1,10 +1,10 @@
use crate::{ use crate::{
blueprint::definitions::{Definitions, Reference},
CheckedModule, CheckedModule,
blueprint::definitions::{Definitions, Reference},
}; };
use aiken_lang::{ use aiken_lang::{
ast::{Definition, TypedDataType, TypedDefinition}, ast::{Definition, TypedDataType, TypedDefinition},
tipo::{pretty, Type, TypeVar}, tipo::{Type, TypeVar, pretty},
}; };
use owo_colors::{OwoColorize, Stream::Stdout}; use owo_colors::{OwoColorize, Stream::Stdout};
use serde::{ use serde::{
@ -1117,7 +1117,7 @@ Here's the types I followed and that led me to this problem:
pub mod tests { pub mod tests {
use super::*; use super::*;
use proptest::prelude::*; use proptest::prelude::*;
use serde_json::{self, json, Value}; use serde_json::{self, Value, json};
pub fn assert_json(schema: &impl Serialize, expected: Value) { pub fn assert_json(schema: &impl Serialize, expected: Value) {
assert_eq!(serde_json::to_value(schema).unwrap(), expected); assert_eq!(serde_json::to_value(schema).unwrap(), expected);
@ -1198,11 +1198,13 @@ pub mod tests {
#[test] #[test]
fn serialize_data_constr_1() { fn serialize_data_constr_1() {
let schema = Schema::Data(Data::AnyOf(vec![Constructor { let schema = Schema::Data(Data::AnyOf(vec![
index: 0, Constructor {
fields: vec![], index: 0,
} fields: vec![],
.into()])); }
.into(),
]));
assert_json( assert_json(
&schema, &schema,
json!({ json!({
@ -1363,14 +1365,16 @@ pub mod tests {
#[test] #[test]
fn deserialize_any_of() { fn deserialize_any_of() {
assert_eq!( assert_eq!(
Data::AnyOf(vec![Constructor { Data::AnyOf(vec![
index: 0, Constructor {
fields: vec![ index: 0,
Declaration::Referenced(Reference::new("foo")).into(), fields: vec![
Declaration::Referenced(Reference::new("bar")).into() Declaration::Referenced(Reference::new("foo")).into(),
], Declaration::Referenced(Reference::new("bar")).into()
} ],
.into()]), }
.into()
]),
serde_json::from_value(json!({ serde_json::from_value(json!({
"anyOf": [{ "anyOf": [{
"index": 0, "index": 0,
@ -1391,14 +1395,16 @@ pub mod tests {
#[test] #[test]
fn deserialize_one_of() { fn deserialize_one_of() {
assert_eq!( assert_eq!(
Data::AnyOf(vec![Constructor { Data::AnyOf(vec![
index: 0, Constructor {
fields: vec![ index: 0,
Declaration::Referenced(Reference::new("foo")).into(), fields: vec![
Declaration::Referenced(Reference::new("bar")).into() Declaration::Referenced(Reference::new("foo")).into(),
], Declaration::Referenced(Reference::new("bar")).into()
} ],
.into()]), }
.into()
]),
serde_json::from_value(json!({ serde_json::from_value(json!({
"oneOf": [{ "oneOf": [{
"index": 0, "index": 0,

View File

@ -7,17 +7,17 @@ use super::{
}; };
use crate::module::{CheckedModule, CheckedModules}; use crate::module::{CheckedModule, CheckedModules};
use aiken_lang::{ use aiken_lang::{
ast::{well_known, Annotation, TypedArg, TypedFunction, TypedValidator}, ast::{Annotation, TypedArg, TypedFunction, TypedValidator, well_known},
gen_uplc::CodeGenerator, gen_uplc::CodeGenerator,
plutus_version::PlutusVersion, plutus_version::PlutusVersion,
tipo::{collapse_links, Type}, tipo::{Type, collapse_links},
}; };
use miette::NamedSource; use miette::NamedSource;
use serde; use serde;
use std::borrow::Borrow; use std::borrow::Borrow;
use uplc::{ use uplc::{
ast::{Constant, SerializableProgram},
PlutusData, PlutusData,
ast::{Constant, SerializableProgram},
}; };
#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
@ -245,8 +245,8 @@ impl Validator {
pub fn tipo_or_annotation<'a>(module: &'a CheckedModule, arg: &'a TypedArg) -> &'a Type { pub fn tipo_or_annotation<'a>(module: &'a CheckedModule, arg: &'a TypedArg) -> &'a Type {
match collapse_links(arg.tipo.clone()).borrow() { match collapse_links(arg.tipo.clone()).borrow() {
Type::App { Type::App {
module: ref module_name, module: module_name,
name: ref type_name, name: type_name,
.. ..
} if module_name.is_empty() && &type_name[..] == "Data" => match arg.annotation { } if module_name.is_empty() && &type_name[..] == "Data" => match arg.annotation {
Some(Annotation::Constructor { ref arguments, .. }) if !arguments.is_empty() => module Some(Annotation::Constructor { ref arguments, .. }) if !arguments.is_empty() => module
@ -301,7 +301,7 @@ impl Validator {
description: None, description: None,
annotated: schema.as_ref().clone(), annotated: schema.as_ref().clone(),
}, },
Declaration::Referenced(ref link) => definitions Declaration::Referenced(link) => definitions
.lookup(link) .lookup(link)
.map(|s| { .map(|s| {
Ok(Annotated { Ok(Annotated {
@ -1032,11 +1032,13 @@ mod tests {
let mut definitions = fixture_definitions(); let mut definitions = fixture_definitions();
definitions.insert( definitions.insert(
&schema, &schema,
Schema::Data(Data::AnyOf(vec![Constructor { Schema::Data(Data::AnyOf(vec![
index: 0, Constructor {
fields: vec![Declaration::Referenced(Reference::new("Bool")).into()], index: 0,
} fields: vec![Declaration::Referenced(Reference::new("Bool")).into()],
.into()])) }
.into(),
]))
.into(), .into(),
); );

View File

@ -1,5 +1,5 @@
use crate::{ use crate::{
error::TomlLoadingContext, github::repo::LatestRelease, package_name::PackageName, paths, Error, Error, error::TomlLoadingContext, github::repo::LatestRelease, package_name::PackageName, paths,
}; };
use aiken_lang::{ use aiken_lang::{
ast::{Annotation, ByteArrayFormatPreference, ModuleConstant, Span, UntypedDefinition}, ast::{Annotation, ByteArrayFormatPreference, ModuleConstant, Span, UntypedDefinition},
@ -11,9 +11,8 @@ use glob::glob;
use miette::NamedSource; use miette::NamedSource;
use semver::Version; use semver::Version;
use serde::{ use serde::{
de, Deserialize, Serialize, de,
ser::{self, SerializeSeq, SerializeStruct}, ser::{self, SerializeSeq, SerializeStruct},
Deserialize, Serialize,
}; };
use std::{ use std::{
collections::BTreeMap, collections::BTreeMap,

View File

@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use tokio::time::Instant; use tokio::time::Instant;
use crate::{ use crate::{
config::{ProjectConfig, Dependency}, config::{Dependency, ProjectConfig},
error::{Error, TomlLoadingContext}, error::{Error, TomlLoadingContext},
package_name::PackageName, package_name::PackageName,
paths, paths,
@ -133,7 +133,11 @@ impl From<&Manifest> for LocalPackages {
} }
} }
pub fn download<T>(event_listener: &T, root_path: &Path, config: &ProjectConfig) -> Result<Manifest, Error> pub fn download<T>(
event_listener: &T,
root_path: &Path,
config: &ProjectConfig,
) -> Result<Manifest, Error>
where where
T: EventListener, T: EventListener,
{ {

View File

@ -9,7 +9,7 @@ use std::{
}; };
use crate::{ use crate::{
config::{ProjectConfig, Dependency, Platform}, config::{Dependency, Platform, ProjectConfig},
error::{Error, TomlLoadingContext}, error::{Error, TomlLoadingContext},
package_name::PackageName, package_name::PackageName,
paths, paths,

View File

@ -104,7 +104,11 @@ impl DocLink {
/// The documentation is built using template files located at the root of this crate. /// The documentation is built using template files located at the root of this crate.
/// With the documentation, we also build a client-side search index to ease navigation /// With the documentation, we also build a client-side search index to ease navigation
/// across multiple modules. /// across multiple modules.
pub fn generate_all(root: &Path, config: &ProjectConfig, modules: Vec<&CheckedModule>) -> Vec<DocFile> { pub fn generate_all(
root: &Path,
config: &ProjectConfig,
modules: Vec<&CheckedModule>,
) -> Vec<DocFile> {
let timestamp = new_timestamp(); let timestamp = new_timestamp();
let modules_links = generate_modules_links(&modules); let modules_links = generate_modules_links(&modules);

View File

@ -78,10 +78,7 @@ impl LinkTree {
} }
} }
LinkTree::Leaf { LinkTree::Leaf { value: leaf, .. } => {
value: ref mut leaf,
..
} => {
// In case we try to insert a module that already exists, there's nothing to do. // In case we try to insert a module that already exists, there's nothing to do.
if module == leaf { if module == leaf {
return; return;
@ -138,9 +135,7 @@ impl LinkTree {
} }
LinkTree::Node { LinkTree::Node {
ref mut prefix, prefix, children, ..
ref mut children,
..
} => { } => {
// When `module.starts_with(prefix)` is true, it means that the module being // When `module.starts_with(prefix)` is true, it means that the module being
// inserted belong to our sub-tree. We do not know *where* exactly though, so we // inserted belong to our sub-tree. We do not know *where* exactly though, so we
@ -274,8 +269,8 @@ impl LinkTree {
fn path(&self) -> &str { fn path(&self) -> &str {
match self { match self {
LinkTree::Empty => "", LinkTree::Empty => "",
LinkTree::Leaf { ref value, .. } => value.as_str(), LinkTree::Leaf { value, .. } => value.as_str(),
LinkTree::Node { ref prefix, .. } => prefix.as_str(), LinkTree::Node { prefix, .. } => prefix.as_str(),
} }
} }
} }

View File

@ -1,6 +1,6 @@
use crate::{ use crate::{
config::{ProjectConfig, Platform},
CheckedModule, CheckedModule,
config::{Platform, ProjectConfig},
}; };
use aiken_lang::{ast::Span, line_numbers::LineNumbers}; use aiken_lang::{ast::Span, line_numbers::LineNumbers};
use camino::{Utf8Component, Utf8Path}; use camino::{Utf8Component, Utf8Path};

View File

@ -432,12 +432,14 @@ impl Diagnostic for Error {
))), ))),
Error::NoValidatorNotFound { known_validators } => Some(Box::new(hint_validators( Error::NoValidatorNotFound { known_validators } => Some(Box::new(hint_validators(
known_validators, known_validators,
"Here's a list of all validators I've found in your project.\nPlease double-check this list against the options that you've provided." "Here's a list of all validators I've found in your project.\nPlease double-check this list against the options that you've provided.",
))),
Error::MoreThanOneValidatorFound { known_validators } => Some(Box::new(hint_validators(
known_validators,
"Here's a list of matching validators I've found in your project.\nPlease narrow the selection using additional options.",
))), ))),
Error::MoreThanOneValidatorFound { known_validators } => {
Some(Box::new(hint_validators(
known_validators,
"Here's a list of matching validators I've found in your project.\nPlease narrow the selection using additional options.",
)))
}
Error::Module(e) => e.help(), Error::Module(e) => e.help(),
} }
} }
@ -697,12 +699,10 @@ impl Diagnostic for Warning {
Warning::NoConfigurationForEnv { .. } => Some(Box::new( Warning::NoConfigurationForEnv { .. } => Some(Box::new(
"When configuration keys are missing for a target environment, no 'config' module will be created. This may lead to issues down the line.", "When configuration keys are missing for a target environment, no 'config' module will be created. This may lead to issues down the line.",
)), )),
Warning::SuspiciousTestMatch { test } => Some(Box::new( Warning::SuspiciousTestMatch { test } => Some(Box::new(format!(
format!( "Did you mean to match all tests within a specific module? Like so:\n\n╰─▶ {}",
"Did you mean to match all tests within a specific module? Like so:\n\n╰─▶ {}", format!("-m \"{test}.{{..}}\"").if_supports_color(Stderr, |s| s.bold()),
format!("-m \"{test}.{{..}}\"").if_supports_color(Stderr, |s| s.bold()), ))),
)
)),
} }
} }
} }
@ -826,12 +826,8 @@ fn hint_validators(known_validators: &BTreeSet<(String, String, bool)>, hint: &s
{ {
known_validators known_validators
.iter() .iter()
.map(|(module, validator, has_params)| { .map(|(module, validator, has_params)| {
let title = format!( let title = format!("{:>pad_module$} . {:<pad_validator$}", module, validator,);
"{:>pad_module$} . {:<pad_validator$}",
module,
validator,
);
if *has_params { if *has_params {
title title
.if_supports_color(Stderr, |s| s.bold()) .if_supports_color(Stderr, |s| s.bold())

View File

@ -1,4 +1,4 @@
use reqwest::{blocking::Client, header::USER_AGENT, Error}; use reqwest::{Error, blocking::Client, header::USER_AGENT};
use serde::Deserialize; use serde::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]

View File

@ -21,9 +21,9 @@ mod tests;
use crate::{ use crate::{
blueprint::{ blueprint::{
Blueprint,
definitions::Definitions, definitions::Definitions,
schema::{Annotated, Schema}, schema::{Annotated, Schema},
Blueprint,
}, },
config::ProjectConfig, config::ProjectConfig,
error::{Error, Warning}, error::{Error, Warning},
@ -31,6 +31,7 @@ use crate::{
telemetry::Event, telemetry::Event,
}; };
use aiken_lang::{ use aiken_lang::{
IdGenerator,
ast::{ ast::{
self, DataTypeKey, Definition, FunctionAccessKey, ModuleKind, Tracing, TypedDataType, self, DataTypeKey, Definition, FunctionAccessKey, ModuleKind, Tracing, TypedDataType,
TypedFunction, UntypedDefinition, TypedFunction, UntypedDefinition,
@ -42,7 +43,7 @@ use aiken_lang::{
line_numbers::LineNumbers, line_numbers::LineNumbers,
test_framework::{RunnableKind, Test, TestResult}, test_framework::{RunnableKind, Test, TestResult},
tipo::{Type, TypeInfo}, tipo::{Type, TypeInfo},
utils, IdGenerator, utils,
}; };
use export::Export; use export::Export;
use indexmap::IndexMap; use indexmap::IndexMap;
@ -60,8 +61,8 @@ use std::{
}; };
use telemetry::EventListener; use telemetry::EventListener;
use uplc::{ use uplc::{
ast::{Constant, Name, Program},
PlutusData, PlutusData,
ast::{Constant, Name, Program},
}; };
#[derive(Debug)] #[derive(Debug)]

View File

@ -1,5 +1,6 @@
use crate::{Error, Warning}; use crate::{Error, Warning};
use aiken_lang::{ use aiken_lang::{
IdGenerator,
ast::{ ast::{
DataType, DataTypeKey, Definition, Function, FunctionAccessKey, Located, ModuleKind, DataType, DataTypeKey, Definition, Function, FunctionAccessKey, Located, ModuleKind,
Tracing, TypedDataType, TypedFunction, TypedModule, TypedValidator, UntypedModule, Tracing, TypedDataType, TypedFunction, TypedModule, TypedValidator, UntypedModule,
@ -7,13 +8,12 @@ use aiken_lang::{
}, },
expr::TypedExpr, expr::TypedExpr,
line_numbers::LineNumbers, line_numbers::LineNumbers,
parser::extra::{comments_before, Comment, ModuleExtra}, parser::extra::{Comment, ModuleExtra, comments_before},
tipo::TypeInfo, tipo::TypeInfo,
IdGenerator,
}; };
use indexmap::IndexMap; use indexmap::IndexMap;
use miette::NamedSource; use miette::NamedSource;
use petgraph::{algo, graph::NodeIndex, Direction, Graph}; use petgraph::{Direction, Graph, algo, graph::NodeIndex};
use std::{ use std::{
collections::{BTreeSet, HashMap}, collections::{BTreeSet, HashMap},
io, io,

View File

@ -1,5 +1,5 @@
use owo_colors::{OwoColorize, Stream::Stdout}; use owo_colors::{OwoColorize, Stream::Stdout};
use serde::{de::Visitor, Deserialize, Serialize}; use serde::{Deserialize, Serialize, de::Visitor};
use std::{ use std::{
fmt::{self, Display}, fmt::{self, Display},
str::FromStr, str::FromStr,

View File

@ -36,11 +36,7 @@ pub fn ansi_len(s: &str) -> usize {
pub fn len_longest_line(zero: usize, s: &str) -> usize { pub fn len_longest_line(zero: usize, s: &str) -> usize {
s.lines().fold(zero, |max, l| { s.lines().fold(zero, |max, l| {
let n = ansi_len(l); let n = ansi_len(l);
if n > max { if n > max { n } else { max }
n
} else {
max
}
}) })
} }
@ -154,11 +150,7 @@ pub fn pad_right(mut text: String, n: usize, delimiter: &str) -> String {
} }
pub fn style_if(styled: bool, s: String, apply_style: fn(String) -> String) -> String { pub fn style_if(styled: bool, s: String, apply_style: fn(String) -> String) -> String {
if styled { if styled { apply_style(s) } else { s }
apply_style(s)
} else {
s
}
} }
pub fn multiline(max_len: usize, s: String) -> Vec<String> { pub fn multiline(max_len: usize, s: String) -> Vec<String> {

View File

@ -2,7 +2,7 @@ use aiken_lang::{
expr::UntypedExpr, expr::UntypedExpr,
test_framework::{BenchmarkResult, PropertyTestResult, TestResult, UnitTestResult}, test_framework::{BenchmarkResult, PropertyTestResult, TestResult, UnitTestResult},
}; };
pub use json::{json_schema, Json}; pub use json::{Json, json_schema};
use std::{ use std::{
collections::BTreeMap, collections::BTreeMap,
fmt::Display, fmt::Display,

View File

@ -1,4 +1,4 @@
use super::{group_by_module, Event, EventListener}; use super::{Event, EventListener, group_by_module};
use aiken_lang::{ use aiken_lang::{
ast::OnTestFailure, ast::OnTestFailure,
expr::UntypedExpr, expr::UntypedExpr,
@ -76,10 +76,8 @@ impl EventListener for Json {
fn fmt_test_json(result: &TestResult<UntypedExpr, UntypedExpr>) -> serde_json::Value { fn fmt_test_json(result: &TestResult<UntypedExpr, UntypedExpr>) -> serde_json::Value {
let on_test_failure = match result { let on_test_failure = match result {
TestResult::UnitTestResult(UnitTestResult { ref test, .. }) => &test.on_test_failure, TestResult::UnitTestResult(UnitTestResult { test, .. }) => &test.on_test_failure,
TestResult::PropertyTestResult(PropertyTestResult { ref test, .. }) => { TestResult::PropertyTestResult(PropertyTestResult { test, .. }) => &test.on_test_failure,
&test.on_test_failure
}
TestResult::BenchmarkResult(_) => unreachable!("benchmark returned in JSON output"), TestResult::BenchmarkResult(_) => unreachable!("benchmark returned in JSON output"),
}; };

View File

@ -1,4 +1,4 @@
use super::{find_max_execution_units, group_by_module, DownloadSource, Event, EventListener}; use super::{DownloadSource, Event, EventListener, find_max_execution_units, group_by_module};
use crate::pretty; use crate::pretty;
use aiken_lang::{ use aiken_lang::{
ast::OnTestFailure, ast::OnTestFailure,

View File

@ -5,6 +5,7 @@ mod test {
utils, utils,
}; };
use aiken_lang::{ use aiken_lang::{
IdGenerator,
ast::{DataTypeKey, Definition, ModuleKind, TraceLevel, Tracing, TypedDataType}, ast::{DataTypeKey, Definition, ModuleKind, TraceLevel, Tracing, TypedDataType},
builtins, builtins,
expr::UntypedExpr, expr::UntypedExpr,
@ -14,7 +15,6 @@ mod test {
parser::{self, extra::ModuleExtra}, parser::{self, extra::ModuleExtra},
plutus_version::PlutusVersion, plutus_version::PlutusVersion,
test_framework::*, test_framework::*,
IdGenerator,
}; };
use indexmap::IndexMap; use indexmap::IndexMap;
use indoc::indoc; use indoc::indoc;
@ -246,12 +246,14 @@ mod test {
} }
"#}); "#});
assert!(TestResult::PropertyTestResult::<(), _>(prop.run( assert!(
42, TestResult::PropertyTestResult::<(), _>(prop.run(
PropertyTest::DEFAULT_MAX_SUCCESS, 42,
&PlutusVersion::default() PropertyTest::DEFAULT_MAX_SUCCESS,
)) &PlutusVersion::default()
.is_success()); ))
.is_success()
);
} }
#[test] #[test]

View File

@ -5,6 +5,7 @@ use crate::{
utils, utils,
}; };
use aiken_lang::{ use aiken_lang::{
IdGenerator,
ast::{ ast::{
DataTypeKey, FunctionAccessKey, ModuleKind, TraceLevel, Tracing, TypedDataType, DataTypeKey, FunctionAccessKey, ModuleKind, TraceLevel, Tracing, TypedDataType,
TypedFunction, TypedFunction,
@ -15,7 +16,6 @@ use aiken_lang::{
parser, parser,
plutus_version::PlutusVersion, plutus_version::PlutusVersion,
tipo::TypeInfo, tipo::TypeInfo,
IdGenerator,
}; };
use indexmap::IndexMap; use indexmap::IndexMap;
use std::{collections::HashMap, path::PathBuf}; use std::{collections::HashMap, path::PathBuf};

View File

@ -1,4 +1,4 @@
use crate::{config::WorkspaceConfig, telemetry::EventTarget, Project}; use crate::{Project, config::WorkspaceConfig, telemetry::EventTarget};
use miette::{Diagnostic, IntoDiagnostic}; use miette::{Diagnostic, IntoDiagnostic};
use notify::{Event, RecursiveMode, Watcher}; use notify::{Event, RecursiveMode, Watcher};
use owo_colors::{OwoColorize, Stream::Stderr}; use owo_colors::{OwoColorize, Stream::Stderr};

View File

@ -1,17 +1,14 @@
[package] [package]
name = "aiken" name = "aiken"
description = "Cardano smart contract language and toolchain" version.workspace = true
version = "1.1.15" edition.workspace = true
edition = "2021" description.workspace = true
repository = "https://github.com/aiken-lang/aiken" license.workspace = true
homepage = "https://github.com/aiken-lang/aiken" authors.workspace = true
license = "Apache-2.0" repository.workspace = true
authors = [ homepage.workspace = true
"Lucas Rosa <x@rvcas.dev>", documentation.workspace = true
"Kasey White <kwhitemsg@gmail.com>", rust-version.workspace = true
"KtorZ <matthias.benkort@gmail.com>",
]
rust-version = "1.70.0"
[package.metadata.wix] [package.metadata.wix]
upgrade-guid = "288B160D-418A-4558-91B9-7C38CFD789C7" upgrade-guid = "288B160D-418A-4558-91B9-7C38CFD789C7"

View File

@ -84,7 +84,7 @@ pub fn exec(
) -> miette::Result<()> { ) -> miette::Result<()> {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let seed = seed.unwrap_or_else(|| rng.gen()); let seed = seed.unwrap_or_else(|| rng.r#gen());
let result = with_project( let result = with_project(
directory.as_deref(), directory.as_deref(),

View File

@ -1,5 +1,5 @@
use aiken_project::{ use aiken_project::{
blueprint::{error::Error as BlueprintError, Blueprint}, blueprint::{Blueprint, error::Error as BlueprintError},
error::Error as ProjectError, error::Error as ProjectError,
}; };
use clap::ValueEnum; use clap::ValueEnum;

View File

@ -118,8 +118,8 @@ pub fn exec(
} }
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
pub fn trace_filter_parser( pub fn trace_filter_parser()
) -> MapValueParser<PossibleValuesParser, fn(String) -> fn(TraceLevel) -> Tracing> { -> MapValueParser<PossibleValuesParser, fn(String) -> fn(TraceLevel) -> Tracing> {
PossibleValuesParser::new(["user-defined", "compiler-generated", "all"]).map( PossibleValuesParser::new(["user-defined", "compiler-generated", "all"]).map(
|s: String| match s.as_str() { |s: String| match s.as_str() {
"user-defined" => Tracing::UserDefined, "user-defined" => Tracing::UserDefined,

View File

@ -133,7 +133,7 @@ pub fn exec(
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let seed = seed.unwrap_or_else(|| rng.gen()); let seed = seed.unwrap_or_else(|| rng.r#gen());
let result = if watch { let result = if watch {
watch_project(directory.as_deref(), watch::default_filter, 500, |p| { watch_project(directory.as_deref(), watch::default_filter, 500, |p| {

View File

@ -1,6 +1,6 @@
use crate::{cmd::Cmd as MainCmd, pretty}; use crate::{cmd::Cmd as MainCmd, pretty};
use clap::{Command, Subcommand}; use clap::{Command, Subcommand};
use clap_complete::{generate, Shell}; use clap_complete::{Shell, generate};
use std::{ use std::{
fmt::{self, Display}, fmt::{self, Display},
fs::{File, OpenOptions}, fs::{File, OpenOptions},

View File

@ -1,5 +1,5 @@
use aiken_project::{ use aiken_project::{
config::{ProjectConfig, Dependency, Platform}, config::{Dependency, Platform, ProjectConfig},
error::Warning, error::Warning,
package_name::PackageName, package_name::PackageName,
pretty, pretty,

View File

@ -1,8 +1,8 @@
use miette::IntoDiagnostic; use miette::IntoDiagnostic;
use owo_colors::{OwoColorize, Stream::Stderr}; use owo_colors::{OwoColorize, Stream::Stderr};
use pallas_primitives::{ use pallas_primitives::{
conway::{Redeemer, TransactionInput, TransactionOutput},
Fragment, Fragment,
conway::{Redeemer, TransactionInput, TransactionOutput},
}; };
use pallas_traverse::{Era, MultiEraTx}; use pallas_traverse::{Era, MultiEraTx};
use std::{fmt, fs, path::PathBuf, process}; use std::{fmt, fs, path::PathBuf, process};

View File

@ -9,8 +9,8 @@ use uplc::{
ast::{FakeNamedDeBruijn, Name, NamedDeBruijn, Program, Term}, ast::{FakeNamedDeBruijn, Name, NamedDeBruijn, Program, Term},
builtins::DefaultFunction, builtins::DefaultFunction,
machine::{ machine::{
cost_model::{ExBudget, StepKind},
TERM_COUNT, TERM_COUNT,
cost_model::{ExBudget, StepKind},
}, },
parser, parser,
}; };

View File

@ -3,7 +3,7 @@ use std::path::PathBuf;
use uplc::ast::{DeBruijn, Name, NamedDeBruijn, Program}; use uplc::ast::{DeBruijn, Name, NamedDeBruijn, Program};
use uplc::optimize::aiken_optimize_and_intern; use uplc::optimize::aiken_optimize_and_intern;
use super::{encode, Format}; use super::{Format, encode};
#[derive(clap::Args)] #[derive(clap::Args)]
/// Shrink / Optimize UPLC code using a variety of optimization steps /// Shrink / Optimize UPLC code using a variety of optimization steps

View File

@ -2,11 +2,11 @@ use aiken_project::{config, pretty};
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
use cmd::completion; use cmd::completion;
use cmd::{ use cmd::{
benchmark, Cmd, benchmark,
blueprint::{self, address}, blueprint::{self, address},
build, check, docs, export, fmt, lsp, new, build, check, docs, export, fmt, lsp, new,
packages::{self, add}, packages::{self, add},
tx, uplc, Cmd, tx, uplc,
}; };
use owo_colors::OwoColorize; use owo_colors::OwoColorize;

View File

@ -1,13 +1,15 @@
[package] [package]
name = "uplc" name = "uplc"
version.workspace = true
edition.workspace = true
description = "Utilities for working with Untyped Plutus Core" description = "Utilities for working with Untyped Plutus Core"
version = "1.1.15" license.workspace = true
edition = "2021"
repository = "https://github.com/aiken-lang/aiken"
homepage = "https://github.com/aiken-lang/aiken"
license = "Apache-2.0"
authors = ["Lucas Rosa <x@rvcas.dev>", "Kasey White <kwhitemsg@gmail.com>"] authors = ["Lucas Rosa <x@rvcas.dev>", "Kasey White <kwhitemsg@gmail.com>"]
rust-version = "1.70.0" repository.workspace = true
homepage.workspace = true
documentation.workspace = true
rust-version.workspace = true
exclude = ["test_data/*"] exclude = ["test_data/*"]
[dependencies] [dependencies]

View File

@ -3,9 +3,9 @@ use crate::{
debruijn::{self, Converter}, debruijn::{self, Converter},
flat::Binder, flat::Binder,
machine::{ machine::{
cost_model::{initialize_cost_model, CostModel, ExBudget},
eval_result::EvalResult,
Machine, Machine,
cost_model::{CostModel, ExBudget, initialize_cost_model},
eval_result::EvalResult,
}, },
optimize::interner::CodeGenInterner, optimize::interner::CodeGenInterner,
}; };

View File

@ -799,7 +799,7 @@ mod tests {
use crate::{ use crate::{
ast::{Data, Name, NamedDeBruijn, Program, Term}, ast::{Data, Name, NamedDeBruijn, Program, Term},
builder::Constant, builder::Constant,
machine::{cost_model::ExBudget, Error}, machine::{Error, cost_model::ExBudget},
optimize::interner::CodeGenInterner, optimize::interner::CodeGenInterner,
}; };

View File

@ -7,11 +7,11 @@ use crate::{
}; };
use num_bigint::BigInt; use num_bigint::BigInt;
use pallas_codec::flat::{ use pallas_codec::flat::{
Flat,
de::{self, Decode, Decoder}, de::{self, Decode, Decoder},
en::{self, Encode, Encoder}, en::{self, Encode, Encoder},
Flat,
}; };
use pallas_primitives::{conway::PlutusData, Fragment}; use pallas_primitives::{Fragment, conway::PlutusData};
use std::{collections::VecDeque, fmt::Debug, rc::Rc}; use std::{collections::VecDeque, fmt::Debug, rc::Rc};
const BUILTIN_TAG_WIDTH: u32 = 7; const BUILTIN_TAG_WIDTH: u32 = 7;

View File

@ -12,9 +12,9 @@ pub mod tx;
pub use pallas_codec::utils::KeyValuePairs; pub use pallas_codec::utils::KeyValuePairs;
pub use pallas_crypto::hash::Hash; pub use pallas_crypto::hash::Hash;
pub use pallas_primitives::{ pub use pallas_primitives::{
Error, Fragment,
alonzo::{BigInt, Constr, PlutusData}, alonzo::{BigInt, Constr, PlutusData},
babbage::{PostAlonzoTransactionOutput, TransactionInput, TransactionOutput, Value}, babbage::{PostAlonzoTransactionOutput, TransactionInput, TransactionOutput, Value},
Error, Fragment,
}; };
pub use tx::redeemer_tag_to_string; pub use tx::redeemer_tag_to_string;

View File

@ -1,4 +1,4 @@
use super::{cost_model::ExBudget, Error, Trace}; use super::{Error, Trace, cost_model::ExBudget};
use crate::ast::{Constant, NamedDeBruijn, Term}; use crate::ast::{Constant, NamedDeBruijn, Term};
#[derive(Debug)] #[derive(Debug)]

View File

@ -1,7 +1,7 @@
use super::{ use super::{
Error, Trace, Value,
cost_model::{BuiltinCosts, ExBudget}, cost_model::{BuiltinCosts, ExBudget},
value::{from_pallas_bigint, to_pallas_bigint}, value::{from_pallas_bigint, to_pallas_bigint},
Error, Trace, Value,
}; };
use crate::{ use crate::{
ast::{Constant, Data, Type}, ast::{Constant, Data, Type},
@ -1882,7 +1882,7 @@ pub static ANY_TAG: u64 = 102;
#[cfg(not(target_family = "wasm"))] #[cfg(not(target_family = "wasm"))]
fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Value, Error> { fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Value, Error> {
use secp256k1::{ecdsa::Signature, Message, PublicKey, Secp256k1}; use secp256k1::{Message, PublicKey, Secp256k1, ecdsa::Signature};
let secp = Secp256k1::verification_only(); let secp = Secp256k1::verification_only();
@ -1901,7 +1901,7 @@ fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<V
/// The message needs to be 32 bytes (ideally prehashed, but not a requirement). /// The message needs to be 32 bytes (ideally prehashed, but not a requirement).
#[cfg(not(target_family = "wasm"))] #[cfg(not(target_family = "wasm"))]
fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Value, Error> { fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Value, Error> {
use secp256k1::{schnorr::Signature, Message, Secp256k1, XOnlyPublicKey}; use secp256k1::{Message, Secp256k1, XOnlyPublicKey, schnorr::Signature};
let secp = Secp256k1::verification_only(); let secp = Secp256k1::verification_only();

View File

@ -1,6 +1,6 @@
use super::{ use super::{
runtime::{self, BuiltinRuntime},
Error, Error,
runtime::{self, BuiltinRuntime},
}; };
use crate::{ use crate::{
ast::{Constant, NamedDeBruijn, Term, Type}, ast::{Constant, NamedDeBruijn, Term, Type},
@ -480,7 +480,7 @@ pub fn to_pallas_bigint(n: &BigInt) -> conway::BigInt {
mod tests { mod tests {
use crate::{ use crate::{
ast::Constant, ast::Constant,
machine::value::{integer_log2, Value}, machine::value::{Value, integer_log2},
}; };
use num_bigint::BigInt; use num_bigint::BigInt;

View File

@ -2,7 +2,7 @@ use crate::{
ast::{Constant, Program, Term, Type}, ast::{Constant, Program, Term, Type},
flat::Binder, flat::Binder,
machine::{ machine::{
runtime::{convert_tag_to_constr, Compressable}, runtime::{Compressable, convert_tag_to_constr},
value::from_pallas_bigint, value::from_pallas_bigint,
}, },
}; };

View File

@ -1,15 +1,15 @@
use crate::{ use crate::{
PlutusData,
ast::{DeBruijn, Program}, ast::{DeBruijn, Program},
machine::{cost_model::ExBudget, eval_result::EvalResult}, machine::{cost_model::ExBudget, eval_result::EvalResult},
PlutusData,
}; };
use error::Error; use error::Error;
use pallas_primitives::{ use pallas_primitives::{
Fragment,
conway::{ conway::{
CostModels, ExUnits, MintedTx, Redeemer, Redeemers, RedeemersKey, TransactionInput, CostModels, ExUnits, MintedTx, Redeemer, Redeemers, RedeemersKey, TransactionInput,
TransactionOutput, TransactionOutput,
}, },
Fragment,
}; };
use pallas_traverse::{Era, MultiEraTx}; use pallas_traverse::{Era, MultiEraTx};
pub use phase_one::{eval_phase_one, redeemer_tag_to_string}; pub use phase_one::{eval_phase_one, redeemer_tag_to_string};

View File

@ -1,6 +1,6 @@
use crate::{ use crate::{
machine::{self, cost_model::ExBudget, Trace},
TransactionInput, TransactionInput,
machine::{self, Trace, cost_model::ExBudget},
}; };
use pallas_primitives::conway::Language; use pallas_primitives::conway::Language;

View File

@ -1,16 +1,16 @@
use super::{ use super::{
script_context::{find_script, ResolvedInput, ScriptContext, SlotConfig, TxInfo},
to_plutus_data::ToPlutusData,
Error, Error,
script_context::{ResolvedInput, ScriptContext, SlotConfig, TxInfo, find_script},
to_plutus_data::ToPlutusData,
}; };
use crate::{ use crate::{
PlutusData,
ast::{FakeNamedDeBruijn, NamedDeBruijn, Program}, ast::{FakeNamedDeBruijn, NamedDeBruijn, Program},
machine::{cost_model::ExBudget, eval_result::EvalResult}, machine::{cost_model::ExBudget, eval_result::EvalResult},
tx::{ tx::{
phase_one::redeemer_tag_to_string, phase_one::redeemer_tag_to_string,
script_context::{DataLookupTable, ScriptVersion, TxInfoV1, TxInfoV2, TxInfoV3}, script_context::{DataLookupTable, ScriptVersion, TxInfoV1, TxInfoV2, TxInfoV3},
}, },
PlutusData,
}; };
use pallas_codec::utils::Bytes; use pallas_codec::utils::Bytes;
use pallas_primitives::conway::{CostModel, CostModels, ExUnits, Language, MintedTx, Redeemer}; use pallas_primitives::conway::{CostModel, CostModels, ExUnits, Language, MintedTx, Redeemer};

View File

@ -1,6 +1,6 @@
use super::{ use super::{
error::Error, error::Error,
script_context::{sort_voters, DataLookupTable, ResolvedInput, ScriptPurpose, ScriptVersion}, script_context::{DataLookupTable, ResolvedInput, ScriptPurpose, ScriptVersion, sort_voters},
}; };
use crate::tx::script_context::sort_reward_accounts; use crate::tx::script_context::sort_reward_accounts;
use itertools::Itertools; use itertools::Itertools;

View File

@ -1,4 +1,4 @@
use super::{to_plutus_data::MintValue, Error}; use super::{Error, to_plutus_data::MintValue};
use crate::tx::iter_redeemers; use crate::tx::iter_redeemers;
use itertools::Itertools; use itertools::Itertools;
use pallas_addresses::{Address, Network, StakePayload}; use pallas_addresses::{Address, Network, StakePayload};
@ -1134,14 +1134,14 @@ mod tests {
use crate::{ use crate::{
ast::Data, ast::Data,
tx::{ tx::{
ResolvedInput, SlotConfig,
script_context::{TxInfo, TxInfoV3}, script_context::{TxInfo, TxInfoV3},
to_plutus_data::ToPlutusData, to_plutus_data::ToPlutusData,
ResolvedInput, SlotConfig,
}, },
}; };
use pallas_primitives::{ use pallas_primitives::{
conway::{ExUnits, PlutusData, Redeemer, RedeemerTag, TransactionInput, TransactionOutput},
Fragment, Fragment,
conway::{ExUnits, PlutusData, Redeemer, RedeemerTag, TransactionInput, TransactionOutput},
}; };
use pallas_traverse::{Era, MultiEraTx}; use pallas_traverse::{Era, MultiEraTx};

View File

@ -1,9 +1,9 @@
use super::{eval_phase_two, ResolvedInput, SlotConfig}; use super::{ResolvedInput, SlotConfig, eval_phase_two};
use crate::machine::cost_model::ExBudget; use crate::machine::cost_model::ExBudget;
use pallas_codec::utils::MaybeIndefArray; use pallas_codec::utils::MaybeIndefArray;
use pallas_primitives::{ use pallas_primitives::{
conway::{CostModels, TransactionInput, TransactionOutput},
Fragment, Fragment,
conway::{CostModels, TransactionInput, TransactionOutput},
}; };
use pallas_traverse::{Era, MultiEraTx}; use pallas_traverse::{Era, MultiEraTx};
@ -1001,16 +1001,18 @@ fn test_eval_4() {
.unwrap(); .unwrap();
match multi_era_tx { match multi_era_tx {
MultiEraTx::Conway(tx) => { MultiEraTx::Conway(tx) => {
assert!(eval_phase_two( assert!(
&tx, eval_phase_two(
&utxos, &tx,
Some(&cost_mdl), &utxos,
Some(&initial_budget), Some(&cost_mdl),
&slot_config, Some(&initial_budget),
false, &slot_config,
|_| (), false,
) |_| (),
.is_err()); )
.is_err()
);
} }
_ => unreachable!(), _ => unreachable!(),
}; };
@ -1757,16 +1759,18 @@ fn eval_extraneous_redeemer() {
match multi_era_tx { match multi_era_tx {
MultiEraTx::Conway(tx) => { MultiEraTx::Conway(tx) => {
assert!(eval_phase_two( assert!(
&tx, eval_phase_two(
&utxos, &tx,
Some(&cost_mdl), &utxos,
Some(&initial_budget), Some(&cost_mdl),
&slot_config, Some(&initial_budget),
false, &slot_config,
|_| (), false,
) |_| (),
.is_err()); )
.is_err()
);
} }
_ => unreachable!(), _ => unreachable!(),
}; };

View File

@ -3,7 +3,7 @@ use super::script_context::{
}; };
use crate::{ use crate::{
ast::Data, ast::Data,
machine::runtime::{convert_constr_to_tag, ANY_TAG}, machine::runtime::{ANY_TAG, convert_constr_to_tag},
tx::script_context::from_alonzo_output, tx::script_context::from_alonzo_output,
}; };
use num_integer::Integer; use num_integer::Integer;
@ -421,7 +421,7 @@ impl<'a> ToPlutusData for WithOptionDatum<'a, WithZeroAdaAsset<'a, Vec<Transacti
fn to_plutus_data(&self) -> PlutusData { fn to_plutus_data(&self) -> PlutusData {
Data::list( Data::list(
self.0 self.0
.0 .0
.iter() .iter()
.map(|p| WithOptionDatum(&WithZeroAdaAsset(p)).to_plutus_data()) .map(|p| WithOptionDatum(&WithZeroAdaAsset(p)).to_plutus_data())
.collect(), .collect(),
@ -442,7 +442,7 @@ impl ToPlutusData for WithZeroAdaAsset<'_, Vec<TransactionOutput>> {
impl<'a> ToPlutusData for WithOptionDatum<'a, WithZeroAdaAsset<'a, TransactionOutput>> { impl<'a> ToPlutusData for WithOptionDatum<'a, WithZeroAdaAsset<'a, TransactionOutput>> {
fn to_plutus_data(&self) -> PlutusData { fn to_plutus_data(&self) -> PlutusData {
match self.0 .0 { match self.0.0 {
TransactionOutput::Legacy(legacy_output) => { TransactionOutput::Legacy(legacy_output) => {
WithOptionDatum(&WithZeroAdaAsset(&from_alonzo_output(legacy_output))) WithOptionDatum(&WithZeroAdaAsset(&from_alonzo_output(legacy_output)))
.to_plutus_data() .to_plutus_data()
@ -805,8 +805,8 @@ impl<'a> ToPlutusData
fn to_plutus_data(&self) -> PlutusData { fn to_plutus_data(&self) -> PlutusData {
Data::list( Data::list(
self.0 self.0
.0 .0
.0 .0
.iter() .iter()
.map(|p| { .map(|p| {
WithOptionDatum(&WithZeroAdaAsset(&WithWrappedTransactionId(p))) WithOptionDatum(&WithZeroAdaAsset(&WithWrappedTransactionId(p)))
@ -821,7 +821,7 @@ impl<'a> ToPlutusData for WithZeroAdaAsset<'a, WithWrappedTransactionId<'a, Vec<
fn to_plutus_data(&self) -> PlutusData { fn to_plutus_data(&self) -> PlutusData {
Data::list( Data::list(
self.0 self.0
.0 .0
.iter() .iter()
.map(|p| WithZeroAdaAsset(&WithWrappedTransactionId(p)).to_plutus_data()) .map(|p| WithZeroAdaAsset(&WithWrappedTransactionId(p)).to_plutus_data())
.collect(), .collect(),
@ -834,8 +834,8 @@ impl<'a> ToPlutusData for WithZeroAdaAsset<'a, WithWrappedTransactionId<'a, TxIn
wrap_multiple_with_constr( wrap_multiple_with_constr(
0, 0,
vec![ vec![
WithWrappedTransactionId(&self.0 .0.out_ref).to_plutus_data(), WithWrappedTransactionId(&self.0.0.out_ref).to_plutus_data(),
WithZeroAdaAsset(&self.0 .0.resolved).to_plutus_data(), WithZeroAdaAsset(&self.0.0.resolved).to_plutus_data(),
], ],
) )
} }
@ -848,8 +848,8 @@ impl<'a> ToPlutusData
wrap_multiple_with_constr( wrap_multiple_with_constr(
0, 0,
vec![ vec![
WithWrappedTransactionId(&self.0 .0 .0.out_ref).to_plutus_data(), WithWrappedTransactionId(&self.0.0.0.out_ref).to_plutus_data(),
WithOptionDatum(&WithZeroAdaAsset(&self.0 .0 .0.resolved)).to_plutus_data(), WithOptionDatum(&WithZeroAdaAsset(&self.0.0.0.resolved)).to_plutus_data(),
], ],
) )
} }

View File

@ -1,9 +1,9 @@
use num_bigint::ToBigInt; use num_bigint::ToBigInt;
use pallas_codec::utils::MaybeIndefArray; use pallas_codec::utils::MaybeIndefArray;
use uplc::{ use uplc::{
Constr, PlutusData,
ast::{Constant, Name, Term, Type}, ast::{Constant, Name, Term, Type},
parser::term, parser::term,
Constr, PlutusData,
}; };
// Examples sourced from https://github.com/input-output-hk/plutus/issues/4751#issuecomment-1538377273 // Examples sourced from https://github.com/input-output-hk/plutus/issues/4751#issuecomment-1538377273

View File

@ -13,4 +13,4 @@ requirements = []
source = "github" source = "github"
[etags] [etags]
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1735183696, nanos_since_epoch = 808235000 }, "25c8d0802b8266feca04b47933382c5dee3cadb422208a5d3810d9d2df108c2e"] "aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1742778281, nanos_since_epoch = 899807000 }, "25c8d0802b8266feca04b47933382c5dee3cadb422208a5d3810d9d2df108c2e"]

View File

@ -6,7 +6,7 @@
"plutusVersion": "v3", "plutusVersion": "v3",
"compiler": { "compiler": {
"name": "Aiken", "name": "Aiken",
"version": "v1.1.9+2217206" "version": "v1.1.15+8c55971"
}, },
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
@ -16,7 +16,7 @@
"datum": { "datum": {
"title": "datum", "title": "datum",
"schema": { "schema": {
"$ref": "#/definitions/SpendTokenName" "$ref": "#/definitions/multi~1SpendTokenName"
} }
}, },
"redeemer": { "redeemer": {
@ -33,8 +33,8 @@
} }
} }
], ],
"compiledCode": "59040a01010032323232323232232253330043232323232323232325323233300f300100613233223232325333015300830163754002264a66602c6010602e6ea80044c94ccc05cc028c060dd5003099b8732325333019300b301a37540022900009bad301e301b375400264a666032601660346ea8004530103d87a8000132330010013756603e60386ea8008894ccc078004530103d87a8000132333222533301f337220100062a66603e66e3c02000c4c050cc08cdd400125eb80530103d87a8000133006006001375c603a0026eb4c078004c088008c080004cc030014008dd7180e180c9baa0064800458dd7180d980c1baa00116301a301737546034602e6ea8c068c06cc05cdd5180d180b9baa0011632330010013758603400644a6660320022980103d87a80001332253330183375e601c60346ea80080204c034cc0700092f5c0266008008002603600260380026eacc060c064c064c064c064004c050dd5006180a800980a980b00098089baa0071533300f3002006132323253330123005001132325333017301a00200416375a603000260286ea802c54ccc048c01000454ccc054c050dd50058010b0b18091baa00a1323232323232325333017300a3018375402026464a66603266002008466e3c0600044c8c8cc004004014894ccc07c004528899199911299981019804004919b8f00100415333020323300100100d22533302500114a026644a6660486464a66604c66ebcc0acc0b0c0b0008cdd2a4008660546ea40252f5c0266ebcc070c0a0dd50008068a50302a0013026375400429444cc010010004c09c004c0a000454ccc080c0480084cc0180180045280b0b1bae301e001375a603e0026046004604200266e9520023301d375201497ae014a044646600200200644a66603e00229404cc894ccc078c0140085288998020020009bae302100130220013232333001001375a603c60366ea80492f5c0444a666036601c0042002266600600666e0000920013301f37526e50cdc58010020009bb3300d3019375460380082646600200200444a66603800229444cc894ccc06ccdc39bad301d002480044cc010010004528180f000980f80099299980b9804980c1baa00114bd6f7b63009bab301c30193754002660146eacc06c01001cdd6180d180d980d980d980d8019bac30190033758603000660306030002602e602e00260246ea8028dd7180a18089baa00716370e90011b874800088c8cc00400400c894ccc04c0045300103d87a800013233322253330143372200e0062a66602866e3c01c00c4c024cc060dd300125eb80530103d87a8000133006006001375c60240026eacc04c004c05c008c054004dd2a40004602000260146ea8004c034c03800cc030008c02c008c02c004c018dd50008a4c26cac6eb80055cd2ab9d5573caae7d5d02ba15745", "compiledCode": "590405010100229800aba2aba1aba0aab9faab9eaab9dab9a9bae00248888888966003300130043754013374a90004dc3a4001370e90012444464653001300937540032232330010010032259800800c530103d87a8000899192cc004cdc8802800c56600266e3c0140062601666024602000497ae08a60103d87a80004039133004004301400340386eb8c038004c04400500f4c03401a601a00491112cc004c01c01226466446644b3001300d3012375400513259800980698099baa0018acc004c038c04cdd500144cdc3cc004dd5980b980c180c180c180c0024dd7180b980a1baa0019bae301730143754004911192cc004c044c05cdd5000c5200089bad301b3018375400280b0c9660026022602e6ea8006298103d87a8000899198008009bab301c3019375400444b30010018a6103d87a8000899192cc004cdc8803000c56600266e3c0180062602e6603c603800497ae08a60103d87a80004069133004004302000340686eb8c068004c07400501b202c3300c00300224003164049164048602c60266ea8c058c04cdd5180b180b98099baa30163013375400516404464660020026eb0c054008896600200314c103d87a80008992cc004cdd7980b980a1baa001005898079980b000a5eb8226600600660300048090c058005014180a180a801980900098079baa003300e375400b159800980400244c8cc896600260160031323259800980b80140122c80a0dd6980a80098089baa0048acc004c0280062b3001301137540090028b20248b201e403c26464646644b3001300e3013375400f13259800998009bac3018301930193019301900423371e0260031332232330010010062259800800c528c4c8c9660026600e00c466e3c00400a2b300132330010010092259800800c528456600264b30013375e60426044604400266e95200433020375200897ae0899baf3021301e3754604200201114a080e0c074dd51810000c528c4cc008008c08400501b203c8acc004c050dd6980d80144cc010010c07c00e29410194590194590191bae3019001301c0014068646530010019bad301a301737540154bd702002222598009809801440063300100399b8000248006660366ea4dca19b8b002004001400c80b8dd9980c180a9baa30183758603000c66e95200233017375200e97ae08a50404c44646600200200644b30010018a508acc004c00cdd7180d800c528c4cc008008c070005016203289919800800801912cc00400629462b30013370e6eb4c058c0640052001899801001180d000c5282028405c8090c966002601860246ea8006297adef6c6089bab3016301337540028088cc01cdd5980a8008021bac30150023015301500130143014001300f3754006601c6ea8008dd7180898071baa0058b20184030300c300d001300c004452689b2b20041",
"hash": "3fe854a1171108b9af1e064ee47af2f81c9788104a6f49213dec8bb7" "hash": "2f904329815ffc78edc99e90ca907d86fdd0c8fa886b50bdd42f36fa"
}, },
{ {
"title": "multi.redeem.mint", "title": "multi.redeem.mint",
@ -52,8 +52,8 @@
} }
} }
], ],
"compiledCode": "59040a01010032323232323232232253330043232323232323232325323233300f300100613233223232325333015300830163754002264a66602c6010602e6ea80044c94ccc05cc028c060dd5003099b8732325333019300b301a37540022900009bad301e301b375400264a666032601660346ea8004530103d87a8000132330010013756603e60386ea8008894ccc078004530103d87a8000132333222533301f337220100062a66603e66e3c02000c4c050cc08cdd400125eb80530103d87a8000133006006001375c603a0026eb4c078004c088008c080004cc030014008dd7180e180c9baa0064800458dd7180d980c1baa00116301a301737546034602e6ea8c068c06cc05cdd5180d180b9baa0011632330010013758603400644a6660320022980103d87a80001332253330183375e601c60346ea80080204c034cc0700092f5c0266008008002603600260380026eacc060c064c064c064c064004c050dd5006180a800980a980b00098089baa0071533300f3002006132323253330123005001132325333017301a00200416375a603000260286ea802c54ccc048c01000454ccc054c050dd50058010b0b18091baa00a1323232323232325333017300a3018375402026464a66603266002008466e3c0600044c8c8cc004004014894ccc07c004528899199911299981019804004919b8f00100415333020323300100100d22533302500114a026644a6660486464a66604c66ebcc0acc0b0c0b0008cdd2a4008660546ea40252f5c0266ebcc070c0a0dd50008068a50302a0013026375400429444cc010010004c09c004c0a000454ccc080c0480084cc0180180045280b0b1bae301e001375a603e0026046004604200266e9520023301d375201497ae014a044646600200200644a66603e00229404cc894ccc078c0140085288998020020009bae302100130220013232333001001375a603c60366ea80492f5c0444a666036601c0042002266600600666e0000920013301f37526e50cdc58010020009bb3300d3019375460380082646600200200444a66603800229444cc894ccc06ccdc39bad301d002480044cc010010004528180f000980f80099299980b9804980c1baa00114bd6f7b63009bab301c30193754002660146eacc06c01001cdd6180d180d980d980d980d8019bac30190033758603000660306030002602e602e00260246ea8028dd7180a18089baa00716370e90011b874800088c8cc00400400c894ccc04c0045300103d87a800013233322253330143372200e0062a66602866e3c01c00c4c024cc060dd300125eb80530103d87a8000133006006001375c60240026eacc04c004c05c008c054004dd2a40004602000260146ea8004c034c03800cc030008c02c008c02c004c018dd50008a4c26cac6eb80055cd2ab9d5573caae7d5d02ba15745", "compiledCode": "590405010100229800aba2aba1aba0aab9faab9eaab9dab9a9bae00248888888966003300130043754013374a90004dc3a4001370e90012444464653001300937540032232330010010032259800800c530103d87a8000899192cc004cdc8802800c56600266e3c0140062601666024602000497ae08a60103d87a80004039133004004301400340386eb8c038004c04400500f4c03401a601a00491112cc004c01c01226466446644b3001300d3012375400513259800980698099baa0018acc004c038c04cdd500144cdc3cc004dd5980b980c180c180c180c0024dd7180b980a1baa0019bae301730143754004911192cc004c044c05cdd5000c5200089bad301b3018375400280b0c9660026022602e6ea8006298103d87a8000899198008009bab301c3019375400444b30010018a6103d87a8000899192cc004cdc8803000c56600266e3c0180062602e6603c603800497ae08a60103d87a80004069133004004302000340686eb8c068004c07400501b202c3300c00300224003164049164048602c60266ea8c058c04cdd5180b180b98099baa30163013375400516404464660020026eb0c054008896600200314c103d87a80008992cc004cdd7980b980a1baa001005898079980b000a5eb8226600600660300048090c058005014180a180a801980900098079baa003300e375400b159800980400244c8cc896600260160031323259800980b80140122c80a0dd6980a80098089baa0048acc004c0280062b3001301137540090028b20248b201e403c26464646644b3001300e3013375400f13259800998009bac3018301930193019301900423371e0260031332232330010010062259800800c528c4c8c9660026600e00c466e3c00400a2b300132330010010092259800800c528456600264b30013375e60426044604400266e95200433020375200897ae0899baf3021301e3754604200201114a080e0c074dd51810000c528c4cc008008c08400501b203c8acc004c050dd6980d80144cc010010c07c00e29410194590194590191bae3019001301c0014068646530010019bad301a301737540154bd702002222598009809801440063300100399b8000248006660366ea4dca19b8b002004001400c80b8dd9980c180a9baa30183758603000c66e95200233017375200e97ae08a50404c44646600200200644b30010018a508acc004c00cdd7180d800c528c4cc008008c070005016203289919800800801912cc00400629462b30013370e6eb4c058c0640052001899801001180d000c5282028405c8090c966002601860246ea8006297adef6c6089bab3016301337540028088cc01cdd5980a8008021bac30150023015301500130143014001300f3754006601c6ea8008dd7180898071baa0058b20184030300c300d001300c004452689b2b20041",
"hash": "3fe854a1171108b9af1e064ee47af2f81c9788104a6f49213dec8bb7" "hash": "2f904329815ffc78edc99e90ca907d86fdd0c8fa886b50bdd42f36fa"
}, },
{ {
"title": "multi.redeem.else", "title": "multi.redeem.else",
@ -68,8 +68,8 @@
} }
} }
], ],
"compiledCode": "59040a01010032323232323232232253330043232323232323232325323233300f300100613233223232325333015300830163754002264a66602c6010602e6ea80044c94ccc05cc028c060dd5003099b8732325333019300b301a37540022900009bad301e301b375400264a666032601660346ea8004530103d87a8000132330010013756603e60386ea8008894ccc078004530103d87a8000132333222533301f337220100062a66603e66e3c02000c4c050cc08cdd400125eb80530103d87a8000133006006001375c603a0026eb4c078004c088008c080004cc030014008dd7180e180c9baa0064800458dd7180d980c1baa00116301a301737546034602e6ea8c068c06cc05cdd5180d180b9baa0011632330010013758603400644a6660320022980103d87a80001332253330183375e601c60346ea80080204c034cc0700092f5c0266008008002603600260380026eacc060c064c064c064c064004c050dd5006180a800980a980b00098089baa0071533300f3002006132323253330123005001132325333017301a00200416375a603000260286ea802c54ccc048c01000454ccc054c050dd50058010b0b18091baa00a1323232323232325333017300a3018375402026464a66603266002008466e3c0600044c8c8cc004004014894ccc07c004528899199911299981019804004919b8f00100415333020323300100100d22533302500114a026644a6660486464a66604c66ebcc0acc0b0c0b0008cdd2a4008660546ea40252f5c0266ebcc070c0a0dd50008068a50302a0013026375400429444cc010010004c09c004c0a000454ccc080c0480084cc0180180045280b0b1bae301e001375a603e0026046004604200266e9520023301d375201497ae014a044646600200200644a66603e00229404cc894ccc078c0140085288998020020009bae302100130220013232333001001375a603c60366ea80492f5c0444a666036601c0042002266600600666e0000920013301f37526e50cdc58010020009bb3300d3019375460380082646600200200444a66603800229444cc894ccc06ccdc39bad301d002480044cc010010004528180f000980f80099299980b9804980c1baa00114bd6f7b63009bab301c30193754002660146eacc06c01001cdd6180d180d980d980d980d8019bac30190033758603000660306030002602e602e00260246ea8028dd7180a18089baa00716370e90011b874800088c8cc00400400c894ccc04c0045300103d87a800013233322253330143372200e0062a66602866e3c01c00c4c024cc060dd300125eb80530103d87a8000133006006001375c60240026eacc04c004c05c008c054004dd2a40004602000260146ea8004c034c03800cc030008c02c008c02c004c018dd50008a4c26cac6eb80055cd2ab9d5573caae7d5d02ba15745", "compiledCode": "590405010100229800aba2aba1aba0aab9faab9eaab9dab9a9bae00248888888966003300130043754013374a90004dc3a4001370e90012444464653001300937540032232330010010032259800800c530103d87a8000899192cc004cdc8802800c56600266e3c0140062601666024602000497ae08a60103d87a80004039133004004301400340386eb8c038004c04400500f4c03401a601a00491112cc004c01c01226466446644b3001300d3012375400513259800980698099baa0018acc004c038c04cdd500144cdc3cc004dd5980b980c180c180c180c0024dd7180b980a1baa0019bae301730143754004911192cc004c044c05cdd5000c5200089bad301b3018375400280b0c9660026022602e6ea8006298103d87a8000899198008009bab301c3019375400444b30010018a6103d87a8000899192cc004cdc8803000c56600266e3c0180062602e6603c603800497ae08a60103d87a80004069133004004302000340686eb8c068004c07400501b202c3300c00300224003164049164048602c60266ea8c058c04cdd5180b180b98099baa30163013375400516404464660020026eb0c054008896600200314c103d87a80008992cc004cdd7980b980a1baa001005898079980b000a5eb8226600600660300048090c058005014180a180a801980900098079baa003300e375400b159800980400244c8cc896600260160031323259800980b80140122c80a0dd6980a80098089baa0048acc004c0280062b3001301137540090028b20248b201e403c26464646644b3001300e3013375400f13259800998009bac3018301930193019301900423371e0260031332232330010010062259800800c528c4c8c9660026600e00c466e3c00400a2b300132330010010092259800800c528456600264b30013375e60426044604400266e95200433020375200897ae0899baf3021301e3754604200201114a080e0c074dd51810000c528c4cc008008c08400501b203c8acc004c050dd6980d80144cc010010c07c00e29410194590194590191bae3019001301c0014068646530010019bad301a301737540154bd702002222598009809801440063300100399b8000248006660366ea4dca19b8b002004001400c80b8dd9980c180a9baa30183758603000c66e95200233017375200e97ae08a50404c44646600200200644b30010018a508acc004c00cdd7180d800c528c4cc008008c070005016203289919800800801912cc00400629462b30013370e6eb4c058c0640052001899801001180d000c5282028405c8090c966002601860246ea8006297adef6c6089bab3016301337540028088cc01cdd5980a8008021bac30150023015301500130143014001300f3754006601c6ea8008dd7180898071baa0058b20184030300c300d001300c004452689b2b20041",
"hash": "3fe854a1171108b9af1e064ee47af2f81c9788104a6f49213dec8bb7" "hash": "2f904329815ffc78edc99e90ca907d86fdd0c8fa886b50bdd42f36fa"
}, },
{ {
"title": "oneshot.gift_card.spend", "title": "oneshot.gift_card.spend",
@ -99,8 +99,8 @@
} }
} }
], ],
"compiledCode": "5902730101003232323232323223222533300532323232323232323232532333010300500613233223232325333016300730173754002264a66602e601860306ea80044c8c94ccc070c07c0084c94ccc068cdc39bad301c002480044cdc780080c0a50375c60340022c603a002660160066eb8c070c064dd50008b1804980c1baa3009301837546036603860306ea8c06cc060dd50008b198039bac301a00223375e601260306ea8004014dd5980c980d180d180d180d000980a9baa00c3016001301630170013012375400e2a666020600200c2646464a66602660080022a66602c602a6ea802c0085854ccc04cc02000454ccc058c054dd50058010b0b18099baa00a1323232325333018301b00213232533301730083018375401e2a66602e601060306ea8cc0240148cdd79805980d1baa00101515333017300c00113371e00402a29405854ccc05ccdc3800a4002266e3c0080545281bad3018002375c602c0022c60320026600e6eacc060c064c064c064c06400800cdd6180b80098099baa00a375c602a60246ea801c58dc3a400044646600200200644a66602a0022980103d87a8000133225333014300500213374a90001980c00125eb804cc010010004c05c004c0600048c04c00488c94ccc03cc010c040dd50008a5eb7bdb1804dd5980a18089baa001323300100100322533301300114c103d87a800013233322253330143372200e0062a66602866e3c01c00c4cdd2a4000660306e980092f5c02980103d87a8000133006006001375c60240026eacc04c004c05c008c054004dc3a400460166ea8004c038c03c00cc034008c030008c030004c01cdd50008a4c26cac6eb80055cd2ab9d5573caae7d5d02ba15745", "compiledCode": "5902780101002229800aba2aba1aba0aab9faab9eaab9dab9a9bae00348888888966003300130043754013370e9001488c8cc00400400c896600200314c103d87a80008992cc004c010006266e9520003300b0014bd7044cc00c00cc0340090071805800a0129b874800122223232980098049baa00191192cc004c020c030dd5000c52f5bded8c1137566020601a6ea800500b1919800800801912cc0040062980103d87a8000899192cc004cdc8802800c56600266e3c014006266e9520003301230100024bd7045300103d87a80004039133004004301400340386eb8c038004c04400500f4c03401a601a00491112cc004c02401226466446644b3001300c3012375400513259800980798099baa0018992cc004c064006264b30013370e6eb4c0580052001899b8f375c602a00202714a080a0c0600062c80b0cc024dd5980b980c180c180c180c0021bae301730143754003164048602c60266ea8c058c04cdd5180b180b98099baa301630133754005164044660166eb0c0500048cdd7980a98091baa001003301430150033012001300f3754006601c6ea80162b3001300700489919912cc004c0280062b3001301137540090028b20248acc004c0300062b3001301137540090028b20248b201e403c26464b3001301500189919912cc004c034c04cdd5003c566002601a60266ea8cc038dd6180b802919baf3018301537540020371598009807800c4cdc7801008c52820248b20248acc004cdc3800a400313371e00402314a080910121bae3011001375a602400260280031640486600a6eacc04cc050c050c050c050004008c03cdd500198071baa002375c6022601c6ea80162c806100c0c030c034004c030011149a26cac8011",
"hash": "675eda685b40c32d3d2413fd2027d9f0cd7a07dcb3015fb70c5dc28d" "hash": "54b0903e563399968940db2ee9eda7f683f0a1d44752e65e4d2854e9"
}, },
{ {
"title": "oneshot.gift_card.mint", "title": "oneshot.gift_card.mint",
@ -124,8 +124,8 @@
} }
} }
], ],
"compiledCode": "5902730101003232323232323223222533300532323232323232323232532333010300500613233223232325333016300730173754002264a66602e601860306ea80044c8c94ccc070c07c0084c94ccc068cdc39bad301c002480044cdc780080c0a50375c60340022c603a002660160066eb8c070c064dd50008b1804980c1baa3009301837546036603860306ea8c06cc060dd50008b198039bac301a00223375e601260306ea8004014dd5980c980d180d180d180d000980a9baa00c3016001301630170013012375400e2a666020600200c2646464a66602660080022a66602c602a6ea802c0085854ccc04cc02000454ccc058c054dd50058010b0b18099baa00a1323232325333018301b00213232533301730083018375401e2a66602e601060306ea8cc0240148cdd79805980d1baa00101515333017300c00113371e00402a29405854ccc05ccdc3800a4002266e3c0080545281bad3018002375c602c0022c60320026600e6eacc060c064c064c064c06400800cdd6180b80098099baa00a375c602a60246ea801c58dc3a400044646600200200644a66602a0022980103d87a8000133225333014300500213374a90001980c00125eb804cc010010004c05c004c0600048c04c00488c94ccc03cc010c040dd50008a5eb7bdb1804dd5980a18089baa001323300100100322533301300114c103d87a800013233322253330143372200e0062a66602866e3c01c00c4cdd2a4000660306e980092f5c02980103d87a8000133006006001375c60240026eacc04c004c05c008c054004dc3a400460166ea8004c038c03c00cc034008c030008c030004c01cdd50008a4c26cac6eb80055cd2ab9d5573caae7d5d02ba15745", "compiledCode": "5902780101002229800aba2aba1aba0aab9faab9eaab9dab9a9bae00348888888966003300130043754013370e9001488c8cc00400400c896600200314c103d87a80008992cc004c010006266e9520003300b0014bd7044cc00c00cc0340090071805800a0129b874800122223232980098049baa00191192cc004c020c030dd5000c52f5bded8c1137566020601a6ea800500b1919800800801912cc0040062980103d87a8000899192cc004cdc8802800c56600266e3c014006266e9520003301230100024bd7045300103d87a80004039133004004301400340386eb8c038004c04400500f4c03401a601a00491112cc004c02401226466446644b3001300c3012375400513259800980798099baa0018992cc004c064006264b30013370e6eb4c0580052001899b8f375c602a00202714a080a0c0600062c80b0cc024dd5980b980c180c180c180c0021bae301730143754003164048602c60266ea8c058c04cdd5180b180b98099baa301630133754005164044660166eb0c0500048cdd7980a98091baa001003301430150033012001300f3754006601c6ea80162b3001300700489919912cc004c0280062b3001301137540090028b20248acc004c0300062b3001301137540090028b20248b201e403c26464b3001301500189919912cc004c034c04cdd5003c566002601a60266ea8cc038dd6180b802919baf3018301537540020371598009807800c4cdc7801008c52820248b20248acc004cdc3800a400313371e00402314a080910121bae3011001375a602400260280031640486600a6eacc04cc050c050c050c050004008c03cdd500198071baa002375c6022601c6ea80162c806100c0c030c034004c030011149a26cac8011",
"hash": "675eda685b40c32d3d2413fd2027d9f0cd7a07dcb3015fb70c5dc28d" "hash": "54b0903e563399968940db2ee9eda7f683f0a1d44752e65e4d2854e9"
}, },
{ {
"title": "oneshot.gift_card.else", "title": "oneshot.gift_card.else",
@ -146,8 +146,8 @@
} }
} }
], ],
"compiledCode": "5902730101003232323232323223222533300532323232323232323232532333010300500613233223232325333016300730173754002264a66602e601860306ea80044c8c94ccc070c07c0084c94ccc068cdc39bad301c002480044cdc780080c0a50375c60340022c603a002660160066eb8c070c064dd50008b1804980c1baa3009301837546036603860306ea8c06cc060dd50008b198039bac301a00223375e601260306ea8004014dd5980c980d180d180d180d000980a9baa00c3016001301630170013012375400e2a666020600200c2646464a66602660080022a66602c602a6ea802c0085854ccc04cc02000454ccc058c054dd50058010b0b18099baa00a1323232325333018301b00213232533301730083018375401e2a66602e601060306ea8cc0240148cdd79805980d1baa00101515333017300c00113371e00402a29405854ccc05ccdc3800a4002266e3c0080545281bad3018002375c602c0022c60320026600e6eacc060c064c064c064c06400800cdd6180b80098099baa00a375c602a60246ea801c58dc3a400044646600200200644a66602a0022980103d87a8000133225333014300500213374a90001980c00125eb804cc010010004c05c004c0600048c04c00488c94ccc03cc010c040dd50008a5eb7bdb1804dd5980a18089baa001323300100100322533301300114c103d87a800013233322253330143372200e0062a66602866e3c01c00c4cdd2a4000660306e980092f5c02980103d87a8000133006006001375c60240026eacc04c004c05c008c054004dc3a400460166ea8004c038c03c00cc034008c030008c030004c01cdd50008a4c26cac6eb80055cd2ab9d5573caae7d5d02ba15745", "compiledCode": "5902780101002229800aba2aba1aba0aab9faab9eaab9dab9a9bae00348888888966003300130043754013370e9001488c8cc00400400c896600200314c103d87a80008992cc004c010006266e9520003300b0014bd7044cc00c00cc0340090071805800a0129b874800122223232980098049baa00191192cc004c020c030dd5000c52f5bded8c1137566020601a6ea800500b1919800800801912cc0040062980103d87a8000899192cc004cdc8802800c56600266e3c014006266e9520003301230100024bd7045300103d87a80004039133004004301400340386eb8c038004c04400500f4c03401a601a00491112cc004c02401226466446644b3001300c3012375400513259800980798099baa0018992cc004c064006264b30013370e6eb4c0580052001899b8f375c602a00202714a080a0c0600062c80b0cc024dd5980b980c180c180c180c0021bae301730143754003164048602c60266ea8c058c04cdd5180b180b98099baa301630133754005164044660166eb0c0500048cdd7980a98091baa001003301430150033012001300f3754006601c6ea80162b3001300700489919912cc004c0280062b3001301137540090028b20248acc004c0300062b3001301137540090028b20248b201e403c26464b3001301500189919912cc004c034c04cdd5003c566002601a60266ea8cc038dd6180b802919baf3018301537540020371598009807800c4cdc7801008c52820248b20248acc004cdc3800a400313371e00402314a080910121bae3011001375a602400260280031640486600a6eacc04cc050c050c050c050004008c03cdd500198071baa002375c6022601c6ea80162c806100c0c030c034004c030011149a26cac8011",
"hash": "675eda685b40c32d3d2413fd2027d9f0cd7a07dcb3015fb70c5dc28d" "hash": "54b0903e563399968940db2ee9eda7f683f0a1d44752e65e4d2854e9"
} }
], ],
"definitions": { "definitions": {
@ -161,10 +161,6 @@
"Int": { "Int": {
"dataType": "integer" "dataType": "integer"
}, },
"SpendTokenName": {
"title": "SpendTokenName",
"dataType": "bytes"
},
"cardano/transaction/OutputReference": { "cardano/transaction/OutputReference": {
"title": "OutputReference", "title": "OutputReference",
"description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output", "description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output",
@ -207,6 +203,10 @@
} }
] ]
}, },
"multi/SpendTokenName": {
"title": "SpendTokenName",
"dataType": "bytes"
},
"oneshot/Action": { "oneshot/Action": {
"title": "Action", "title": "Action",
"anyOf": [ "anyOf": [