From 6680853c693b14e7c7d96e1883c41a3eaf4ff60f Mon Sep 17 00:00:00 2001 From: SIDANWhatever Date: Thu, 17 Oct 2024 17:04:16 +0800 Subject: [PATCH] chore: rename variable and fix linting --- packages/sidan-csl-rs/src/core/builder.rs | 52 +++++------ .../sidan-csl-rs/src/core/utils/evaluator.rs | 16 ++-- packages/sidan-csl-rs/src/model/js_vec.rs | 2 +- packages/sidan-csl-rs/src/wasm/txbuilder.rs | 17 ++-- packages/whisky/src/builder/certificate.rs | 52 +++++------ packages/whisky/src/builder/complete.rs | 10 +-- packages/whisky/src/builder/mod.rs | 38 ++++---- packages/whisky/src/builder/tx_in.rs | 4 +- packages/whisky/src/builder/tx_out.rs | 2 +- packages/whisky/src/service/evaluator.rs | 8 +- .../{mesh_tx_builder.rs => tx_builder.rs} | 86 ++++++++++--------- 11 files changed, 149 insertions(+), 138 deletions(-) rename packages/whisky/tests/{mesh_tx_builder.rs => tx_builder.rs} (90%) diff --git a/packages/sidan-csl-rs/src/core/builder.rs b/packages/sidan-csl-rs/src/core/builder.rs index 11b833f..6546e0e 100644 --- a/packages/sidan-csl-rs/src/core/builder.rs +++ b/packages/sidan-csl-rs/src/core/builder.rs @@ -5,7 +5,7 @@ use cardano_serialization_lib::JsError; #[derive(Clone, Debug)] pub struct TxBuilderCore { pub mesh_csl: MeshCSL, - pub mesh_tx_builder_body: TxBuilderBody, + pub tx_builder_body: TxBuilderBody, pub tx_evaluation_multiplier_percentage: u64, } @@ -15,49 +15,49 @@ pub struct TxBuilderCore { /// /// ### Arguments /// -/// * `mesh_tx_builder_body` - The transaction builder body information +/// * `tx_builder_body` - The transaction builder body information /// * `params` - Optional protocol parameters, default as Cardano mainnet configuration /// /// ### Returns /// /// * `String` - the built transaction hex pub fn serialize_tx_body( - mesh_tx_builder_body: TxBuilderBody, + tx_builder_body: TxBuilderBody, params: Option, ) -> Result { - if mesh_tx_builder_body.change_address.is_empty() { + if tx_builder_body.change_address.is_empty() { return Err(JsError::from_str("change address cannot be empty")); } let mut mesh_csl = MeshCSL::new(params); - TxBuilderCore::add_all_inputs(&mut mesh_csl, mesh_tx_builder_body.inputs.clone())?; - TxBuilderCore::add_all_outputs(&mut mesh_csl, mesh_tx_builder_body.outputs.clone())?; - TxBuilderCore::add_all_collaterals(&mut mesh_csl, mesh_tx_builder_body.collaterals.clone())?; + TxBuilderCore::add_all_inputs(&mut mesh_csl, tx_builder_body.inputs.clone())?; + TxBuilderCore::add_all_outputs(&mut mesh_csl, tx_builder_body.outputs.clone())?; + TxBuilderCore::add_all_collaterals(&mut mesh_csl, tx_builder_body.collaterals.clone())?; TxBuilderCore::add_all_reference_inputs( &mut mesh_csl, - mesh_tx_builder_body.reference_inputs.clone(), + tx_builder_body.reference_inputs.clone(), )?; - TxBuilderCore::add_all_withdrawals(&mut mesh_csl, mesh_tx_builder_body.withdrawals.clone())?; - TxBuilderCore::add_all_mints(&mut mesh_csl, mesh_tx_builder_body.mints.clone())?; - TxBuilderCore::add_all_certificates(&mut mesh_csl, mesh_tx_builder_body.certificates.clone())?; - TxBuilderCore::add_all_votes(&mut mesh_csl, mesh_tx_builder_body.votes.clone())?; - TxBuilderCore::add_validity_range(&mut mesh_csl, mesh_tx_builder_body.validity_range.clone()); + TxBuilderCore::add_all_withdrawals(&mut mesh_csl, tx_builder_body.withdrawals.clone())?; + TxBuilderCore::add_all_mints(&mut mesh_csl, tx_builder_body.mints.clone())?; + TxBuilderCore::add_all_certificates(&mut mesh_csl, tx_builder_body.certificates.clone())?; + TxBuilderCore::add_all_votes(&mut mesh_csl, tx_builder_body.votes.clone())?; + TxBuilderCore::add_validity_range(&mut mesh_csl, tx_builder_body.validity_range.clone()); TxBuilderCore::add_all_required_signature( &mut mesh_csl, - &mesh_tx_builder_body + &tx_builder_body .required_signatures .iter() .map(|s| s.as_str()) .collect::>(), )?; - TxBuilderCore::add_all_metadata(&mut mesh_csl, mesh_tx_builder_body.metadata.clone())?; + TxBuilderCore::add_all_metadata(&mut mesh_csl, tx_builder_body.metadata.clone())?; - match mesh_tx_builder_body.network { + match tx_builder_body.network { Some(current_network) => mesh_csl.add_script_hash(current_network)?, None => mesh_csl.add_script_hash(Network::Mainnet)?, }; - // if self.mesh_tx_builder_body.change_address != "" { - // let collateral_inputs = self.mesh_tx_builder_body.collaterals.clone(); + // if self.tx_builder_body.change_address != "" { + // let collateral_inputs = self.tx_builder_body.collaterals.clone(); // let collateral_vec: Vec = collateral_inputs // .into_iter() // .map(|pub_key_tx_in| { @@ -86,7 +86,7 @@ pub fn serialize_tx_body( // let mut collateral_return_needed = false; // if (total_collateral - collateral_estimate) > 0 { // let collateral_estimate_output = csl::TransactionOutput::new( - // &csl::address::Address::from_bech32(&self.mesh_tx_builder_body.change_address) + // &csl::address::Address::from_bech32(&self.tx_builder_body.change_address) // .unwrap(), // &csl::utils::Value::new(&to_bignum(collateral_estimate)), // ); @@ -104,7 +104,7 @@ pub fn serialize_tx_body( // self.tx_builder // .set_collateral_return(&csl::TransactionOutput::new( // &csl::address::Address::from_bech32( - // &self.mesh_tx_builder_body.change_address, + // &self.tx_builder_body.change_address, // ) // .unwrap(), // &csl::utils::Value::new(&to_bignum(total_collateral)), @@ -116,14 +116,14 @@ pub fn serialize_tx_body( // collateral_return_needed = true; // } // } - // self.add_change(self.mesh_tx_builder_body.change_address.clone()); + // self.add_change(self.tx_builder_body.change_address.clone()); // if collateral_return_needed { - // self.add_collateral_return(self.mesh_tx_builder_body.change_address.clone()); + // self.add_collateral_return(self.tx_builder_body.change_address.clone()); // } // } mesh_csl.add_change( - mesh_tx_builder_body.change_address.clone(), - mesh_tx_builder_body.change_datum.clone(), + tx_builder_body.change_address.clone(), + tx_builder_body.change_datum.clone(), )?; mesh_csl.build_tx() } @@ -140,7 +140,7 @@ impl TxBuilderCore { pub fn new_core(params: Option) -> Self { Self { mesh_csl: MeshCSL::new(params), - mesh_tx_builder_body: TxBuilderBody { + tx_builder_body: TxBuilderBody { inputs: vec![], outputs: vec![], collaterals: vec![], @@ -172,7 +172,7 @@ impl TxBuilderCore { /// /// * `String` - The signed transaction in hex pub fn complete_signing(&mut self) -> Result { - let signing_keys = self.mesh_tx_builder_body.signing_key.clone(); + let signing_keys = self.tx_builder_body.signing_key.clone(); self.add_all_signing_keys( &signing_keys .iter() diff --git a/packages/sidan-csl-rs/src/core/utils/evaluator.rs b/packages/sidan-csl-rs/src/core/utils/evaluator.rs index 5c6235e..7a56cd5 100644 --- a/packages/sidan-csl-rs/src/core/utils/evaluator.rs +++ b/packages/sidan-csl-rs/src/core/utils/evaluator.rs @@ -35,7 +35,10 @@ pub fn evaluate_tx_scripts_js( match serde_json::from_str(utxo_json.as_str()) { Ok(utxo) => deserialized_utxos.push(utxo), Err(e) => { - return WasmResult::new_error("failure".to_string(), format!("Error in decoding UTXO: {:?}", e)); + return WasmResult::new_error( + "failure".to_string(), + format!("Error in decoding UTXO: {:?}", e), + ); } } } @@ -43,14 +46,17 @@ pub fn evaluate_tx_scripts_js( let deserialize_network = match network.try_into() { Ok(network) => network, Err(e) => { - return WasmResult::new_error("failure".to_string(), format!("Error in decoding network: {:?}", e)); + return WasmResult::new_error( + "failure".to_string(), + format!("Error in decoding network: {:?}", e), + ); } }; let eval_result = evaluate_tx_scripts( &tx_hex, &deserialized_utxos, - &additional_txs.as_ref_vec(), + additional_txs.as_ref_vec(), &deserialize_network, ); @@ -418,7 +424,7 @@ mod test { let utxo_5 = "{\"input\": {\"outputIndex\": 2, \"txHash\": \"1c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441\"}, \"output\": {\"address\": \"addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv\", \"amount\": [{\"unit\": \"lovelace\", \"quantity\": \"5000000\"}], \"scriptHash\": null}}"; let utxo_6 = "{\"input\": {\"outputIndex\": 0, \"txHash\": \"66b7282bad1aef9ba0a99f06e618d651d232d4788f0d2ee2d22db22a62391033\"}, \"output\": {\"address\": \"addr_test1qp0q40yv0ywzyzuv2mnjnjmha9wq83aay7t339ka5zkzx6xglkktstqua3rk63z02kwz3a9hthdk7jplugzzw6p6vcdqa39gds\", \"amount\": [{\"unit\": \"lovelace\", \"quantity\": \"26000000\"}], \"scriptHash\": \"32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bd\", \"scriptRef\": \"8202590eca590ec701000033232323232323223223232322533300832323232323232323232323232323232323232323232323232323232323232323232323232323232325333031302d30323754002264a66606460540022a666064666018910103313333000063758601660686ea8c080c0d0dd50158a9998191998050031bac301130343754604060686ea80acdd61810181a1baa30203034375405626666444464646464a666074606c60766ea80044c8c8c8c8c8c8c94ccc10402854ccc10402454ccc10401854ccc10400c54ccc10400840045280a5014a0294052819192999821181f0008b0a999821181d000899b89375a608e60886ea8008dd6982398241824182418221baa0061630423754002605c60846ea8c114c118c108dd50059980f99baf301a30413754006605a60826ea8059240132496e74656e7420646174756d2073686f756c6420636f6e7461696e20616c6c206d61746368696e6720726566732075736564003301e3375e605860806ea8010c084c100dd50092493f496e74656e7420746f6b656e2073686f756c64206f6e6c7920657665722062652073656e7420746f20696e74656e74207370656e64696e672073637269707400533303d3039303e37540022646464646464646464646464a666098609e0042646493182280218178038b18268009826801182580098258011bad3049001304900230470013047002375a608a002608a0046086002607e6ea800458cc0640092401264f7574707574206d75737420636f6e7461696e20736f6d6520696e6c696e656420646174756d003301b3024301c323300100137566036607c6ea8008894ccc10000452f5c0264666444646600200200644a66608c0022006264660906e9ccc120dd4803198241822800998241823000a5eb80cc00c00cc128008c120004dd7181f8009bab304000133003003304400230420014901224f6e6c792061646120616c6c6f776564207769746820696e74656e7420746f6b656e00303f303c37540022ca6660780062980103d87a80001302d3303d303e0034bd701980c1818181380124812e4f6e6c7920612073696e676c65206f7574707574207769746820696e74656e7420746f6b656e20616c6c6f77656400330173375e6e98c04c00cdd31991299981c9818a4000297adef6c6013232330010014bd6f7b63011299981f80089982019bb0375200a6e9800d2f5bded8c0264646464a66608066e400240084cc110cdd81ba9009374c00e00a2a66608066e3c0240084cc110cdd81ba9009374c00e00626608866ec0dd48011ba600133006006003375660820066eb8c0fc008c10c008c104004c8cc0040052f5bded8c044a66607c00226607e66ec0dd4801a610101004bd6f7b630099191919299981f99b90007002133043337606ea401d3010101000051533303f3371e00e00426608666ec0dd4803a61010100003133043337606ea4008dd4000998030030019bad3040003375c607c004608400460800026eb8c094c0e4dd50029bae30163039375400a9212b4f6e6c7920612073696e676c6520696e74656e7420746f6b656e2073686f756c64206265206d696e74656400330280032302f3330153756602c60726ea8004dd71812981c9baa005375c602c60726ea8014c098cc0d8dd48021981b2610140004bd701bac301530343754604060686ea80acdd59806981a1baa302030343754056606e607060706070607060706070607060686ea8c080c0d0dd50158a5014a02a66606466e2000520001533303233300c488103313838000063758601660686ea8c080c0d0dd501589998050031bac301130343754604060686ea80acdd61810181a1baa302030343754056294058dd6981b18199baa00116533303030283301501500113301b0014890014c103d87a8000325333030302830313754002297adef6c6013756606a60646ea8004cc064c02cdd5980518189baa301d3031375405000264a66605e605660606ea80044dd7181a18189baa00116300d3030375404ea66605a6052605c6ea80044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc108c1140084c8c8c8c8c8c8c926302b00b302a00c302a00d302900e302700f303b010533303f303b3040375402226464a666088608e004264931981b000919181798228011bae3043001163756608a00260826ea80445858c10c004c10c008dd698208009820801181f800981f801181e800981e801181d800981d801181c800981c801181b800981b801181a800981a801181980098179baa00116300f302e3754004a666056604e60586ea80044c8c8c8c8c8c94ccc0d0c0dc0084c8c926301a00430190051630350013035002303300130330023031001302d37540022c6600e601260586ea800524011e436f6c642072656620646174756d206d75737420626520696e6c696e6564003232533302b323300100102a22533303000114a0264a66605c64604e66601a6eacc038c0c4dd5180718189baa005375c603a60626ea8004dd7180718189baa001303300214a2266006006002606600220022ca666054604c60566ea80044c0bcc0b0dd50008b198069bac3008302b3754602e60566ea8088098888c94ccc0b14ccc0b0c090c0b4dd519808001980598171baa0041614a2200229414ccc0acc09cc0b0dd519807800980518169baa0031614a24605a605c605c605c605c605c605c605c605c00244464660020026464a6660586050605a6ea80044c0c4c0b8dd50008992999816981498171baa00113032302f37540022c6603e00491010130003301e0010053756603060586ea8c060c0b0dd5001912999815981398161baa001132323300100100522533303100114a0264a66605e66e3cdd7181a0010020a511330030030013034001375c6060605a6ea80044c8cdc49bad30313032001301b3301e375860620024660080080026eb0c0c0c0b4dd5000918159816181618161816000919198008008011129998150008a5eb7bdb1804c8c8c8c94ccc0accdc8a45000021533302b3371e9101000021003100513302f337606ea4008dd3000998030030019bab302c003375c6054004605c00460580024464a66604c601e604e6ea80044c0acc0a0dd50008b180418139baa002222325333026301e302737540022900009bad302b3028375400264a66604c603c604e6ea8004530103d87a80001330113756605660506ea8004008cc03c00c0088c09cc0a0004894ccc0880085288b18008009129998118008a40002602266004004604c002460466048604800244646600200200644a666046002298103d87a80001323253330223375e602060486ea80080144c058cc0980092f5c0266008008002604e004604a00244a66604000229000098071980100118118009299980d980b980e1baa0011323232325333022302500213232498c94ccc084c0740044c8c94ccc098c0a40084c9263019001163027001302337540062a66604260320022a66604860466ea800c526161630213754004602c0062c604600260460046042002603a6ea80045894ccc068c058c06cdd5000899191919299981098120010a4c2c6eb8c088004c088008dd71810000980e1baa00116232533301a301600113232533301f3022002149858dd71810000980e1baa0021533301a301200113232533301f3022002132498c05c00458c080004c070dd50010a99980d180180089919299980f981100109924c60240022c604000260386ea800854ccc068cdc3a400c00226464a66603e60440042649319299980e980c800899192999811181280109924c602a0022c6046002603e6ea800854ccc074c0540044c8c94ccc088c0940084c9263015001163023001301f37540042a66603a600c002264646464a666048604e00426493180b8018b1bae302500130250023023001301f37540042a66603a66e1d200600113232323253330243027002149858dd7181280098128011bae3023001301f37540042a66603a66e1d200800113232323253330243027002149858dd6981280098128011bae3023001301f37540042a66603a66e1d200a00115333020301f37540042930b0a99980e99b874803000454ccc080c07cdd50010a4c2c2c603a6ea800458c080004c070dd50010b180d1baa001370e900211191980080080191299980e8008a60103d87a8000132323232533301e3372200e0042a66603c66e3c01c0084c048cc088dd3000a5eb80530103d87a80001330060060033756603e0066eb8c074008c084008c07c00488c8cc00400400c894ccc0700045300103d87a8000132323232533301d3372200e0042a66603a66e3c01c0084c044cc084dd4000a5eb80530103d87a8000133006006003375a603c0066eb8c070008c080008c078004c00400488c94ccc058c0480044c8c94ccc06cc07800852616375c603800260306ea800854ccc058c0380044c8c94ccc06cc0780084c926323232533301e3021002132498cc04000c8cc02402400458dd6980f800980f8011bac301d001163758603800260306ea800858c058dd50009180c000980080091299980a8008a4000260066600400460300026e01200222323300100100322533301500114bd7009919299980a180280109980c00119802002000899802002000980c801180b80091191980080080191299980a0008a6103d87a800013232323253330153372200e0042a66602a66e3c01c0084c024cc0640052f5c0298103d87a80001330060060033016003375c60280046030004602c0026e95200022323300100100322533301200114984c8cc00c00cc058008c00cc0500048c94ccc030c0200044c8c94ccc044c0500084c9263005001163012001300e37540042a66601860080022646464646464a66602a60300042930b1bad30160013016002375a602800260280046eb4c048004c038dd50010b18061baa001232533300b30070011323253330103013002149858dd7180880098069baa0021533300b30030011323253330103013002149858dd7180880098069baa00216300b37540026e1d200214984d958c00400c94ccc018c008c01cdd50008991919192999806980800109924ca666014600c60166ea800c4c8c94ccc03cc04800852616375c602000260186ea800c5858dd698070009807001180600098041baa00116370e90001bac0015734aae7555cf2ab9f5740ae855d12601259fd8799f581c55871db8a58f10fddf48b92029827d168271e785646af257de85486c40ffff0001\"}}"; let utxo_7 = "{\"input\": {\"outputIndex\": 0, \"txHash\": \"5f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961a\"}, \"output\": {\"address\": \"addr_test1qp0q40yv0ywzyzuv2mnjnjmha9wq83aay7t339ka5zkzx6xglkktstqua3rk63z02kwz3a9hthdk7jplugzzw6p6vcdqa39gds\", \"amount\": [{\"unit\": \"lovelace\", \"quantity\": \"4000000\"}, {\"unit\": \"55871db8a58f10fddf48b92029827d168271e785646af257de85486c\", \"quantity\": \"1\"}], \"dataHash\": \"a5a21bf7d9119e01f8cf04316dba1d9cdcacd998430728fdb938de8dad4b6c1f\", \"plutusData\": \"d8799fd8799f581c0eb1e4ef980b3c308edd7b3ab64990d5240e5230286038cae5c634cdffd8799f581c1fdf3668220c08618b4f2e5e7cc54f70ca4b11fd2b6a3fbe678235f1ffd8799fd8799fa14130d8799f581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6cffffd8799fd8799f58201c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441ff00ffd8799fd87a9f581ceafce55e4f0e057b495f77d8019577c56ae1fe188dc7e6d63f4f93b8ffd87a80ffd8799f581c32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bd40ffd8799f581cdbde35dec305604c1c8a596437802fd5e3468c8e92ce1781203e7bb74455534441ffd8799fd87a9f581c10fcea52f80dbc6e499106b02894173a2e60d21c6b3d1fe881d9495dffd87a80ffd8799fd8799f581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6cffd87a80ff1903e801ffff\", \"scriptHash\": null}}"; - let mut resolved_utxos = JsVecString::new(); + let mut resolved_utxos = JsVecString::new(); resolved_utxos.add(utxo_1.to_string()); resolved_utxos.add(utxo_2.to_string()); resolved_utxos.add(utxo_3.to_string()); @@ -433,7 +439,7 @@ mod test { tx_hex.to_string(), &resolved_utxos, &additional_txs, - "preprod".to_string() + "preprod".to_string(), ); assert_eq!(result.get_status(), "success"); diff --git a/packages/sidan-csl-rs/src/model/js_vec.rs b/packages/sidan-csl-rs/src/model/js_vec.rs index c80bdfb..48eff67 100644 --- a/packages/sidan-csl-rs/src/model/js_vec.rs +++ b/packages/sidan-csl-rs/src/model/js_vec.rs @@ -27,7 +27,7 @@ impl JsVecString { self.0.push(elem.clone()); } - pub(crate) fn into_vec(self) -> Vec { + pub fn into_vec(self) -> Vec { self.0 } diff --git a/packages/sidan-csl-rs/src/wasm/txbuilder.rs b/packages/sidan-csl-rs/src/wasm/txbuilder.rs index b6ed85d..88aff6c 100644 --- a/packages/sidan-csl-rs/src/wasm/txbuilder.rs +++ b/packages/sidan-csl-rs/src/wasm/txbuilder.rs @@ -8,17 +8,16 @@ use wasm::WasmResult; /// /// ### Arguments /// -/// * `mesh_tx_builder_body_json` - The transaction builder body information, serialized as JSON string +/// * `tx_builder_body_json` - The transaction builder body information, serialized as JSON string /// * `params_json` - Optional protocol parameters, default as Cardano mainnet configuration, serialized as JSON string /// /// ### Returns /// /// * `String` - the built transaction hex #[wasm_bindgen] -pub fn js_serialize_tx_body(mesh_tx_builder_body_json: &str, params_json: &str) -> WasmResult { - let mesh_tx_builder_body: TxBuilderBody = match serde_json::from_str(mesh_tx_builder_body_json) - { - Ok(mesh_tx_builder_body) => mesh_tx_builder_body, +pub fn js_serialize_tx_body(tx_builder_body_json: &str, params_json: &str) -> WasmResult { + let tx_builder_body: TxBuilderBody = match serde_json::from_str(tx_builder_body_json) { + Ok(tx_builder_body) => tx_builder_body, Err(e) => { return WasmResult::new_error("failure".to_string(), format!("Invalid JSON: {:?}", e)) } @@ -34,7 +33,7 @@ pub fn js_serialize_tx_body(mesh_tx_builder_body_json: &str, params_json: &str) } }; - match serialize_tx_body(mesh_tx_builder_body, params) { + match serialize_tx_body(tx_builder_body, params) { Ok(tx_hex) => WasmResult::new("success".to_string(), tx_hex.to_string()), Err(e) => WasmResult::new_error("failure".to_string(), format!("{:?}", e)), } @@ -42,9 +41,9 @@ pub fn js_serialize_tx_body(mesh_tx_builder_body_json: &str, params_json: &str) #[test] fn test_js_serialize_tx_body() { - // let mesh_tx_builder_body_json = r#"{"inputs":[{"scriptTxIn":{"txIn":{"txHash":"72a934097270cfdf8cdc445deba5928a004c52c78cbfe94c0024d4f043cc0e77","txIndex":0,"amount":[{"unit":"lovelace","quantity":"1017160"}],"address":"addr_test1wrw35u9mkg76cj0h3npuu4d5zjc3kyl57kyx460cu6zu93gpjj7h0"},"scriptTxIn":{"scriptSource":{"providedScriptSource":{"scriptCbor":"59032759032401010033333323232323232322322322322322322533300c323232323253323301230013013375400426464646464a66602e66e1d20000011533301a301937540102a0042c2a66602e600c0022a66603460326ea8020540085854ccc05ccdc3a40080022a66603460326ea8020540085854ccc05ccdc3a400c0022a66603460326ea8020540085858c05cdd5003899191929919980c99b87480000104cc008dd59801980d9baa00c30013301d375202a97ae01533301930080041330023756600660366ea8030c004cc074dd4809a5eb8054ccc064cdc3a40080082660046eacc00cc06cdd500618009980e9ba90114bd7009919299980d99198008009bac3021302230223022302200322533302000114a0264a66603c66e3cdd7181180100e0a511330030030013023001100114a064a66603c002294054ccc078c0840044c8c8c94ccc078cdc79bae30230030141533301e3371e002038266e1c009200114a02940dd7181118118011bad302130223022001375860400022940c8cc004004dd5981000111299980f8008a5eb804c8ccc888c8cc00400400c894ccc094004400c4c8cc09cdd3998139ba90063302730240013302730250014bd7019801801981480118138009bae301e0013756603e0026600600660460046042002603e603e603e603e60366ea8030dd2a400444646600200200644a66603c00229404c94ccc070cdd7802180e98108010a5113300300300130210012301c301d301d301d301d301d301d0013016375400c60326034004603000260286ea8008dc3a40042c602a602c004602800260280046024002601c6ea800452613656375c0026eb8004dd70009bae001375c002ae6955ceaab9e5573eae815d0aba24c011e581cd161d64eef0eeb59f9124f520f8c8f3b717ed04198d54c8b17e604ae004c011e581c3dc7e4d31bf34d68a822712c47bbf544d74c22fe2350ae7bb51a3f02004c011e581c3dc7e4d31bf34d68a822712c47bbf544d74c22fe2350ae7bb51a3f02004c011e581c18c154376a49c965027adb6afbe97ce43c96a2f9b8bf0eaf9ff15851004c011e581ccc0932775ffd17eba5738509ad28e45637b3d3d45d182d5f1fbf9fe20001","languageVersion":"v3"}},"datumSource":{"inlineDatumSource":{"txHash":"72a934097270cfdf8cdc445deba5928a004c52c78cbfe94c0024d4f043cc0e77","txIndex":0}},"redeemer":{"data":"d87980","exUnits":{"mem":7000000,"steps":3000000000}}}}},{"pubKeyTxIn":{"txIn":{"txHash":"3c05db00dfec497ce870faaa67e6176f8e08352689bee93e203c12cc800c3ebc","txIndex":4,"amount":[{"unit":"lovelace","quantity":"106756821"}],"address":"addr_test1qrgkr4jwau8wkk0ezf84yruv3uahzlksgxvd2nytzlnqft4x8s2nlvl23f82fut92a82jytnw4k7p0esygk2p626vjdqu58u9n"}}}],"outputs":[],"collaterals":[{"txIn":{"txHash":"3c05db00dfec497ce870faaa67e6176f8e08352689bee93e203c12cc800c3ebc","txIndex":0,"amount":[{"unit":"lovelace","quantity":"5000000"}],"address":"addr_test1qrgkr4jwau8wkk0ezf84yruv3uahzlksgxvd2nytzlnqft4x8s2nlvl23f82fut92a82jytnw4k7p0esygk2p626vjdqu58u9n"}}],"requiredSignatures":["d161d64eef0eeb59f9124f520f8c8f3b717ed04198d54c8b17e604ae","5ca51b304b1f79d92eada8c58c513e969458dcd27ce4f5bc47823ffa"],"referenceInputs":[{"txHash":"8d68748457cd0f1a8596f41fd2125a415315897d2da4a4b94335829cee7198ae","txIndex":0}],"mints":[],"changeAddress":"addr_test1qrgkr4jwau8wkk0ezf84yruv3uahzlksgxvd2nytzlnqft4x8s2nlvl23f82fut92a82jytnw4k7p0esygk2p626vjdqu58u9n","metadata":[],"validityRange":{"invalidBefore":null,"invalidHereafter":null},"certificates":[],"signingKey":[],"withdrawals":[{"plutusScriptWithdrawal":{"address":"stake_test17q7u0exnr0e5669gyfcjc3am74zdwnpzlc34ptnmk5dr7qszs53fr","coin":0,"scriptSource":{"inlineScriptSource":{"refTxIn":{"txHash":"f75b8c0ce490b11ba002bc7ed483119665eb8b52d9a11afb0b4a448ca2663d52","txIndex"#; - let mesh_tx_builder_body_json = r#"{"inputs":[{"pubKeyTxIn":{"txIn":{"txHash":"5b0145fe7b0212a7807e7dba24997049374d965f587300a2039b73cd30806c78","txIndex":1,"amount":[{"unit":"lovelace","quantity":"1132923230"}],"address":"addr_test1qq0yavv5uve45rwvfaw96qynrqt8ckpmkwcg08vlwxxdncxk82f5wz75mzaesmqzl79xqsmedwgucwtuav5str6untqqmykcpn"}}}],"outputs":[{"address":"addr_test1wpnlxv2xv9a9ucvnvzqakwepzl9ltx7jzgm53av2e9ncv4sysemm8","amount":[{"unit":"lovelace","quantity":"1600000"}],"datum":{"hash":{"type":"Mesh","content":"supersecret"}},"referenceScript":null}],"collaterals":[{"txIn":{"txHash":"ec0c2e70b898cf531b03c9db937602e98c45378d9fa8e8a5b5a91ec5c1d7540d","txIndex":5,"amount":[{"unit":"lovelace","quantity":"5000000"}],"address":"addr_test1qq0yavv5uve45rwvfaw96qynrqt8ckpmkwcg08vlwxxdncxk82f5wz75mzaesmqzl79xqsmedwgucwtuav5str6untqqmykcpn"}}],"requiredSignatures":[],"referenceInputs":[],"mints":[],"changeAddress":"addr_test1qq0yavv5uve45rwvfaw96qynrqt8ckpmkwcg08vlwxxdncxk82f5wz75mzaesmqzl79xqsmedwgucwtuav5str6untqqmykcpn","metadata":[],"validityRange":{"invalidBefore":null,"invalidHereafter":null},"certificates":[],"signingKey":[],"withdrawals":[]}"#; + // let tx_builder_body_json = r#"{"inputs":[{"scriptTxIn":{"txIn":{"txHash":"72a934097270cfdf8cdc445deba5928a004c52c78cbfe94c0024d4f043cc0e77","txIndex":0,"amount":[{"unit":"lovelace","quantity":"1017160"}],"address":"addr_test1wrw35u9mkg76cj0h3npuu4d5zjc3kyl57kyx460cu6zu93gpjj7h0"},"scriptTxIn":{"scriptSource":{"providedScriptSource":{"scriptCbor":"59032759032401010033333323232323232322322322322322322533300c323232323253323301230013013375400426464646464a66602e66e1d20000011533301a301937540102a0042c2a66602e600c0022a66603460326ea8020540085854ccc05ccdc3a40080022a66603460326ea8020540085854ccc05ccdc3a400c0022a66603460326ea8020540085858c05cdd5003899191929919980c99b87480000104cc008dd59801980d9baa00c30013301d375202a97ae01533301930080041330023756600660366ea8030c004cc074dd4809a5eb8054ccc064cdc3a40080082660046eacc00cc06cdd500618009980e9ba90114bd7009919299980d99198008009bac3021302230223022302200322533302000114a0264a66603c66e3cdd7181180100e0a511330030030013023001100114a064a66603c002294054ccc078c0840044c8c8c94ccc078cdc79bae30230030141533301e3371e002038266e1c009200114a02940dd7181118118011bad302130223022001375860400022940c8cc004004dd5981000111299980f8008a5eb804c8ccc888c8cc00400400c894ccc094004400c4c8cc09cdd3998139ba90063302730240013302730250014bd7019801801981480118138009bae301e0013756603e0026600600660460046042002603e603e603e603e60366ea8030dd2a400444646600200200644a66603c00229404c94ccc070cdd7802180e98108010a5113300300300130210012301c301d301d301d301d301d301d0013016375400c60326034004603000260286ea8008dc3a40042c602a602c004602800260280046024002601c6ea800452613656375c0026eb8004dd70009bae001375c002ae6955ceaab9e5573eae815d0aba24c011e581cd161d64eef0eeb59f9124f520f8c8f3b717ed04198d54c8b17e604ae004c011e581c3dc7e4d31bf34d68a822712c47bbf544d74c22fe2350ae7bb51a3f02004c011e581c3dc7e4d31bf34d68a822712c47bbf544d74c22fe2350ae7bb51a3f02004c011e581c18c154376a49c965027adb6afbe97ce43c96a2f9b8bf0eaf9ff15851004c011e581ccc0932775ffd17eba5738509ad28e45637b3d3d45d182d5f1fbf9fe20001","languageVersion":"v3"}},"datumSource":{"inlineDatumSource":{"txHash":"72a934097270cfdf8cdc445deba5928a004c52c78cbfe94c0024d4f043cc0e77","txIndex":0}},"redeemer":{"data":"d87980","exUnits":{"mem":7000000,"steps":3000000000}}}}},{"pubKeyTxIn":{"txIn":{"txHash":"3c05db00dfec497ce870faaa67e6176f8e08352689bee93e203c12cc800c3ebc","txIndex":4,"amount":[{"unit":"lovelace","quantity":"106756821"}],"address":"addr_test1qrgkr4jwau8wkk0ezf84yruv3uahzlksgxvd2nytzlnqft4x8s2nlvl23f82fut92a82jytnw4k7p0esygk2p626vjdqu58u9n"}}}],"outputs":[],"collaterals":[{"txIn":{"txHash":"3c05db00dfec497ce870faaa67e6176f8e08352689bee93e203c12cc800c3ebc","txIndex":0,"amount":[{"unit":"lovelace","quantity":"5000000"}],"address":"addr_test1qrgkr4jwau8wkk0ezf84yruv3uahzlksgxvd2nytzlnqft4x8s2nlvl23f82fut92a82jytnw4k7p0esygk2p626vjdqu58u9n"}}],"requiredSignatures":["d161d64eef0eeb59f9124f520f8c8f3b717ed04198d54c8b17e604ae","5ca51b304b1f79d92eada8c58c513e969458dcd27ce4f5bc47823ffa"],"referenceInputs":[{"txHash":"8d68748457cd0f1a8596f41fd2125a415315897d2da4a4b94335829cee7198ae","txIndex":0}],"mints":[],"changeAddress":"addr_test1qrgkr4jwau8wkk0ezf84yruv3uahzlksgxvd2nytzlnqft4x8s2nlvl23f82fut92a82jytnw4k7p0esygk2p626vjdqu58u9n","metadata":[],"validityRange":{"invalidBefore":null,"invalidHereafter":null},"certificates":[],"signingKey":[],"withdrawals":[{"plutusScriptWithdrawal":{"address":"stake_test17q7u0exnr0e5669gyfcjc3am74zdwnpzlc34ptnmk5dr7qszs53fr","coin":0,"scriptSource":{"inlineScriptSource":{"refTxIn":{"txHash":"f75b8c0ce490b11ba002bc7ed483119665eb8b52d9a11afb0b4a448ca2663d52","txIndex"#; + let tx_builder_body_json = r#"{"inputs":[{"pubKeyTxIn":{"txIn":{"txHash":"5b0145fe7b0212a7807e7dba24997049374d965f587300a2039b73cd30806c78","txIndex":1,"amount":[{"unit":"lovelace","quantity":"1132923230"}],"address":"addr_test1qq0yavv5uve45rwvfaw96qynrqt8ckpmkwcg08vlwxxdncxk82f5wz75mzaesmqzl79xqsmedwgucwtuav5str6untqqmykcpn"}}}],"outputs":[{"address":"addr_test1wpnlxv2xv9a9ucvnvzqakwepzl9ltx7jzgm53av2e9ncv4sysemm8","amount":[{"unit":"lovelace","quantity":"1600000"}],"datum":{"hash":{"type":"Mesh","content":"supersecret"}},"referenceScript":null}],"collaterals":[{"txIn":{"txHash":"ec0c2e70b898cf531b03c9db937602e98c45378d9fa8e8a5b5a91ec5c1d7540d","txIndex":5,"amount":[{"unit":"lovelace","quantity":"5000000"}],"address":"addr_test1qq0yavv5uve45rwvfaw96qynrqt8ckpmkwcg08vlwxxdncxk82f5wz75mzaesmqzl79xqsmedwgucwtuav5str6untqqmykcpn"}}],"requiredSignatures":[],"referenceInputs":[],"mints":[],"changeAddress":"addr_test1qq0yavv5uve45rwvfaw96qynrqt8ckpmkwcg08vlwxxdncxk82f5wz75mzaesmqzl79xqsmedwgucwtuav5str6untqqmykcpn","metadata":[],"validityRange":{"invalidBefore":null,"invalidHereafter":null},"certificates":[],"signingKey":[],"withdrawals":[]}"#; let params_json = r#"{"epoch":0,"coinsPerUtxoSize":0,"priceMem":0,"priceStep":0,"minFeeA":0,"minFeeB":0,"keyDeposit":2000000,"maxTxSize":16384,"maxValSize":5000,"poolDeposit":500000000,"maxCollateralInputs":3,"decentralisation":0,"maxBlockSize":65536,"collateralPercent":150,"maxBlockHeaderSize":1100,"minPoolCost":"340000000","maxTxExMem":"14000000","maxTxExSteps":"10000000000","maxBlockExMem":"62000000","maxBlockExSteps":"20000000000","minFeeRefScriptCostPerByte":15}"#; - let tx_build_result = js_serialize_tx_body(mesh_tx_builder_body_json, params_json); + let tx_build_result = js_serialize_tx_body(tx_builder_body_json, params_json); println!("{:?}", tx_build_result); } diff --git a/packages/whisky/src/builder/certificate.rs b/packages/whisky/src/builder/certificate.rs index 7f84732..5cc21a5 100644 --- a/packages/whisky/src/builder/certificate.rs +++ b/packages/whisky/src/builder/certificate.rs @@ -16,7 +16,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn register_pool_certificate(&mut self, pool_params: &PoolParams) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::RegisterPool(RegisterPool { @@ -39,7 +39,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn register_stake_certificate(&mut self, stake_key_address: &str) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::RegisterStake(RegisterStake { @@ -68,7 +68,7 @@ impl TxBuilder { pool_id: &str, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::DelegateStake(DelegateStake { @@ -92,7 +92,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn deregister_stake_certificate(&mut self, stake_key_address: &str) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::DeregisterStake(DeregisterStake { @@ -116,7 +116,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn retire_pool_certificate(&mut self, pool_id: &str, epoch: u32) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate(CertificateType::RetirePool( RetirePool { @@ -145,7 +145,7 @@ impl TxBuilder { drep: &DRep, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::VoteDelegation(VoteDelegation { @@ -176,7 +176,7 @@ impl TxBuilder { drep: &DRep, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::StakeAndVoteDelegation(StakeAndVoteDelegation { @@ -208,7 +208,7 @@ impl TxBuilder { coin: u64, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::StakeRegistrationAndDelegation(StakeRegistrationAndDelegation { @@ -240,7 +240,7 @@ impl TxBuilder { coin: u64, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::VoteRegistrationAndDelegation(VoteRegistrationAndDelegation { @@ -274,7 +274,7 @@ impl TxBuilder { coin: u64, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::StakeVoteRegistrationAndDelegation( @@ -307,7 +307,7 @@ impl TxBuilder { committee_hot_key_address: &str, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::CommitteeHotAuth(CommitteeHotAuth { @@ -336,7 +336,7 @@ impl TxBuilder { anchor: Option, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::CommitteeColdResign(CommitteeColdResign { @@ -367,7 +367,7 @@ impl TxBuilder { anchor: Option, ) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::DRepRegistration(DRepRegistration { @@ -393,7 +393,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn drep_deregistration(&mut self, drep_id: &str, coin: u64) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate( CertificateType::DRepDeregistration(DRepDeregistration { @@ -418,7 +418,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn drep_update(&mut self, drep_id: &str, anchor: Option) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::BasicCertificate(CertificateType::DRepUpdate( DRepUpdate { @@ -446,14 +446,14 @@ impl TxBuilder { script_cbor: &str, version: Option, ) -> &mut Self { - let last_cert = self.core.mesh_tx_builder_body.certificates.pop(); + let last_cert = self.core.tx_builder_body.certificates.pop(); if last_cert.is_none() { panic!("Undefined certificate"); } let last_cert = last_cert.unwrap(); match last_cert { Certificate::BasicCertificate(basic_cert) => match version { - Some(lang_ver) => self.core.mesh_tx_builder_body.certificates.push( + Some(lang_ver) => self.core.tx_builder_body.certificates.push( Certificate::ScriptCertificate(ScriptCertificate { cert: basic_cert, redeemer: None, @@ -465,7 +465,7 @@ impl TxBuilder { )), }), ), - None => self.core.mesh_tx_builder_body.certificates.push( + None => self.core.tx_builder_body.certificates.push( Certificate::SimpleScriptCertificate(SimpleScriptCertificate { cert: basic_cert, simple_script_source: Some(SimpleScriptSource::ProvidedSimpleScriptSource( @@ -477,7 +477,7 @@ impl TxBuilder { ), }, Certificate::ScriptCertificate(script_cert) => match version { - Some(lang_ver) => self.core.mesh_tx_builder_body.certificates.push( + Some(lang_ver) => self.core.tx_builder_body.certificates.push( Certificate::ScriptCertificate(ScriptCertificate { cert: script_cert.cert, redeemer: script_cert.redeemer, @@ -522,14 +522,14 @@ impl TxBuilder { version: Option, script_size: usize, ) -> &mut Self { - let last_cert = self.core.mesh_tx_builder_body.certificates.pop(); + let last_cert = self.core.tx_builder_body.certificates.pop(); if last_cert.is_none() { panic!("Undefined certificate"); } let last_cert = last_cert.unwrap(); match last_cert { Certificate::BasicCertificate(basic_cert) => match version { - Some(lang_ver) => self.core.mesh_tx_builder_body.certificates.push( + Some(lang_ver) => self.core.tx_builder_body.certificates.push( Certificate::ScriptCertificate(ScriptCertificate { cert: basic_cert, redeemer: None, @@ -544,7 +544,7 @@ impl TxBuilder { })), }), ), - None => self.core.mesh_tx_builder_body.certificates.push( + None => self.core.tx_builder_body.certificates.push( Certificate::SimpleScriptCertificate(SimpleScriptCertificate { cert: basic_cert, simple_script_source: Some(SimpleScriptSource::InlineSimpleScriptSource( @@ -561,7 +561,7 @@ impl TxBuilder { ), }, Certificate::ScriptCertificate(script_cert) => match version { - Some(lang_ver) => self.core.mesh_tx_builder_body.certificates.push( + Some(lang_ver) => self.core.tx_builder_body.certificates.push( Certificate::ScriptCertificate(ScriptCertificate { cert: script_cert.cert, redeemer: script_cert.redeemer, @@ -598,7 +598,7 @@ impl TxBuilder { /// /// * `Self` - The TxBuilder instance pub fn certificate_redeemer_value(&mut self, redeemer: &WRedeemer) -> &mut Self { - let last_cert = self.core.mesh_tx_builder_body.certificates.pop(); + let last_cert = self.core.tx_builder_body.certificates.pop(); if last_cert.is_none() { panic!("Undefined certificate"); } @@ -615,7 +615,7 @@ impl TxBuilder { match last_cert { Certificate::BasicCertificate(basic_cert) => self .core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::ScriptCertificate(ScriptCertificate { cert: basic_cert, @@ -625,7 +625,7 @@ impl TxBuilder { Certificate::ScriptCertificate(script_cert) => self .core - .mesh_tx_builder_body + .tx_builder_body .certificates .push(Certificate::ScriptCertificate(ScriptCertificate { cert: script_cert.cert, diff --git a/packages/whisky/src/builder/complete.rs b/packages/whisky/src/builder/complete.rs index c387046..5abfa57 100644 --- a/packages/whisky/src/builder/complete.rs +++ b/packages/whisky/src/builder/complete.rs @@ -26,7 +26,7 @@ impl TxBuilder { self.complete_sync(customized_tx)?; match &self.evaluator { Some(evaluator) => { - let network = match &self.core.mesh_tx_builder_body.network { + let network = match &self.core.tx_builder_body.network { Some(builder_network) => builder_network, None => &Network::Mainnet, }; @@ -72,7 +72,7 @@ impl TxBuilder { customized_tx: Option, ) -> Result<&mut Self, JsError> { if customized_tx.is_some() { - self.core.mesh_tx_builder_body = customized_tx.unwrap(); + self.core.tx_builder_body = customized_tx.unwrap(); } else { self.queue_all_last_item(); if !self.extra_inputs.is_empty() { @@ -80,7 +80,7 @@ impl TxBuilder { } } - self.core.mesh_tx_builder_body.mints.sort_by(|a, b| { + self.core.tx_builder_body.mints.sort_by(|a, b| { let a_mint = match a { MintItem::ScriptMint(a_script_mint) => &a_script_mint.mint, MintItem::SimpleScriptMint(a_simple_script_mint) => &a_simple_script_mint.mint, @@ -92,7 +92,7 @@ impl TxBuilder { a_mint.policy_id.cmp(&b_mint.policy_id) }); - self.core.mesh_tx_builder_body.inputs.sort_by(|a, b| { + self.core.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::SimpleScriptTxIn(simple_script_tx_in) => &simple_script_tx_in.tx_in, @@ -112,7 +112,7 @@ impl TxBuilder { }); let tx_hex = serialize_tx_body( - self.core.mesh_tx_builder_body.clone(), + self.core.tx_builder_body.clone(), self.protocol_params.clone(), )?; self.core.mesh_csl.tx_hex = tx_hex; diff --git a/packages/whisky/src/builder/mod.rs b/packages/whisky/src/builder/mod.rs index d3b6b63..379d320 100644 --- a/packages/whisky/src/builder/mod.rs +++ b/packages/whisky/src/builder/mod.rs @@ -118,7 +118,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn required_signer_hash(&mut self, pub_key_hash: &str) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .required_signatures .push(pub_key_hash.to_string()); self @@ -136,7 +136,7 @@ impl TxBuilder { /// /// * `Self` - The TxBuilder instance pub fn change_address(&mut self, address: &str) -> &mut Self { - self.core.mesh_tx_builder_body.change_address = address.to_string(); + self.core.tx_builder_body.change_address = address.to_string(); self } @@ -154,7 +154,7 @@ impl TxBuilder { pub fn change_output_datum(&mut self, data: WData) -> &mut Self { match data.to_cbor() { Ok(raw_data) => { - self.core.mesh_tx_builder_body.change_datum = Some(Datum::Inline(raw_data)); + self.core.tx_builder_body.change_datum = Some(Datum::Inline(raw_data)); } Err(_) => { panic!("Error converting datum to CBOR"); @@ -175,7 +175,7 @@ impl TxBuilder { /// /// * `Self` - The TxBuilder instance pub fn invalid_before(&mut self, slot: u64) -> &mut Self { - self.core.mesh_tx_builder_body.validity_range.invalid_before = Some(slot); + self.core.tx_builder_body.validity_range.invalid_before = Some(slot); self } @@ -192,7 +192,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn invalid_hereafter(&mut self, slot: u64) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .validity_range .invalid_hereafter = Some(slot); self @@ -211,7 +211,7 @@ impl TxBuilder { /// /// * `Self` - The TxBuilder instance pub fn metadata_value(&mut self, tag: &str, metadata: &str) -> &mut Self { - self.core.mesh_tx_builder_body.metadata.push(Metadata { + self.core.tx_builder_body.metadata.push(Metadata { tag: tag.to_string(), metadata: metadata.to_string(), }); @@ -231,7 +231,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn signing_key(&mut self, skey_hex: &str) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .signing_key .push(skey_hex.to_string()); self @@ -346,7 +346,7 @@ impl TxBuilder { /// /// * `Self` - The TxBuilder instance pub fn network(&mut self, network: Network) -> &mut Self { - self.core.mesh_tx_builder_body.network = Some(network); + self.core.tx_builder_body.network = Some(network); self } @@ -373,7 +373,7 @@ impl TxBuilder { } let input = self.tx_in_item.clone().unwrap(); self.input_for_evaluation(&input.to_utxo()); - self.core.mesh_tx_builder_body.inputs.push(input); + self.core.tx_builder_body.inputs.push(input); self.tx_in_item = None } @@ -398,7 +398,7 @@ impl TxBuilder { Withdrawal::PubKeyWithdrawal(_) => {} } self.core - .mesh_tx_builder_body + .tx_builder_body .withdrawals .push(self.withdrawal_item.clone().unwrap()); self.withdrawal_item = None; @@ -424,7 +424,7 @@ impl TxBuilder { } Vote::BasicVote(_) => {} } - self.core.mesh_tx_builder_body.votes.push(self.vote_item.clone().unwrap()); + self.core.tx_builder_body.votes.push(self.vote_item.clone().unwrap()); self.vote_item = None; } @@ -439,7 +439,7 @@ impl TxBuilder { panic!("Missing mint script information"); } self.core - .mesh_tx_builder_body + .tx_builder_body .mints .push(MintItem::ScriptMint(script_mint)); } @@ -448,7 +448,7 @@ impl TxBuilder { panic!("Missing mint script information"); } self.core - .mesh_tx_builder_body + .tx_builder_body .mints .push(MintItem::SimpleScriptMint(simple_script_mint)); } @@ -462,7 +462,7 @@ impl TxBuilder { pub fn queue_all_last_item(&mut self) { if self.tx_output.is_some() { self.core - .mesh_tx_builder_body + .tx_builder_body .outputs .push(self.tx_output.clone().unwrap()); self.tx_output = None; @@ -472,7 +472,7 @@ impl TxBuilder { } if self.collateral_item.is_some() { self.core - .mesh_tx_builder_body + .tx_builder_body .collaterals .push(self.collateral_item.clone().unwrap()); self.collateral_item = None; @@ -503,7 +503,7 @@ impl TxBuilder { ) -> Result<(), JsError> { let mut required_assets = Value::new(); - for output in &self.core.mesh_tx_builder_body.outputs { + for output in &self.core.tx_builder_body.outputs { let mut output_value = Value::from_asset_vec(&output.amount); let pp = self.protocol_params.clone().unwrap_or_default(); if output_value.get("lovelace") == 0 { @@ -514,7 +514,7 @@ impl TxBuilder { } required_assets.merge(&output_value); } - for input in &self.core.mesh_tx_builder_body.inputs { + for input in &self.core.tx_builder_body.inputs { match input { TxIn::PubKeyTxIn(pub_key_tx_in) => { let input_value = @@ -534,7 +534,7 @@ impl TxBuilder { } } - for mint_item in &self.core.mesh_tx_builder_body.mints { + for mint_item in &self.core.tx_builder_body.mints { let mint = match mint_item { MintItem::ScriptMint(script_mint) => &script_mint.mint, MintItem::SimpleScriptMint(simple_script_mint) => &simple_script_mint.mint, @@ -572,7 +572,7 @@ impl TxBuilder { }, }); self.core - .mesh_tx_builder_body + .tx_builder_body .inputs .push(pub_key_input.clone()); self.input_for_evaluation(&input); diff --git a/packages/whisky/src/builder/tx_in.rs b/packages/whisky/src/builder/tx_in.rs index 1eec571..97cd4d6 100644 --- a/packages/whisky/src/builder/tx_in.rs +++ b/packages/whisky/src/builder/tx_in.rs @@ -364,7 +364,7 @@ impl TxBuilder { /// * `Self` - The TxBuilder instance pub fn read_only_tx_in_reference(&mut self, tx_hash: &str, tx_index: u32) -> &mut Self { self.core - .mesh_tx_builder_body + .tx_builder_body .reference_inputs .push(RefTxIn { tx_hash: tx_hash.to_string(), @@ -397,7 +397,7 @@ impl TxBuilder { let collateral_item = self.collateral_item.take(); if let Some(collateral_item) = collateral_item { self.core - .mesh_tx_builder_body + .tx_builder_body .collaterals .push(collateral_item); } diff --git a/packages/whisky/src/builder/tx_out.rs b/packages/whisky/src/builder/tx_out.rs index 4305100..6a4dcb4 100644 --- a/packages/whisky/src/builder/tx_out.rs +++ b/packages/whisky/src/builder/tx_out.rs @@ -19,7 +19,7 @@ impl TxBuilder { if self.tx_output.is_some() { let tx_output = self.tx_output.take(); self.core - .mesh_tx_builder_body + .tx_builder_body .outputs .push(tx_output.unwrap()); } diff --git a/packages/whisky/src/service/evaluator.rs b/packages/whisky/src/service/evaluator.rs index 85552c6..ec05acd 100644 --- a/packages/whisky/src/service/evaluator.rs +++ b/packages/whisky/src/service/evaluator.rs @@ -31,7 +31,7 @@ impl TxEvaluation for TxBuilder { for redeemer_evaluation in tx_evaluation { match redeemer_evaluation.tag { RedeemerTag::Spend => { - let input = &mut self.core.mesh_tx_builder_body.inputs + let input = &mut self.core.tx_builder_body.inputs [redeemer_evaluation.index as usize]; if let TxIn::ScriptTxIn(ScriptTxIn { script_tx_in, .. }) = input { let redeemer: &mut Redeemer = script_tx_in.redeemer.as_mut().unwrap(); @@ -41,7 +41,7 @@ impl TxEvaluation for TxBuilder { } } RedeemerTag::Mint => { - let mint_item = &mut self.core.mesh_tx_builder_body.mints + let mint_item = &mut self.core.tx_builder_body.mints [redeemer_evaluation.index as usize]; if let MintItem::ScriptMint(mint) = mint_item { let redeemer: &mut Redeemer = mint.redeemer.as_mut().unwrap(); @@ -51,7 +51,7 @@ impl TxEvaluation for TxBuilder { } } RedeemerTag::Cert => { - let cert_item = &mut self.core.mesh_tx_builder_body.certificates + let cert_item = &mut self.core.tx_builder_body.certificates [redeemer_evaluation.index as usize]; if let Certificate::ScriptCertificate(cert) = cert_item { let redeemer: &mut Redeemer = cert.redeemer.as_mut().unwrap(); @@ -61,7 +61,7 @@ impl TxEvaluation for TxBuilder { } } RedeemerTag::Reward => { - let withdrawal_item = &mut self.core.mesh_tx_builder_body.withdrawals + let withdrawal_item = &mut self.core.tx_builder_body.withdrawals [redeemer_evaluation.index as usize]; if let Withdrawal::PlutusScriptWithdrawal(withdrawal) = withdrawal_item { let redeemer: &mut Redeemer = withdrawal.redeemer.as_mut().unwrap(); diff --git a/packages/whisky/tests/mesh_tx_builder.rs b/packages/whisky/tests/tx_builder.rs similarity index 90% rename from packages/whisky/tests/mesh_tx_builder.rs rename to packages/whisky/tests/tx_builder.rs index 1c612c8..1b7bc3b 100644 --- a/packages/whisky/tests/mesh_tx_builder.rs +++ b/packages/whisky/tests/tx_builder.rs @@ -1,5 +1,5 @@ #[cfg(test)] -mod mesh_tx_builder_core_tests { +mod tx_builder_core_tests { use serde_json::{json, to_string}; use sidan_csl_rs::model::{Asset, Budget}; use whisky::{ @@ -8,7 +8,7 @@ mod mesh_tx_builder_core_tests { }; #[test] - fn test_mesh_tx_builder_core() { + fn test_tx_builder_tx_builder_core() { TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, @@ -19,14 +19,14 @@ mod mesh_tx_builder_core_tests { #[test] fn test_tx_in() { - let mut mesh = TxBuilder::new(TxBuilderParam { + let mut tx_builder = TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, submitter: None, params: None, }); let asset = Asset::new_from_str("lovelace", "30000000"); - mesh.tx_in( + tx_builder.tx_in( "93fec6deaafabcc394a15552b57b1beca120d9ee90480d1e5cb42ff20118d40a", 1, &[asset], @@ -36,7 +36,7 @@ mod mesh_tx_builder_core_tests { #[test] fn test_script_tx_in() { - let mut mesh = TxBuilder::new(TxBuilderParam { + let mut tx_builder = TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, submitter: None, @@ -50,7 +50,8 @@ mod mesh_tx_builder_core_tests { })) .unwrap(); - mesh.spending_plutus_script_v2() + tx_builder + .spending_plutus_script_v2() .tx_in( "93fec6deaafabcc394a15552b57b1beca120d9ee90480d1e5cb42ff20118d40a", 1, @@ -69,7 +70,7 @@ mod mesh_tx_builder_core_tests { #[test] fn test_script_tx_in_with_datum_value() { - let mut mesh = TxBuilder::new(TxBuilderParam { + let mut tx_builder = TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, submitter: None, @@ -83,7 +84,8 @@ mod mesh_tx_builder_core_tests { })) .unwrap(); - mesh.spending_plutus_script_v2() + tx_builder + .spending_plutus_script_v2() .tx_in( "93fec6deaafabcc394a15552b57b1beca120d9ee90480d1e5cb42ff20118d40a", 1, @@ -102,7 +104,7 @@ mod mesh_tx_builder_core_tests { #[test] fn test_script_tx_in_with_ref_script() { - let mut mesh = TxBuilder::new(TxBuilderParam { + let mut tx_builder = TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, submitter: None, @@ -116,7 +118,8 @@ mod mesh_tx_builder_core_tests { })) .unwrap(); - mesh.spending_plutus_script_v2() + tx_builder + .spending_plutus_script_v2() .tx_in( "93fec6deaafabcc394a15552b57b1beca120d9ee90480d1e5cb42ff20118d40a", 1, @@ -141,7 +144,7 @@ mod mesh_tx_builder_core_tests { #[test] fn test_script_tx_in_with_script_value() { - let mut mesh = TxBuilder::new(TxBuilderParam { + let mut tx_builder = TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, submitter: None, @@ -156,7 +159,8 @@ mod mesh_tx_builder_core_tests { .unwrap(); let script_cbor = "5916465916430100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232222323232323232325335353357389211944617461206465636f646564207375636365737366756c6c790053335734608e609a004264646605e6eb4d5d08012999ab9a3049304f00113302f375a6ae84c138004cc0c9d71aba135744609c0020906ea8d5d09aba2001304c00204622350052253350082153355006213500122222222223500822533535533553353501522350022222222222223333500d205c205c205c233355306006603e2350012253355333573466e3cd4008198d40101984ccd5cd19b87350020683500406805e05f0671305000306700d2135001223500122223501c223500222222222222233355306306c2235002222253353304101800413306b006005100506100a153357389201024c660016130240252215335001100222130280292222533350020592133333335748002464a666ae68c180c1980044c8cccd55cf800902b1191999aab9f0012058233335573e6ae8800894cd4c0e4d5d08029099299a9999999aba40012325333573460d260de0022646666aae7c004817c8c8cccd55cf800903091999aab9f357440044a66a60846ae8401484c94cd4ccccccd5d20009032903291983c111999aab9f001230590672533530463574200442a66a60086ae8800c84c16ccc1b40080041c41c01c4dd60011032903283710982b1982b8018008361aba100406a206206b06a357440040d060dc0020ca6ea8008817081708170817019484c134cc13800c00418cd5d0802030902c8310309aba200205f306500105c375400440a640a640a640a60b840b4426a00244a66aa66a6a030446a004444444444444666aa60c40d0607a06846a00244666aa60ca0d6608006e46a00244666a0024660c69000000831119831800a400000266aa60c00d046a00244660a6004666a002466aa60c80d846a00244660ae004606e00200244666066088004002466aa60c80d846a00244660ae004607200200266605c07e010660c2660a0026660c2660a066e2807c051200205d05d05613357389201023341000501533553353304e015002135350142232323232323232323232323232323232323502722330570023330782225333573466e3c0052210006e13306b3307800200133003002333718004905f4d06000a41000266660f04444a66a00620044426a004446466e28cc1f800401ccdc599984080911299a801080091099299a999843809112999ab9a3371200490000999ab9a3084013370c002900203b03b89980199b8100248008cdc1800a40080060022002266e00004ccc21c048894ccd5cd19b8900248000520021337040026600666e04009200200100348010cc01400400c008cdc7003800999804802199b8c33700002900119b8133702016006900100399b8000348008cdc08010028019999aa98348379982b911180198010009000b8a00148810048000cccc1d488894cd400c54cd40041b0884cc1accc16801000c19c884d4008894ccd5cd19b870020061333008003006333307d222253350021330710030012215333573466e1c014008400c4ccc01801400400c00401401454ccd5cd19b8900200616153353335306f07406800506913330080070023306d00106913306d3305c0060053330080070023306d00106900153350011533573892010350543800162213500206b06133074225335001130023059062221533500110022213006305d00533500305e33064330533370601c900819b8600e48040cc190cc14ccdc1806a402066e180352010330643305333706018900819b8600c48040cc190cc14ccdc1805a402066e1802d2010330643305333706014900819b8600a48040cc190cc14ccdc1804a402066e180252010330643305333706010900819b8600848040cc190cc14ccdc1803a402066e1801d201033064330533370600c900819b8600648040cc190cc14ccdc1802a402066e180152010330643305333706008900819b8600448040180d4008888004d4004888008cc0c40c448888ccc01094cd40044c0d0488cc0081900048854cd40044c0d8488cc0080140048854ccd4cc1780100084ccc0180088cc1ac0140040044ccc01c008c0e0488cc0080180040044ccc0180088cc1ac0140040048894cd40044cc1a0cc1a000c008c0181908854ccd4cc1780140084cc1a8cc1a8014010c02000c4ccc01c008cc1a80140100044cc1a8cc1a8014010c02000c888c94cd40084c0040f88854ccd4cc17c0180084ccc01c0088c018cc1b001c0040044c00c1004ccc01c0088c018cc1b001c0040048cc1a4c00cc0dc488cc008018004c01c008ccc0c802d201600d33303100a48050030ccc0c0025201200b33302f00848040028ccc0b801d200e00933302d00648030020ccc0b0015200a00733302b00448020018ccc0a800d200600533302900248010010ccc0a000520020033728026446a00644a666ae68cdc38020010999a982c82f01a80180082e02c02b099ab9c49010233420005005815335738920102334300160481533550052135001222222222235006223500422533533061225335001056221350022235001222253353303100401513305b35008061300a0071300a00735016223500222222222222200c162215335001153355335533533306322253350011002221350022233007333306a22225335001100222135002225333573460d6002266601000e00c006266601000e660c42466600201000600400c00600400c00200609e6a0264444444444440100b04426a004444a66a0082a66a6606c0160062666ae68cdc3a40020020a80aa0ba440be0ac266ae71241023344000501533535013222222222222533533355306006603e25333573466e3c0400044c138004194010818c1901584cd5ce24810233450005005822160471120011533573892103505435001615335350022235002222222222222533533355304c05202a235001223500122225335333553053059302e032303002c335530510592350010570031304000705700b21303a35001052050215335350012222333553043049301e022302001c335530410492350010470031350012222533350020472133333335748002464a666ae68c138c1500044c8cccd55cf80090221191999aab9f001204623233335573e00240904646666aae7c00481288c8cccd55cf80090261191999aab9f001204e23233335573e00240a04646666aae7c00481488c8cccd55cf800902a1191999aab9f0012056233335573e6ae8800894cd4ccc0cc0d40d4d5d080a90a99a98191aba10142153353330350370373574202642a66a60686ae84048854cd4ccc0dc0e40e4d5d080890a99a981b1aba101021533533303903b03b3574201e42a66a607c6ae84038854cd4ccc0ec0f40f4d5d080690a99a981f1aba100c21305212333333333300100b00a00900800700600500400300206806706606506406306206106005f205706005f357440040ba6ae8800816cd5d100102c9aba2002057357440040aa6ae8800814cd5d10010289aba200204f3574400409a60a60020946ea80088104810481048104128812010c108dd500419ab9c4912353637269707420636f6e74657874206465636f646564207375636365737366756c6c7900533357346088609400826464642466002006004604a6ae84d5d118258032999ab9a3045304b001132323232323232323232323232323232323232323232321233333333333300101801601401201000e00c009007005003002303f357426ae88008ccc0e1d710009aba10013574400466606c06e40026ae84004d5d10011981fbae357420026ae8800d4ccd5cd182a182d00089919191909198008020012999ab9a3057305d0011323212330010030023030357426ae88c174008cc0c1d69aba1305c00105637546ae84d5d1182d801a999ab9a3055305b001132321233001003002302e357426ae88c16c008cc0b9d69aba1305a00105437546ae84c16400414cdd51aba10013574400466605e064eb4d5d08009aba20023303802f357420026ae88008ccc0add70151aba100135744004666052eb80a0d5d08009aba200233032024357420026ae88008cc0c0084d5d08009aba2304b0023302e01f3574260940020886ea8d5d0982480202199ab9c49011d52656465656d6572206465636f646564207375636365737366756c6c790053335734608800207e2a666ae68c10c0044c8488c00800cdd71aba13048002042304800137540066ea8004888ccd54c0d00f40d8cd54c0d40f48d400488cc0a0008c020004ccd54c0d00f488d4008894cd4ccd54c0ec104c0580688d400488cc028008014018400c4cc0e801000c0c8004cd54c0d40f48d400488cc0a0008cc124894cd40044c03000c884d4008894cd4cc03000802044888cc0080280104c01800c0100088cd40040cc0bc84888c00c01088c8c848ccc0048c00c888c00c0108c00c888c0080108c00c888c0040108d4c00800cd400c004c00800884888c004010888c8cdc199b803370466e380100052080043371c00866e000052002337069040400080119b820024801048cc004894cd400840040d40a894cd5ce2491b65787065637465642065786163746c79206f6e65206f7574707574001649888d400888d400c88c8cd40148cd401094ccd5cd19b8f00200100303820302335004203025333573466e3c00800400c0e054cd400c854cd400884cd40088cd40088cd40088cd40088cc05000800480cc8cd400880cc8cc0500080048880cc888cd401080cc8894ccd5cd19b8700600315333573466e1c0140084cc0cc0100040f40f40d854cd400480d80cc8ccccccd5d20009192999ab9a3035303b00113233335573e00240564646666aae7c00480b48cccd55cf9aba20022533530093574200a4264a66a6666666ae900048c8c94ccd5cd181f80089999aab9f30440022034233335573e6ae88c11400c8c94cd4ccccccd5d2000919192999ab9a3046001133335573e609400440744646666aae7c00480f08c8cccd55cf800901f11999aab9f357440044a66a603e6ae84c140020854cd4c080d5d080310a99a98109aba1005213033333036003002001049048047203f0480473574400408a6ae88c12c00c10c54ccd5cd182280089999aab9f304a002203a233335573e6ae88c12c00c94cd4c058d5d098260021098169816800821901d82202182098250009baa0022037203720372037040213028302800103e35742608c008406a07c07a2a666ae68c1000044cccd55cf98220011181281a101a01e81d98220009baa002203120312031203103a213022330230030010383574200806c405c06e06c6ae880080d0c0e80040c4dd5001101410141014101401891999999aba40012323253335734606c00226666aae7cc0e800880a88cccd55cf9aba2303b00325335300935742607800842603a603e00206640560680662a666ae68c0d40044cccd55cf981d001101511999aab9f3574460760064a66a60126ae84c0f001084c074c0740040cc80ac0d00cc0c4c0e8004dd500110139013901390138181111999999aba400123253335734606a60760022646666aae7c00480ac8c8cccd55cf800901691999aab9f357440044a66a60146ae84014854cd4c028d5d08021098109981100100081b81b101701b81b1aba2002034303a001031375400440504050405040500629111ca09fdd51688bf4095b25bed6b4ed916188e4d4c2cdf367aaaf4ac2460023333333574800240484048404840484602a6eb80080b48cc05088ccd400c0ac008004d40040ac8ccccccd5d2000901110111011118099bad002202202b22333573466e3c008004080084cc040894cd40088400c400407848cc004894cd400809840040788c94ccd5cd18158008120a999ab9a302a001026029302f3754002446464a666ae68c0b400406454ccd5cd18160008990911180180218021aba13030002153335734605600203405460600026ea80048c94ccd5cd1814181700089919091980080180118021aba135744605c00460166ae84c0b400409cdd50009192999ab9a3027302d00113232323232323232321233330010090070030023300b75c6ae84d5d10022999ab9a3030001132122230020043574260660042a666ae68c0bc0044c84888c004010dd71aba13033002153335734605c00203c05a60660026ea8d5d08009aba200233300875c00e6ae84004d5d11817001a999ab9a3028302e00113300e300a35742605a002660080126ae84d5d118168008139baa35742605800204c6ea800488c8c94ccd5cd18140008980698021aba1302d002153335734605200204804e605a0026ea8004cc005d73ad2223302c2233335573e0024036464660406601e600e605e002600c605c00260086ae8800cd5d08010129bab0012323253335734604e00226424444600800a60086ae84c0a400854ccd5cd181300089909111180100298029aba13029002153335734604a00226424444600200a600e6ae84c0a400854ccd5cd18120008990911118018029bae35742605200404660520026ea80048c8c94ccd5cd19b874803000444888806054ccd5cd19b874802800444888888801054ccd5cd19b87480200044c8c848888888cc004024020dd69aba13574460520066eb8d5d098140010a999ab9a3026001132321222222233002009008375c6ae84d5d118148019bae3574260500042a666ae68c0940044c8c848888888cc018024020dd71aba135744605200660086ae84c0a000854ccd5cd181200089909111111180380418021aba13028002153335734604600226424444444600a01060086ae84c0a0008088c0a0004dd5000919192999ab9a302300113233300b375a6ae84c0a000cdd69aba1001375a6ae84d5d10009aba2302700215333573460440022600e60086ae84c09c008084c09c004dd5000919192999ab9a302200113008375c6ae84c09800854ccd5cd1810800898031bae35742604c004040604c0026ea80048c94ccd5cd180f98128008991909198008018011bad357426ae88c094008c00cd5d0981200080f1baa00123253335734603c604800226eb8d5d0981180080e9baa001212230020032212330010030022122300100322212233300100500400322330202233335573e002401e466026600a6ae84008c00cd5d100100c9bac001301d22533500101222153350011003221330133330232225335002100122153350031004221533353300e00400213301a0043300700300513301a0023300700600113301a0043300700300500400230060012235002223500323225333533300800900500313330080090040010020021333006007003001235001222222220071233333333001006225333573466e1c00800401854ccd5cd19b8900200100400522333573466e2000800402402888ccd5cd19b8900200100900a22333573466e2400800402802488ccd5cd19b8800200100a009225333573466e2400800440044008894ccd5cd19b890020011002100111222001112220021100122200322333573466e1c00800400c01040204024c04888448894cd40044008884cc014008ccd54c01c040014010004c0448844894cd4004020884cc01cc010008cd54c01803801000488488cc00401000cc03c88448894cd40044d400c028884ccd4014028c010008ccd54c01c034014010004c0388848894cd400854cd4004018880288854cd400c0288854cd4cc01c0100084ccd4c02403801c00c004030440048800844004880044800454cd5ce249035054310016370e90001b8748008dc3a40086e1d2006371890002ab9e5573a464600200244660066004004003"; - mesh.spending_plutus_script_v2() + tx_builder + .spending_plutus_script_v2() .tx_in( "93fec6deaafabcc394a15552b57b1beca120d9ee90480d1e5cb42ff20118d40a", 1, @@ -176,7 +180,7 @@ mod mesh_tx_builder_core_tests { #[test] fn test_read_only_tx_in_reference() { - let mut mesh = TxBuilder::new(TxBuilderParam { + let mut tx_builder = TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, submitter: None, @@ -191,7 +195,8 @@ mod mesh_tx_builder_core_tests { })) .unwrap(); - mesh.spending_plutus_script_v2() + tx_builder + .spending_plutus_script_v2() .tx_in( "93fec6deaafabcc394a15552b57b1beca120d9ee90480d1e5cb42ff20118d40a", 1, @@ -220,37 +225,38 @@ mod mesh_tx_builder_core_tests { #[test] fn test_mint() { - let mut mesh = TxBuilder::new(TxBuilderParam { + let mut tx_builder = TxBuilder::new(TxBuilderParam { evaluator: None, fetcher: None, submitter: None, params: None, }); - mesh.tx_in( - "fc1c806abc9981f4bee2ce259f61578c3341012f3d04f22e82e7e40c7e7e3c3c", - 3, - &[Asset::new_from_str("lovelace", "9692479606")], - "addr_test1vpw22xesfv0hnkfw4k5vtrz386tfgkxu6f7wfadug7prl7s6gt89x", - ) - .mint_plutus_script_v2() - .mint( - 1, - "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700", - "test", - ) - .mint_tx_in_reference( - "63210437b543c8a11afbbc6765aa205eb2733cb74e2805afd4c1c8cb72bd8e22", - 0, - "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700", - 100, - ) - .mint_redeemer_value(&WRedeemer { - data: JSON(con_str0(json!([builtin_byte_string("1234abcd")])).to_string()), - ex_units: Budget { - mem: 3386819, - steps: 1048170931, - }, - }); + tx_builder + .tx_in( + "fc1c806abc9981f4bee2ce259f61578c3341012f3d04f22e82e7e40c7e7e3c3c", + 3, + &[Asset::new_from_str("lovelace", "9692479606")], + "addr_test1vpw22xesfv0hnkfw4k5vtrz386tfgkxu6f7wfadug7prl7s6gt89x", + ) + .mint_plutus_script_v2() + .mint( + 1, + "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700", + "test", + ) + .mint_tx_in_reference( + "63210437b543c8a11afbbc6765aa205eb2733cb74e2805afd4c1c8cb72bd8e22", + 0, + "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700", + 100, + ) + .mint_redeemer_value(&WRedeemer { + data: JSON(con_str0(json!([builtin_byte_string("1234abcd")])).to_string()), + ex_units: Budget { + mem: 3386819, + steps: 1048170931, + }, + }); } }