Add 'plutusVersion' to blueprints.

This commit is contained in:
KtorZ 2023-02-21 15:37:35 +01:00
parent 82a32a082b
commit c0230a811f
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 22 additions and 3 deletions

View File

@ -16,15 +16,28 @@ pub struct Blueprint<T: Default> {
}
#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Preamble {
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub version: String,
pub plutus_version: PlutusVersion,
#[serde(skip_serializing_if = "Option::is_none")]
pub license: Option<String>,
}
#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlutusVersion {
V1,
V2,
}
#[derive(Debug, PartialEq, Clone)]
pub enum LookupResult<'a, T> {
One(&'a T),
@ -112,6 +125,7 @@ impl From<&Config> for Preamble {
} else {
Some(config.description.clone())
},
plutus_version: PlutusVersion::V2,
version: config.version.clone(),
license: config.license.clone(),
}
@ -130,6 +144,7 @@ mod test {
title: "Foo".to_string(),
description: None,
version: "1.0.0".to_string(),
plutus_version: PlutusVersion::V2,
license: Some("Apache-2.0".to_string()),
},
validators: vec![],
@ -140,6 +155,7 @@ mod test {
"preamble": {
"title": "Foo",
"version": "1.0.0",
"plutusVersion": "v2",
"license": "Apache-2.0"
},
"validators": []
@ -154,6 +170,7 @@ mod test {
title: "Foo".to_string(),
description: Some("Lorem ipsum".to_string()),
version: "1.0.0".to_string(),
plutus_version: PlutusVersion::V2,
license: None,
},
validators: vec![],
@ -165,6 +182,7 @@ mod test {
"title": "Foo",
"description": "Lorem ipsum",
"version": "1.0.0",
"plutusVersion": "v2"
},
"validators": []
}),

View File

@ -2,7 +2,8 @@
"preamble": {
"title": "aiken-lang/hello_world",
"description": "Aiken contracts for project 'aiken-lang/hello_world'",
"version": "1.0.0"
"version": "1.0.0",
"plutusVersion": "v2"
},
"validators": [
{
@ -39,8 +40,8 @@
}
]
},
"compiledCode": "58e10100003232323232323232222533300632323232533300a002100114a06464660026eb0cc010c014cc010c014019200048040dd7198021802804240006002002444a66601e00429404c8c94ccc038cdc78010018a5113330050050010033012003375c602000466e5cc8dcc8009bae330013002004480012410d48656c6c6f2c20576f726c64210022323330010014800000c888cccc030cdc3802001008119980200219b8000348008c0480040048c024dd50008a4c2c6002002444a66600e004293099802980098040011998018019804801000ab9a5736aae7955cfaba15745",
"hash": "287233442cf812fafd74ab135d665f110de89ac12775204ad741f220"
"compiledCode": "58dd0100003232323232323232222533300632323232533300a002100114a06464660026eb0cc010c014cc010c014019200048040dd7198021802804240006002002444a66601e00429404c8c94ccc038cdc78010018a5113330050050010033012003375c602000466e3cdd71980098010022400091010d48656c6c6f2c20576f726c64210022323330010014800000c888cccc030cdc3802001008119980200219b8000348008c0480040048c024dd50008a4c2c6002002444a66600e004293099802980098040011998018019804801000ab9a5736aae7955cfaba15745",
"hash": "46872294cadbacb2c3214086c0129ede75cf9f767e95a449f996685f"
}
]
}