diff --git a/crates/pop-cli/src/commands/build/mod.rs b/crates/pop-cli/src/commands/build/mod.rs index 465fcf6d..0403a846 100644 --- a/crates/pop-cli/src/commands/build/mod.rs +++ b/crates/pop-cli/src/commands/build/mod.rs @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-3.0 -use crate::{common::contracts::get_project_path, cli::{self, Cli}}; +use crate::{ + cli::{self, Cli}, + common::contracts::get_project_path, +}; use clap::{Args, Subcommand}; #[cfg(feature = "contract")] use contract::BuildContract; diff --git a/crates/pop-cli/src/commands/call/contract.rs b/crates/pop-cli/src/commands/call/contract.rs index dd57d309..2a3b684b 100644 --- a/crates/pop-cli/src/commands/call/contract.rs +++ b/crates/pop-cli/src/commands/call/contract.rs @@ -3,7 +3,7 @@ use crate::{ cli::{self, traits::*}, common::{ - contracts::{has_contract_been_built, get_project_path}, + contracts::{get_project_path, has_contract_been_built}, wallet::{prompt_to_use_wallet, request_signature}, }, }; @@ -115,10 +115,10 @@ impl CallContractCommand { if let Some(path) = &self.path { full_message.push_str(&format!(" --path {}", path.display())); - } - if let Some(path_pos) = &self.path_pos { + } + if let Some(path_pos) = &self.path_pos { full_message.push_str(&format!(" --path {}", path_pos.display())); - } + } if let Some(contract) = &self.contract { full_message.push_str(&format!(" --contract {}", contract)); } @@ -791,7 +791,7 @@ mod tests { true, Some(items), 1, // "get" message - ) + ) .expect_input( "Where is your contract deployed?", "wss://rpc1.paseo.popnetwork.xyz".into(), diff --git a/crates/pop-cli/src/commands/up/contract.rs b/crates/pop-cli/src/commands/up/contract.rs index 0128e698..e50938c0 100644 --- a/crates/pop-cli/src/commands/up/contract.rs +++ b/crates/pop-cli/src/commands/up/contract.rs @@ -3,7 +3,10 @@ use crate::{ cli::{traits::Cli as _, Cli}, common::{ - contracts::{check_contracts_node_and_prompt, has_contract_been_built, terminate_node, get_project_path}, + contracts::{ + check_contracts_node_and_prompt, get_project_path, has_contract_been_built, + terminate_node, + }, wallet::request_signature, }, style::style, diff --git a/crates/pop-cli/src/common/contracts.rs b/crates/pop-cli/src/common/contracts.rs index 2f04c329..d3b16a93 100644 --- a/crates/pop-cli/src/common/contracts.rs +++ b/crates/pop-cli/src/common/contracts.rs @@ -126,7 +126,6 @@ pub fn has_contract_been_built(path: Option<&Path>) -> bool { .unwrap_or_default() } - pub fn get_project_path(path_flag: Option, path_pos: Option) -> Option { let project_path = if let Some(ref path) = path_pos { Some(path) // Use positional path if present diff --git a/crates/pop-cli/tests/contract.rs b/crates/pop-cli/tests/contract.rs index 7e45308a..a095702a 100644 --- a/crates/pop-cli/tests/contract.rs +++ b/crates/pop-cli/tests/contract.rs @@ -67,15 +67,14 @@ async fn contract_lifecycle() -> Result<()> { .success(); assert!(temp_dir.join("test_contract").exists()); - // pop build --path ./test_contract --release - Command::cargo_bin("pop") - .unwrap() - .current_dir(&temp_dir) - .args(&["build", "--path", "./test_contract", "--release"]) - .assert() - .success(); - - + // pop build --path ./test_contract --release + Command::cargo_bin("pop") + .unwrap() + .current_dir(&temp_dir) + .args(&["build", "--path", "./test_contract", "--release"]) + .assert() + .success(); + // Verify that the directory target has been created assert!(temp_dir.join("test_contract/target").exists()); // Verify that all the artifacts has been generated