Skip to content

Commit 2286c77

Browse files
committed
fix(cli): pass keypair path from artifacts dir in templates
When --artifacts-path is set, use the keypair from the same directory as the .so instead of defaulting to target/deploy/. cargo build-sbf outputs both files to the same location.
1 parent 2c802d0 commit 2286c77

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

crates/cli/src/types/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ impl Framework {
4545
_ => "svm::get_program_from_native_project",
4646
};
4747
let bin_path = format!("{}/{}.so", artifacts.trim_end_matches('/'), program_name);
48-
// Pass bin_path as the 4th argument (program_name, keypair_path, idl_path, bin_path)
48+
let keypair_path = format!("{}/{}-keypair.json", artifacts.trim_end_matches('/'), program_name);
49+
// Override keypair_path (2nd arg) and bin_path (4th arg) to use artifacts dir
4950
let old = format!("program = {}(\"{}\") ", get_program_fn, program_name);
5051
let new = format!(
51-
"program = {}(\"{}\", null, null, \"{}\") ",
52-
get_program_fn, program_name, bin_path
52+
"program = {}(\"{}\", \"{}\", null, \"{}\") ",
53+
get_program_fn, program_name, keypair_path, bin_path
5354
);
5455
base.replace(&old, &new)
5556
} else {

0 commit comments

Comments
 (0)