diff --git a/packages/Cargo.lock b/packages/Cargo.lock index c8ef689..274ae40 100644 --- a/packages/Cargo.lock +++ b/packages/Cargo.lock @@ -1833,7 +1833,7 @@ dependencies = [ [[package]] name = "sidan-csl-rs" -version = "0.5.0-alpha.12" +version = "0.5.1" dependencies = [ "cardano-serialization-lib", "cryptoxide", @@ -2387,7 +2387,7 @@ dependencies = [ [[package]] name = "whisky" -version = "0.5.0-alpha.12" +version = "0.5.1" dependencies = [ "async-trait", "cardano-serialization-lib", diff --git a/packages/sidan-csl-rs/Cargo.toml b/packages/sidan-csl-rs/Cargo.toml index f8c998b..9293d91 100644 --- a/packages/sidan-csl-rs/Cargo.toml +++ b/packages/sidan-csl-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sidan-csl-rs" -version = "0.5.0-alpha.12" +version = "0.5.1" edition = "2021" license = "Apache-2.0" description = "Wrapper around the cardano-serialization-lib for easier transaction building, heavily inspired by cardano-cli APIs" diff --git a/packages/sidan-csl-rs/src/builder/core.rs b/packages/sidan-csl-rs/src/builder/core.rs index 3a3b806..36327b8 100644 --- a/packages/sidan-csl-rs/src/builder/core.rs +++ b/packages/sidan-csl-rs/src/builder/core.rs @@ -32,32 +32,11 @@ pub fn js_serialize_tx_body(mesh_tx_builder_body_json: &str, params_json: &str) /// /// * `String` - the built transaction hex pub fn serialize_tx_body( - mut mesh_tx_builder_body: MeshTxBuilderBody, + mesh_tx_builder_body: MeshTxBuilderBody, params: Option, ) -> String { let mut mesh_csl = MeshCSL::new(params); - mesh_tx_builder_body - .mints - .sort_by(|a, b| a.policy_id.cmp(&b.policy_id)); - - mesh_tx_builder_body.inputs.sort_by(|a, b| { - let tx_in_data_a: &TxInParameter = match a { - TxIn::PubKeyTxIn(pub_key_tx_in) => &pub_key_tx_in.tx_in, - TxIn::ScriptTxIn(script_tx_in) => &script_tx_in.tx_in, - }; - - let tx_in_data_b: &TxInParameter = match b { - TxIn::PubKeyTxIn(pub_key_tx_in) => &pub_key_tx_in.tx_in, - TxIn::ScriptTxIn(script_tx_in) => &script_tx_in.tx_in, - }; - - tx_in_data_a - .tx_hash - .cmp(&tx_in_data_b.tx_hash) - .then_with(|| tx_in_data_a.tx_index.cmp(&tx_in_data_b.tx_index)) - }); - MeshTxBuilderCore::add_all_inputs(&mut mesh_csl, mesh_tx_builder_body.inputs.clone()); MeshTxBuilderCore::add_all_outputs(&mut mesh_csl, mesh_tx_builder_body.outputs.clone()); MeshTxBuilderCore::add_all_collaterals(&mut mesh_csl, mesh_tx_builder_body.collaterals.clone()); diff --git a/packages/whisky/Cargo.toml b/packages/whisky/Cargo.toml index 766215c..7fc4a15 100644 --- a/packages/whisky/Cargo.toml +++ b/packages/whisky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "whisky" -version = "0.5.0-alpha.12" +version = "0.5.1" edition = "2021" license = "Apache-2.0" description = "The Cardano Rust SDK, inspired by MeshJS" @@ -24,7 +24,7 @@ noop_proc_macro = "0.3.0" pallas-codec = "0.22.0" pallas-primitives = "0.22.0" pallas-traverse = "0.22.0" -sidan-csl-rs = { version = "=0.5.0-alpha.12", path = "../sidan-csl-rs" } +sidan-csl-rs = { version = "=0.5.1", path = "../sidan-csl-rs" } [profile.release] # Tell `rustc` to optimize for small code size. diff --git a/packages/whisky/src/builder/core.rs b/packages/whisky/src/builder/core.rs index 5c3cf6c..0fd8961 100644 --- a/packages/whisky/src/builder/core.rs +++ b/packages/whisky/src/builder/core.rs @@ -78,6 +78,29 @@ impl IMeshTxBuilder for MeshTxBuilder { self.add_utxos_from(self.extra_inputs.clone(), self.selection_threshold); } } + + self.core + .mesh_tx_builder_body + .mints + .sort_by(|a, b| a.policy_id.cmp(&b.policy_id)); + + self.core.mesh_tx_builder_body.inputs.sort_by(|a, b| { + let tx_in_data_a: &TxInParameter = match a { + TxIn::PubKeyTxIn(pub_key_tx_in) => &pub_key_tx_in.tx_in, + TxIn::ScriptTxIn(script_tx_in) => &script_tx_in.tx_in, + }; + + let tx_in_data_b: &TxInParameter = match b { + TxIn::PubKeyTxIn(pub_key_tx_in) => &pub_key_tx_in.tx_in, + TxIn::ScriptTxIn(script_tx_in) => &script_tx_in.tx_in, + }; + + tx_in_data_a + .tx_hash + .cmp(&tx_in_data_b.tx_hash) + .then_with(|| tx_in_data_a.tx_index.cmp(&tx_in_data_b.tx_index)) + }); + let tx_hex = serialize_tx_body( self.core.mesh_tx_builder_body.clone(), self.protocol_params.clone(),