diff --git a/Cargo.lock b/Cargo.lock index a80623e9..120698b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2117,6 +2117,7 @@ dependencies = [ "casper-client", "casper-hashing 2.0.0", "casper-types 3.0.0", + "casper-types 4.0.1", "clap", "hex", "kairos-crypto", diff --git a/kairos-cli/Cargo.toml b/kairos-cli/Cargo.toml index ad4c80f5..e881579a 100644 --- a/kairos-cli/Cargo.toml +++ b/kairos-cli/Cargo.toml @@ -36,3 +36,4 @@ assert_cmd = "2" predicates = "3" kairos-test-utils = { path = "../kairos-test-utils" } casper-client-hashing.workspace = true +casper-types.workspace = true diff --git a/kairos-cli/tests/cli_tests.rs b/kairos-cli/tests/cli_tests.rs index 0a72ee71..23f8c816 100644 --- a/kairos-cli/tests/cli_tests.rs +++ b/kairos-cli/tests/cli_tests.rs @@ -1,6 +1,5 @@ use assert_cmd::Command; use reqwest::Url; -use std::fs; use std::path::PathBuf; use casper_client::types::DeployHash; @@ -40,10 +39,9 @@ async fn deposit_successful_with_ed25519() { )) .unwrap(); - let contract_hash_path = network.working_dir.join("contracts").join(hash_name); - let contract_hash_string = fs::read_to_string(contract_hash_path).unwrap(); + let contract_hash = network.get_contract_hash_for(hash_name); - let kairos = kairos::Kairos::run(casper_rpc_url, casper_sse_url) + let kairos = kairos::Kairos::run(casper_rpc_url, casper_sse_url, Some(contract_hash)) .await .unwrap(); @@ -57,7 +55,7 @@ async fn deposit_successful_with_ed25519() { .arg(kairos.url.as_str()) .arg("deposit") .arg("--contract-hash") - .arg(contract_hash_string) + .arg(contract_hash.to_string()) .arg("--amount") .arg("123") .arg("--private-key") diff --git a/kairos-test-utils/src/kairos.rs b/kairos-test-utils/src/kairos.rs index 8bbd0ebc..a5fe4f34 100644 --- a/kairos-test-utils/src/kairos.rs +++ b/kairos-test-utils/src/kairos.rs @@ -19,7 +19,11 @@ pub struct Kairos { } impl Kairos { - pub async fn run(casper_rpc: Url, casper_sse: Url) -> Result { + pub async fn run( + casper_rpc: Url, + casper_sse: Url, + kairos_demo_contract_hash: Option, + ) -> Result { let socket_addr = TcpListener::bind("0.0.0.0:0")?.local_addr()?; let port = socket_addr.port().to_string(); let url = Url::parse(&format!("http://0.0.0.0:{}", port)).unwrap(); @@ -27,7 +31,7 @@ impl Kairos { socket_addr, casper_rpc, casper_sse, - kairos_demo_contract_hash: ContractHash::default(), + kairos_demo_contract_hash: kairos_demo_contract_hash.unwrap_or_default(), }; let process_handle = tokio::spawn(async move { @@ -57,6 +61,6 @@ mod tests { async fn test_kairos_starts_and_terminates() { let dummy_rpc = Url::parse("http://127.0.0.1:11101/rpc").unwrap(); let dummy_sse = Url::parse("http://127.0.0.1:11101/events/main").unwrap(); - let _kairos = Kairos::run(dummy_rpc, dummy_sse).await.unwrap(); + let _kairos = Kairos::run(dummy_rpc, dummy_sse, None).await.unwrap(); } }