Skip to content

Commit

Permalink
Merge pull request #30 from sidan-lab/feature/refactor-export
Browse files Browse the repository at this point in the history
feat: exporting new_core fn
  • Loading branch information
HinsonSIDAN authored Jun 9, 2024
2 parents 3ae4219 + 9e498d9 commit bb3db6c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/sidan-csl-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sidan-csl-rs"
version = "0.5.0-alpha.10"
version = "0.5.0-alpha.11"
edition = "2021"
license = "Apache-2.0"
description = "Wrapper around the cardano-serialization-lib for easier transaction building, heavily inspired by cardano-cli APIs"
Expand Down
4 changes: 2 additions & 2 deletions packages/whisky/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "whisky"
version = "0.5.0-alpha.10"
version = "0.5.0-alpha.11"
edition = "2021"
license = "Apache-2.0"
description = "The Cardano Rust SDK, inspired by MeshJS"
Expand All @@ -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.10", path = "../sidan-csl-rs" }
sidan-csl-rs = { version = "=0.5.0-alpha.11", path = "../sidan-csl-rs" }

[profile.release]
# Tell `rustc` to optimize for small code size.
Expand Down
15 changes: 13 additions & 2 deletions packages/whisky/src/builder/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ impl IMeshTxBuilder for MeshTxBuilder {
}
}

fn new_core() -> Self {
Self::new(super::MeshTxBuilderParam {
evaluator: None,
fetcher: None,
submitter: None,
params: None,
})
}

async fn complete(&mut self, customized_tx: Option<MeshTxBuilderBody>) -> &mut Self {
self.complete_sync(customized_tx);
match &self.evaluator {
Expand Down Expand Up @@ -69,8 +78,10 @@ impl IMeshTxBuilder for MeshTxBuilder {
self.add_utxos_from(self.extra_inputs.clone(), self.selection_threshold);
}
}
let tx_hex =
serialize_tx_body(self.core.mesh_tx_builder_body.clone(), self.protocol_params.clone());
let tx_hex = serialize_tx_body(
self.core.mesh_tx_builder_body.clone(),
self.protocol_params.clone(),
);
self.core.mesh_csl.tx_hex = tx_hex;
self.core.mesh_csl.tx_builder = build_tx_builder(None);
self.core.mesh_csl.tx_inputs_builder = csl::TxInputsBuilder::new();
Expand Down
13 changes: 13 additions & 0 deletions packages/whisky/src/builder/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,24 @@ pub trait IMeshTxBuilder {
///
/// Create a new MeshTxBuilder instance
///
/// ### Arguments
///
/// * `param` - Parameters for setting up the MeshTxBuilder instance, including evaluator, fetcher, submitter, and protocol parameters
///
/// ### Returns
///
/// * `Self` - A new MeshTxBuilder instance
fn new(param: MeshTxBuilderParam) -> Self;

/// ## Transaction building method
///
/// Create a new MeshTxBuilder instance
///
/// ### Returns
///
/// * `Self` - A new MeshTxBuilder instance
fn new_core() -> Self;

/// ## Transaction building method
///
/// Complete the transaction building process with fetching missing information & tx evaluation
Expand Down

0 comments on commit bb3db6c

Please sign in to comment.