Skip to content

Commit

Permalink
fix: apply feedback from auxiliar PRs, remove unnecesary clones
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexD10S committed Dec 6, 2024
1 parent 0d2551a commit 2bff2c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
23 changes: 9 additions & 14 deletions crates/pop-cli/src/commands/call/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ impl CallParachainCommand {
async fn configure_chain(&self, cli: &mut impl Cli) -> Result<Chain> {
cli.intro("Call a parachain")?;
// Resolve url.
let url = match self.clone().url {
Some(url) => url,
let url = match &self.url {
Some(url) => url.clone(),
None => {
// Prompt for url.
let url: String = cli
Expand Down Expand Up @@ -162,20 +162,20 @@ impl CallParachainCommand {
}

// Resolve message arguments.
let args = if self.clone().args.is_empty() {
let args = if self.args.is_empty() {
let mut args = Vec::new();
for param in &extrinsic.params {
let input = prompt_for_param(&chain.client, cli, param)?;
args.push(input);
}
args
} else {
self.clone().args
self.args.clone()
};

// Resolve who is signing the extrinsic.
let suri = match self.clone().suri {
Some(suri) => suri,
let suri = match self.suri.as_ref() {
Some(suri) => suri.clone(),
None =>
cli.input("Signer of the extrinsic:").default_input(DEFAULT_URI).interact()?,
};
Expand Down Expand Up @@ -273,10 +273,7 @@ impl CallParachain {
.interact()?
{
display_message(
&format!(
"Extrinsic {} was not submitted. Operation canceled by the user.",
self.extrinsic.name
),
&format!("Extrinsic {} was not submitted.", self.extrinsic.name),
false,
cli,
)?;
Expand Down Expand Up @@ -403,7 +400,7 @@ fn prompt_for_variant_param(
}
Ok(format!("{}({})", selected_variant.name, field_values.join(", ")))
} else {
Ok(format!("{}()", selected_variant.name.clone()))
Ok(format!("{}()", selected_variant.name))
}
}

Expand Down Expand Up @@ -655,9 +652,7 @@ mod tests {
};
let mut cli = MockCli::new()
.expect_confirm("Do you want to submit the extrinsic?", false)
.expect_outro_cancel(
"Extrinsic remark was not submitted. Operation canceled by the user.",
);
.expect_outro_cancel("Extrinsic remark was not submitted.");
let tx = call_config.prepare_extrinsic(&client, &mut cli).await?;
call_config.submit_extrinsic(&client, tx, &mut cli).await?;

Expand Down
2 changes: 1 addition & 1 deletion crates/pop-parachains/src/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub async fn construct_extrinsic(
Ok(subxt::dynamic::tx(pallet_name, extrinsic_name, parsed_args))
}

/// Signs and submits a given extrinsic to the blockchain.
/// Signs and submits a given extrinsic.
///
/// # Arguments
/// * `client` - The client used to interact with the chain.
Expand Down

0 comments on commit 2bff2c1

Please sign in to comment.