Skip to content

Commit 38bbca6

Browse files
authored
Merge pull request #569 from Emurgo/release/11.2.2
11.3.0 "I know that reference"
2 parents dbcd3e3 + 5912111 commit 38bbca6

9 files changed

+244
-9
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cardano-serialization-lib",
3-
"version": "11.2.1",
3+
"version": "11.3.0",
44
"description": "(De)serialization functions for the Cardano blockchain along with related utility functions",
55
"scripts": {
66
"rust:build-nodejs": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=nodejs; cd ..; npm run js:ts-json-gen; cd rust; wasm-pack pack) && npm run js:flowgen",

rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cardano-serialization-lib"
3-
version = "11.2.1"
3+
version = "11.3.0"
44
edition = "2018"
55
authors = ["EMURGO"]
66
license = "MIT"

rust/json-gen/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/pkg/cardano_serialization_lib.js.flow

+19
Original file line numberDiff line numberDiff line change
@@ -3954,6 +3954,11 @@ declare export class MintBuilder {
39543954
*/
39553955
get_plutus_witnesses(): PlutusWitnesses;
39563956

3957+
/**
3958+
* @returns {TransactionInputs}
3959+
*/
3960+
get_ref_inputs(): TransactionInputs;
3961+
39573962
/**
39583963
* @returns {Redeemers}
39593964
*/
@@ -5007,6 +5012,10 @@ declare export class PlutusScriptSource {
50075012
static new(script: PlutusScript): PlutusScriptSource;
50085013

50095014
/**
5015+
* !!! DEPRECATED !!!
5016+
* This constructor has missed information about plutus script language vesrion. That can affect
5017+
* the script data hash calculation.
5018+
* Use `.new_ref_input_with_lang_ver` instead
50105019
* @param {ScriptHash} script_hash
50115020
* @param {TransactionInput} input
50125021
* @returns {PlutusScriptSource}
@@ -5131,6 +5140,16 @@ declare export class PlutusWitness {
51315140
redeemer: Redeemer
51325141
): PlutusWitness;
51335142

5143+
/**
5144+
* @param {PlutusScriptSource} script
5145+
* @param {Redeemer} redeemer
5146+
* @returns {PlutusWitness}
5147+
*/
5148+
static new_with_ref_without_datum(
5149+
script: PlutusScriptSource,
5150+
redeemer: Redeemer
5151+
): PlutusWitness;
5152+
51345153
/**
51355154
* @returns {PlutusScript | void}
51365155
*/

rust/src/tx_builder.rs

+184-1
Large diffs are not rendered by default.

rust/src/tx_builder/mint_builder.rs

+20-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ impl MintBuilder {
148148
match script_mint {
149149
ScriptMint::Plutus(plutus_mints) => {
150150
for (redeemer, _) in &plutus_mints.redeemer_mints {
151-
if let PlutusScriptSourceEnum::Script(script) = &plutus_mints.script {
152-
plutus_witnesses.push(PlutusWitness::new_without_datum(script, redeemer));
153-
}
151+
plutus_witnesses.push(
152+
PlutusWitness::new_with_ref_without_datum(
153+
&PlutusScriptSource(plutus_mints.script.clone()),
154+
redeemer)
155+
);
154156
}
155157
},
156158
_ => {},
@@ -159,6 +161,21 @@ impl MintBuilder {
159161
PlutusWitnesses(plutus_witnesses)
160162
}
161163

164+
pub fn get_ref_inputs(&self) -> TransactionInputs {
165+
let mut reference_inputs = Vec::new();
166+
for script_mint in self.mints.values() {
167+
match script_mint {
168+
ScriptMint::Plutus(plutus_mints) => {
169+
if let PlutusScriptSourceEnum::RefInput(ref_input, _, _) = &plutus_mints.script {
170+
reference_inputs.push(ref_input.clone());
171+
}
172+
},
173+
_ => {},
174+
}
175+
}
176+
TransactionInputs(reference_inputs)
177+
}
178+
162179
pub fn get_redeeemers(&self) -> Result<Redeemers, JsError> {
163180
let mut redeeemers = Vec::new();
164181
let mut index = BigNum::zero();

rust/src/tx_builder/tx_inputs_builder.rs

+16
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ impl PlutusScriptSource {
8989
Self(PlutusScriptSourceEnum::Script(script.clone()))
9090
}
9191

92+
/// !!! DEPRECATED !!!
93+
/// This constructor has missed information about plutus script language vesrion. That can affect
94+
/// the script data hash calculation.
95+
/// Use `.new_ref_input_with_lang_ver` instead
96+
#[deprecated(
97+
since = "11.3.0",
98+
note = "This constructor has missed information about plutus script language vesrion. That can affect the script data hash calculation. Use `.new_ref_input_with_lang_ver` instead."
99+
)]
92100
pub fn new_ref_input(script_hash: &ScriptHash, input: &TransactionInput) -> Self {
93101
Self(PlutusScriptSourceEnum::RefInput(input.clone(),
94102
script_hash.clone(),
@@ -157,6 +165,14 @@ impl PlutusWitness {
157165
}
158166
}
159167

168+
pub fn new_with_ref_without_datum(script: &PlutusScriptSource, redeemer: &Redeemer) -> Self {
169+
Self {
170+
script: script.0.clone(),
171+
datum: None,
172+
redeemer: redeemer.clone(),
173+
}
174+
}
175+
160176
pub fn script(&self) -> Option<PlutusScript> {
161177
match &self.script {
162178
PlutusScriptSourceEnum::Script(script) => Some(script.clone()),

rust/src/tx_builder_constants.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct TxBuilderConstants();
1111
#[wasm_bindgen]
1212
impl TxBuilderConstants {
1313
pub fn plutus_default_cost_models() -> Costmdls {
14-
TxBuilderConstants::plutus_alonzo_cost_models()
14+
TxBuilderConstants::plutus_vasil_cost_models()
1515
}
1616

1717
pub fn plutus_alonzo_cost_models() -> Costmdls {

0 commit comments

Comments
 (0)