feat: use plutus version in convert command

relates to #907
This commit is contained in:
rvcas 2024-05-21 17:05:02 -04:00
parent f306f1715a
commit 050d003b27
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
1 changed files with 8 additions and 1 deletions

View File

@ -69,6 +69,13 @@ pub fn exec(
let blueprint: Blueprint = let blueprint: Blueprint =
serde_json::from_reader(BufReader::new(blueprint)).into_diagnostic()?; serde_json::from_reader(BufReader::new(blueprint)).into_diagnostic()?;
let opt_config = Config::load(&project_path).ok();
let cardano_cli_type = opt_config
.map(|config| config.plutus_version)
.unwrap_or_default()
.cardano_cli_type();
// Perform the conversion // Perform the conversion
let when_too_many = let when_too_many =
|known_validators| ProjectError::MoreThanOneValidatorFound { known_validators }; |known_validators| ProjectError::MoreThanOneValidatorFound { known_validators };
@ -89,7 +96,7 @@ pub fn exec(
let cbor_hex = hex::encode(double_cbor_bytes); let cbor_hex = hex::encode(double_cbor_bytes);
Ok(json!({ Ok(json!({
"type": "PlutusScriptV2", "type": cardano_cli_type,
"description": "Generated by Aiken", "description": "Generated by Aiken",
"cborHex": cbor_hex "cborHex": cbor_hex
})) }))