From 75df25e0d61347014cf0c47432b41db1207f3b0b Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Tue, 22 Oct 2024 22:19:56 -0300 Subject: [PATCH] improve ergonomics --- pallas-txbuilder/src/transaction/model.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pallas-txbuilder/src/transaction/model.rs b/pallas-txbuilder/src/transaction/model.rs index 290adcd4..29341dc2 100644 --- a/pallas-txbuilder/src/transaction/model.rs +++ b/pallas-txbuilder/src/transaction/model.rs @@ -286,8 +286,14 @@ impl StagingTransaction { self } - pub fn language_view(mut self, plutus_version: u8, cost_model: Vec) -> Self { - self.language_view = Some(scriptdata::LanguageView(plutus_version, cost_model)); + pub fn language_view(mut self, plutus_version: ScriptKind, cost_model: Vec) -> Self { + self.language_view = match plutus_version { + ScriptKind::PlutusV1 => Some(scriptdata::LanguageView(0, cost_model)), + ScriptKind::PlutusV2 => Some(scriptdata::LanguageView(1, cost_model)), + ScriptKind::PlutusV3 => Some(scriptdata::LanguageView(2, cost_model)), + ScriptKind::Native => None, + }; + self }