Skip to content

Commit

Permalink
improve ergonomics
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Oct 23, 2024
1 parent 0c4e18a commit 75df25e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pallas-txbuilder/src/transaction/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,14 @@ impl StagingTransaction {
self
}

pub fn language_view(mut self, plutus_version: u8, cost_model: Vec<i64>) -> Self {
self.language_view = Some(scriptdata::LanguageView(plutus_version, cost_model));
pub fn language_view(mut self, plutus_version: ScriptKind, cost_model: Vec<i64>) -> 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
}

Expand Down

0 comments on commit 75df25e

Please sign in to comment.