From b1bb537ed96befa64bb1dd783b00a948499ce9a8 Mon Sep 17 00:00:00 2001 From: SIDANWhatever Date: Sun, 21 Jan 2024 21:36:55 +0800 Subject: [PATCH 1/3] feat: change serialize return type to option --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/builder/models.rs | 8 ++++---- src/utils/csl.rs | 14 +++++++------- tests/unit_tests.rs | 41 +++++++++++++++++++++++------------------ 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cab7020..4afc23d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -697,7 +697,7 @@ dependencies = [ [[package]] name = "sidan-csl-rs" -version = "0.1.5" +version = "0.1.6" dependencies = [ "cardano-serialization-lib", "getrandom", diff --git a/Cargo.toml b/Cargo.toml index 2ef8eb4..f02046b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sidan-csl-rs" -version = "0.1.5" +version = "0.1.6" edition = "2021" license = "MIT" description = "Wrapper around the cardano-serialization-lib for easier transaction building, heavily inspired by cardano-cli APIs" diff --git a/src/builder/models.rs b/src/builder/models.rs index 26b9d9f..f6cc75c 100644 --- a/src/builder/models.rs +++ b/src/builder/models.rs @@ -158,7 +158,7 @@ pub struct Datum { #[derive(Clone, Debug, PartialEq)] pub struct SerializedAddress { - pub pub_key_hash: String, - pub script_hash: String, - pub stake_key_hash: String, -} \ No newline at end of file + pub pub_key_hash: Option, + pub script_hash: Option, + pub stake_key_hash: Option, +} diff --git a/src/utils/csl.rs b/src/utils/csl.rs index 6c805a9..1047567 100644 --- a/src/utils/csl.rs +++ b/src/utils/csl.rs @@ -93,7 +93,7 @@ pub fn script_to_address( } } -pub fn serialize_bech32_script_address(bech32_addr: String) -> SerializedAddress { +pub fn serialize_bech32_address(bech32_addr: String) -> SerializedAddress { let csl_address = csl::address::BaseAddress::from_address( &csl::address::Address::from_bech32(&bech32_addr).unwrap(), ); @@ -102,17 +102,17 @@ pub fn serialize_bech32_script_address(bech32_addr: String) -> SerializedAddress let csl_key_hash = address .payment_cred() .to_keyhash() - .map_or("".to_string(), |key_hash| key_hash.to_hex()); + .map(|key_hash| key_hash.to_hex()); let csl_script_hash = address .payment_cred() .to_scripthash() - .map_or("".to_string(), |script_hash| script_hash.to_hex()); + .map(|script_hash| script_hash.to_hex()); let csl_stake_key_hash = address .stake_cred() .to_keyhash() - .map_or("".to_string(), |stake_key_hash| stake_key_hash.to_hex()); + .map(|stake_key_hash| stake_key_hash.to_hex()); SerializedAddress { pub_key_hash: csl_key_hash, @@ -129,17 +129,17 @@ pub fn serialize_bech32_script_address(bech32_addr: String) -> SerializedAddress let csl_key_hash = csl_enterprize_address .payment_cred() .to_keyhash() - .map_or("".to_string(), |key_hash| key_hash.to_hex()); + .map(|key_hash| key_hash.to_hex()); let csl_script_hash = csl_enterprize_address .payment_cred() .to_scripthash() - .map_or("".to_string(), |script_hash| script_hash.to_hex()); + .map(|script_hash| script_hash.to_hex()); SerializedAddress { pub_key_hash: csl_key_hash, script_hash: csl_script_hash, - stake_key_hash: "".to_string(), + stake_key_hash: None, } } } diff --git a/tests/unit_tests.rs b/tests/unit_tests.rs index ff29617..6aebb04 100644 --- a/tests/unit_tests.rs +++ b/tests/unit_tests.rs @@ -6,7 +6,7 @@ mod tests { core::MeshTxBuilderCore, models::{Asset, Budget, Redeemer, SerializedAddress}, }, - utils::csl::serialize_bech32_script_address, + utils::csl::serialize_bech32_address, }; #[test] @@ -263,40 +263,45 @@ mod tests { #[test] fn test_serialize_address() { let addr1 = "addr_test1qz8j439j54afpl4hw978xcw8qsa0dsmyd6wm9v8xzeyz7ucrj5rt3et7z59mvmmpxnejvn2scwmseezdq5h5fpw08z8s8d93my"; - let addr1_result = serialize_bech32_script_address(addr1.to_string()); + let addr1_result = serialize_bech32_address(addr1.to_string()); assert!( addr1_result == SerializedAddress { - pub_key_hash: "8f2ac4b2a57a90feb7717c7361c7043af6c3646e9db2b0e616482f73" - .to_string(), - script_hash: "".to_string(), - stake_key_hash: "039506b8e57e150bb66f6134f3264d50c3b70ce44d052f4485cf388f" - .to_string() + pub_key_hash: Some( + "8f2ac4b2a57a90feb7717c7361c7043af6c3646e9db2b0e616482f73".to_string() + ), + script_hash: None, + stake_key_hash: Some( + "039506b8e57e150bb66f6134f3264d50c3b70ce44d052f4485cf388f".to_string() + ) } ); let addr2 = "addr_test1zqjmsmh2sjjy508e3068pck6lgp23k2msypgc52cxcgzjlju5ayjvx4rk9a29n2tqf4uv4nvfv2yy8tqs0kuue8luh9s5cdt49"; - let addr2_result = serialize_bech32_script_address(addr2.to_string()); + let addr2_result = serialize_bech32_address(addr2.to_string()); assert!( addr2_result == SerializedAddress { - pub_key_hash: "".to_string(), - script_hash: "25b86eea84a44a3cf98bf470e2dafa02a8d95b81028c51583610297e" - .to_string(), - stake_key_hash: "5ca749261aa3b17aa2cd4b026bc6566c4b14421d6083edce64ffe5cb" - .to_string(), + pub_key_hash: None, + script_hash: Some( + "25b86eea84a44a3cf98bf470e2dafa02a8d95b81028c51583610297e".to_string() + ), + stake_key_hash: Some( + "5ca749261aa3b17aa2cd4b026bc6566c4b14421d6083edce64ffe5cb".to_string() + ), } ); let addr3 = "addr_test1vpw22xesfv0hnkfw4k5vtrz386tfgkxu6f7wfadug7prl7s6gt89x"; - let addr3_result = serialize_bech32_script_address(addr3.to_string()); + let addr3_result = serialize_bech32_address(addr3.to_string()); assert!( addr3_result == SerializedAddress { - pub_key_hash: "5ca51b304b1f79d92eada8c58c513e969458dcd27ce4f5bc47823ffa" - .to_string(), - script_hash: "".to_string(), - stake_key_hash: "".to_string(), + pub_key_hash: Some( + "5ca51b304b1f79d92eada8c58c513e969458dcd27ce4f5bc47823ffa".to_string() + ), + script_hash: None, + stake_key_hash: None, } ) } From 6aa718b6e272c7e72143c828ecace77d8a31f67a Mon Sep 17 00:00:00 2001 From: SIDANWhatever Date: Sun, 21 Jan 2024 22:08:33 +0800 Subject: [PATCH 2/3] feat: building get v2 script hash --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/utils/csl.rs | 10 ++++++++++ tests/unit_tests.rs | 9 ++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4afc23d..7f4f77b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -697,7 +697,7 @@ dependencies = [ [[package]] name = "sidan-csl-rs" -version = "0.1.6" +version = "0.1.7" dependencies = [ "cardano-serialization-lib", "getrandom", diff --git a/Cargo.toml b/Cargo.toml index f02046b..ee45c20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sidan-csl-rs" -version = "0.1.6" +version = "0.1.7" edition = "2021" license = "MIT" description = "Wrapper around the cardano-serialization-lib for easier transaction building, heavily inspired by cardano-cli APIs" diff --git a/src/utils/csl.rs b/src/utils/csl.rs index 1047567..8a46cd1 100644 --- a/src/utils/csl.rs +++ b/src/utils/csl.rs @@ -144,3 +144,13 @@ pub fn serialize_bech32_address(bech32_addr: String) -> SerializedAddress { } } } + +pub fn get_v2_script_hash(script: &str) -> String { + csl::plutus::PlutusScript::from_hex_with_version( + script, + &csl::plutus::Language::new_plutus_v2(), + ) + .unwrap() + .hash() + .to_hex() +} diff --git a/tests/unit_tests.rs b/tests/unit_tests.rs index 6aebb04..c1d8f38 100644 --- a/tests/unit_tests.rs +++ b/tests/unit_tests.rs @@ -6,7 +6,7 @@ mod tests { core::MeshTxBuilderCore, models::{Asset, Budget, Redeemer, SerializedAddress}, }, - utils::csl::serialize_bech32_address, + utils::csl::{get_v2_script_hash, serialize_bech32_address}, }; #[test] @@ -305,4 +305,11 @@ mod tests { } ) } + + #[test] + fn test_get_v2_script_hash() { + let correct_hash = "cc1bff3c00536918d99a78bd7548e864ffad95c8b6de562f709f0114"; + let compiled_code = "584501000032323232323222533300432323253330073370e900018041baa0011324a2600c0022c60120026012002600600229309b2b118021baa0015734aae7555cf2ba157441"; + assert_eq!(get_v2_script_hash(compiled_code), correct_hash); + } } From 736e8c75d44d7659eb37e83eb2861c4f35552de7 Mon Sep 17 00:00:00 2001 From: SIDANWhatever Date: Mon, 22 Jan 2024 10:29:53 +0800 Subject: [PATCH 3/3] feat: building plutus types --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/builder/core.rs | 2 +- src/builder/mod.rs | 1 - src/lib.rs | 1 + src/{builder/models.rs => model/builder.rs} | 0 src/model/mod.rs | 1 + src/utils/csl.rs | 11 +- src/utils/mod.rs | 1 + src/utils/plutus_types.rs | 240 ++++++++++++++++++++ tests/integration_tests.rs | 12 +- tests/unit_tests.rs | 17 +- 12 files changed, 268 insertions(+), 22 deletions(-) rename src/{builder/models.rs => model/builder.rs} (100%) create mode 100644 src/model/mod.rs create mode 100644 src/utils/plutus_types.rs diff --git a/Cargo.lock b/Cargo.lock index 7f4f77b..e63de39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -697,7 +697,7 @@ dependencies = [ [[package]] name = "sidan-csl-rs" -version = "0.1.7" +version = "0.1.8" dependencies = [ "cardano-serialization-lib", "getrandom", diff --git a/Cargo.toml b/Cargo.toml index ee45c20..357f119 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sidan-csl-rs" -version = "0.1.7" +version = "0.1.8" edition = "2021" license = "MIT" description = "Wrapper around the cardano-serialization-lib for easier transaction building, heavily inspired by cardano-cli APIs" diff --git a/src/builder/core.rs b/src/builder/core.rs index 7c48bef..e1ca8b3 100644 --- a/src/builder/core.rs +++ b/src/builder/core.rs @@ -1,7 +1,7 @@ use cardano_serialization_lib as csl; use crate::{ - builder::models::*, + model::builder::*, utils::csl::{build_tx_builder, to_bignum, to_value}, }; diff --git a/src/builder/mod.rs b/src/builder/mod.rs index 12598c9..5a7ca06 100644 --- a/src/builder/mod.rs +++ b/src/builder/mod.rs @@ -1,2 +1 @@ pub mod core; -pub mod models; diff --git a/src/lib.rs b/src/lib.rs index 9d82c9d..0234df5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,3 @@ pub mod builder; +pub mod model; pub mod utils; diff --git a/src/builder/models.rs b/src/model/builder.rs similarity index 100% rename from src/builder/models.rs rename to src/model/builder.rs diff --git a/src/model/mod.rs b/src/model/mod.rs new file mode 100644 index 0000000..5575a85 --- /dev/null +++ b/src/model/mod.rs @@ -0,0 +1 @@ +pub mod builder; diff --git a/src/utils/csl.rs b/src/utils/csl.rs index 8a46cd1..ed98c30 100644 --- a/src/utils/csl.rs +++ b/src/utils/csl.rs @@ -1,6 +1,6 @@ use cardano_serialization_lib as csl; -use crate::builder::models::*; +use crate::model::builder::*; use hex::FromHex; pub fn to_bignum(val: u64) -> csl::utils::BigNum { @@ -154,3 +154,12 @@ pub fn get_v2_script_hash(script: &str) -> String { .hash() .to_hex() } + +pub fn address_bech32_to_obj(bech32: &str) {} + +// export const addrBech32ToObj = (bech32: string): T => { +// const hexAddress = csl.Address.from_bech32(bech32).to_hex(); +// const cslAddress = csl.Address.from_hex(hexAddress); +// const json = JSON.parse(csl.PlutusData.from_address(cslAddress).to_json(1)); +// return json; +// }; diff --git a/src/utils/mod.rs b/src/utils/mod.rs index fd8cc78..7eadf28 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,3 +1,4 @@ pub mod aiken; pub mod csl; pub mod parser; +pub mod plutus_types; diff --git a/src/utils/plutus_types.rs b/src/utils/plutus_types.rs new file mode 100644 index 0000000..a9727b0 --- /dev/null +++ b/src/utils/plutus_types.rs @@ -0,0 +1,240 @@ +use serde_json::{json, Value}; + +pub fn con_str, T: Into>(constructor: N, fields: T) -> Value { + json!({ "constructor": constructor.into(), "fields": fields.into() }) +} + +pub fn con_str0>(fields: T) -> Value { + con_str(0, fields) +} + +pub fn con_str1>(fields: T) -> Value { + con_str(1, fields) +} + +pub fn con_str2>(fields: T) -> Value { + con_str(2, fields) +} + +pub fn bool(b: bool) -> Value { + if b { + con_str1(json!([])) + } else { + con_str0(json!([])) + } +} + +pub fn builtin_byte_string(bytes: &str) -> Value { + json!({ "bytes": bytes }) +} + +pub fn integer(int: i32) -> Value { + json!({ "int": int }) +} + +pub fn list>(p_list: Vec) -> Value { + let list: Vec = p_list.into_iter().map(|item| item.into()).collect(); + json!({ "list": list }) +} + +// Other functions like currencySymbol, tokenName, etc., would create JSON objects +pub fn currency_symbol(policy_id: &str) -> Value { + builtin_byte_string(policy_id) +} + +pub fn token_name(token_name: &str) -> Value { + builtin_byte_string(token_name) +} + +pub fn maybe_staking_hash(stake_credential: &str) -> Value { + if stake_credential.is_empty() { + con_str1(json!([])) + } else { + con_str0(vec![con_str0(vec![con_str0(vec![builtin_byte_string( + stake_credential, + )])])]) + } +} + +pub fn pub_key_address(bytes: &str, stake_credential: Option<&str>) -> Value { + con_str0(vec![ + con_str0(vec![builtin_byte_string(bytes)]), + maybe_staking_hash(stake_credential.unwrap_or("")), + ]) +} + +pub fn script_address(bytes: &str, stake_credential: Option<&str>) -> Value { + con_str0(vec![ + con_str1(vec![builtin_byte_string(bytes)]), + maybe_staking_hash(stake_credential.unwrap_or("")), + ]) +} + +pub fn asset_class(policy_id: &str, asset_name: &str) -> Value { + con_str0(vec![currency_symbol(policy_id), token_name(asset_name)]) +} + +pub fn tx_out_ref(tx_hash: &str, index: i32) -> Value { + con_str0(vec![ + con_str0(vec![builtin_byte_string(tx_hash)]), + integer(index), + ]) +} + +pub fn assoc_map, V: Into>(items_map: Vec<(K, V)>) -> Value { + let map: Vec = items_map + .into_iter() + .map(|(k, v)| json!({"k": k.into(), "v": v.into()})) + .collect(); + json!({ "map": map }) +} + +pub fn tuple, V: Into>(key: K, value: V) -> Value { + con_str0(vec![key.into(), value.into()]) +} + +pub fn payment_pub_key_hash(pub_key_hash: &str) -> Value { + builtin_byte_string(pub_key_hash) +} + +pub fn pub_key_hash(pub_key_hash: &str) -> Value { + builtin_byte_string(pub_key_hash) +} + +pub fn posix_time(posix_time: i32) -> Value { + integer(posix_time) +} + +#[test] +fn test_con_str() { + let correct_con_str = "{\"constructor\":10,\"fields\":[{\"bytes\":\"hello\"}]}"; + assert_eq!( + con_str(10, json!([builtin_byte_string("hello")])).to_string(), + correct_con_str + ); +} + +#[test] +fn test_con_str0() { + let correct_con_str0 = "{\"constructor\":0,\"fields\":{\"bytes\":\"hello\"}}"; + assert_eq!( + con_str0(builtin_byte_string("hello")).to_string(), + correct_con_str0 + ); +} + +#[test] +fn test_con_str1() { + let correct_con_str1 = "{\"constructor\":1,\"fields\":{\"bytes\":\"hello\"}}"; + assert_eq!( + con_str1(builtin_byte_string("hello")).to_string(), + correct_con_str1 + ); +} + +#[test] +fn test_con_str2() { + let correct_con_str2 = "{\"constructor\":2,\"fields\":{\"bytes\":\"hello\"}}"; + assert_eq!( + con_str2(builtin_byte_string("hello")).to_string(), + correct_con_str2 + ); +} + +#[test] +fn test_bool() { + let correct_bool = "{\"constructor\":1,\"fields\":[]}"; + assert_eq!(bool(true).to_string(), correct_bool); +} + +#[test] +fn test_builtin_byte_string() { + let correct_builtin_byte_string = "{\"bytes\":\"hello\"}"; + assert_eq!( + builtin_byte_string("hello").to_string(), + correct_builtin_byte_string + ); +} + +#[test] +fn test_integer() { + let correct_integer = "{\"int\":1}"; + assert_eq!(integer(1).to_string(), correct_integer); +} + +#[test] +fn test_list() { + let correct_list = "{\"list\":[1,2,3]}"; + assert_eq!(list(vec![1, 2, 3]).to_string(), correct_list); +} + +#[test] +fn test_maybe_staking_hash() { + let correct_maybe_staking_hash = "{\"constructor\":0,\"fields\":[{\"constructor\":0,\"fields\":[{\"constructor\":0,\"fields\":[{\"bytes\":\"hello\"}]}]}]}"; + assert_eq!( + maybe_staking_hash("hello").to_string(), + correct_maybe_staking_hash + ); +} + +#[test] +fn test_pub_key_address() { + let correct_pub_key_address = "{\"constructor\":0,\"fields\":[{\"constructor\":0,\"fields\":[{\"bytes\":\"8f2ac4b2a57a90feb7717c7361c7043af6c3646e9db2b0e616482f73\"}]},{\"constructor\":0,\"fields\":[{\"constructor\":0,\"fields\":[{\"constructor\":0,\"fields\":[{\"bytes\":\"039506b8e57e150bb66f6134f3264d50c3b70ce44d052f4485cf388f\"}]}]}]}]}"; + assert_eq!( + pub_key_address( + "8f2ac4b2a57a90feb7717c7361c7043af6c3646e9db2b0e616482f73", + Some("039506b8e57e150bb66f6134f3264d50c3b70ce44d052f4485cf388f") + ) + .to_string(), + correct_pub_key_address + ); +} + +#[test] +fn test_script_address() { + let correct_script_address = "{\"constructor\":0,\"fields\":[{\"constructor\":1,\"fields\":[{\"bytes\":\"hello\"}]},{\"constructor\":1,\"fields\":[]}]}"; + assert_eq!( + script_address("hello", None).to_string(), + correct_script_address + ); +} + +#[test] +fn test_asset_class() { + let correct_asset_class = + "{\"constructor\":0,\"fields\":[{\"bytes\":\"hello\"},{\"bytes\":\"world\"}]}"; + assert_eq!( + asset_class("hello", "world").to_string(), + correct_asset_class + ); +} + +#[test] +fn test_tx_out_ref() { + let correct_tx_out_ref = "{\"constructor\":0,\"fields\":[{\"constructor\":0,\"fields\":[{\"bytes\":\"hello\"}]},{\"int\":12}]}"; + assert_eq!(tx_out_ref("hello", 12).to_string(), correct_tx_out_ref); +} + +#[test] +fn test_assoc_map() { + let correct_assoc_map = + "{\"map\":[{\"k\":{\"bytes\":\"hello\"},\"v\":{\"bytes\":\"world\"}},{\"k\":{\"bytes\":\"123\"},\"v\":{\"bytes\":\"456\"}}]}"; + assert_eq!( + assoc_map(vec![ + (builtin_byte_string("hello"), builtin_byte_string("world")), + (builtin_byte_string("123"), builtin_byte_string("456")) + ]) + .to_string(), + correct_assoc_map + ); +} + +#[test] +fn test_tuple() { + let correct_tuple = + "{\"constructor\":0,\"fields\":[{\"bytes\":\"hello\"},{\"bytes\":\"world\"}]}"; + assert_eq!( + tuple(builtin_byte_string("hello"), builtin_byte_string("world")).to_string(), + correct_tuple + ); +} diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 17a2e7a..3c236fe 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1,8 +1,8 @@ mod int_tests { use serde_json::{json, to_string}; - use sidan_csl_rs::builder::{ - core::MeshTxBuilderCore, - models::{Asset, Budget, Redeemer}, + use sidan_csl_rs::{ + builder::core::MeshTxBuilderCore, + model::builder::{Asset, Budget, LanguageVersion, Redeemer}, }; #[test] @@ -65,7 +65,7 @@ mod int_tests { cns_token_mp_script_ref_txhash.to_string(), cns_token_mp_script_ref_txid.parse::().unwrap(), cns_policy_id.to_string(), - sidan_csl_rs::builder::models::LanguageVersion::V2, + LanguageVersion::V2, ) .mint_redeemer_value(Redeemer { data: to_string(&json!({ @@ -104,7 +104,7 @@ mod int_tests { record_validator_script_ref_txhash.to_string(), record_validator_script_ref_txid.parse::().unwrap(), "8be60057c65fbae6d5c0673f899fea68868b16aeba6ff06f2d7f3161".to_string(), - sidan_csl_rs::builder::models::LanguageVersion::V2, + LanguageVersion::V2, ) .tx_out( wallet_address.to_string(), @@ -169,6 +169,6 @@ mod int_tests { .change_address(wallet_address.to_string()) .complete_sync(None); - assert!(mesh.tx_hex != "".to_string()); + assert!(mesh.tx_hex != *""); } } diff --git a/tests/unit_tests.rs b/tests/unit_tests.rs index c1d8f38..4537f47 100644 --- a/tests/unit_tests.rs +++ b/tests/unit_tests.rs @@ -2,10 +2,8 @@ mod tests { use serde_json::{json, to_string}; use sidan_csl_rs::utils::csl::script_to_address; use sidan_csl_rs::{ - builder::{ - core::MeshTxBuilderCore, - models::{Asset, Budget, Redeemer, SerializedAddress}, - }, + builder::core::MeshTxBuilderCore, + model::builder::{Asset, Budget, LanguageVersion, Redeemer, SerializedAddress}, utils::csl::{get_v2_script_hash, serialize_bech32_address}, }; @@ -116,7 +114,7 @@ mod tests { "bb712547a5abe3697f8aba72870e33a52fd2c0401715950197f9b7370d137998".to_string(), 0, "8be60057c65fbae6d5c0673f899fea68868b16aeba6ff06f2d7f3161".to_string(), - sidan_csl_rs::builder::models::LanguageVersion::V2, + LanguageVersion::V2, ) .tx_in_datum_value(data.clone()) .spending_reference_tx_in_redeemer_value(Redeemer { @@ -150,10 +148,7 @@ mod tests { vec![asset], "addr_test1vr3vljjxan0hl6u28fle2l4ds6ugc9t08lwevpauk38t3agx7rtq6".to_string(), ) - .tx_in_script( - script_cbor, - sidan_csl_rs::builder::models::LanguageVersion::V2, - ) + .tx_in_script(script_cbor, LanguageVersion::V2) .tx_in_datum_value(data.clone()) .spending_reference_tx_in_redeemer_value(Redeemer { data: data.clone(), @@ -189,7 +184,7 @@ mod tests { "bb712547a5abe3697f8aba72870e33a52fd2c0401715950197f9b7370d137998".to_string(), 0, "8be60057c65fbae6d5c0673f899fea68868b16aeba6ff06f2d7f3161".to_string(), - sidan_csl_rs::builder::models::LanguageVersion::V2, + LanguageVersion::V2, ) .tx_in_datum_value(data.clone()) .spending_reference_tx_in_redeemer_value(Redeemer { @@ -227,7 +222,7 @@ mod tests { "63210437b543c8a11afbbc6765aa205eb2733cb74e2805afd4c1c8cb72bd8e22".to_string(), 0, "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700".to_string(), - sidan_csl_rs::builder::models::LanguageVersion::V2, + LanguageVersion::V2, ) .mint_redeemer_value(Redeemer { data: to_string(&json!({