Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for crate path and mxsc in snippets gen #1924

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ pub(crate) fn create_snippets_cargo_toml(
contract_crate_name: &str,
overwrite: bool,
) {
let contract_deps = contract_crate_name.replace("_", "-");
let cargo_toml_path = format!("{snippets_folder_path}/Cargo.toml");
let mut file = if overwrite {
File::create(&cargo_toml_path).unwrap()
@@ -84,7 +85,7 @@ path = "src/{SNIPPETS_SOURCE_FILE_NAME}"
[lib]
path = "src/{LIB_SOURCE_FILE_NAME}"

[dependencies.{contract_crate_name}]
[dependencies.{contract_deps}]
path = ".."

[dependencies.multiversx-sc-snippets]
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ use super::{snippet_gen_common::write_newline, snippet_type_map::map_abi_type_to
const DEFAULT_GAS: &str = "30_000_000u64";

pub(crate) fn write_interact_struct_impl(file: &mut File, abi: &ContractAbi, crate_name: &str) {
let wasm_output_file_path_expr = format!("\"mxsc:../output/{crate_name}.mxsc.json\"");
let crate_path = crate_name.replace("_", "-");
let wasm_output_file_path_expr = format!("\"mxsc:../output/{crate_path}.mxsc.json\"");

writeln!(
file,
@@ -38,7 +39,7 @@ pub(crate) fn write_interact_struct_impl(file: &mut File, abi: &ContractAbi, cra
}}
}}
"#,
crate_name, wasm_output_file_path_expr,
crate_path, wasm_output_file_path_expr,
)
.unwrap();
write_deploy_method_impl(file, &abi.constructors[0], &abi.name);