From 3f60dcd525073930982aa716004ac8a5838d9c4d Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Thu, 5 Dec 2024 11:04:02 +0100 Subject: [PATCH] refactor: naming and docs --- crates/pop-cli/src/commands/call/parachain.rs | 8 ++++---- crates/pop-common/src/errors.rs | 3 +++ crates/pop-parachains/src/errors.rs | 9 ++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/pop-cli/src/commands/call/parachain.rs b/crates/pop-cli/src/commands/call/parachain.rs index 168e2be6..7d248420 100644 --- a/crates/pop-cli/src/commands/call/parachain.rs +++ b/crates/pop-cli/src/commands/call/parachain.rs @@ -68,7 +68,7 @@ impl CallParachainCommand { }; // Send the extrinsic. - if let Err(e) = call.send_extrinsic(&chain.client, tx, &mut cli).await { + if let Err(e) = call.submit_extrinsic(&chain.client, tx, &mut cli).await { display_message(&e.to_string(), false, &mut cli)?; break; } @@ -253,7 +253,7 @@ impl CallParachain { } // Sign and submit an extrinsic. - async fn send_extrinsic( + async fn submit_extrinsic( &mut self, client: &OnlineClient, tx: DynamicPayload, @@ -625,7 +625,7 @@ mod tests { } #[tokio::test] - async fn user_cancel_send_extrinsic_works() -> Result<()> { + async fn user_cancel_submit_extrinsic_works() -> Result<()> { let client = set_up_client("wss://rpc1.paseo.popnetwork.xyz").await?; let pallets = parse_chain_metadata(&client).await?; let mut call_config = CallParachain { @@ -641,7 +641,7 @@ mod tests { "Extrinsic remark was not submitted. Operation canceled by the user.", ); let tx = call_config.prepare_extrinsic(&client, &mut cli).await?; - call_config.send_extrinsic(&client, tx, &mut cli).await?; + call_config.submit_extrinsic(&client, tx, &mut cli).await?; cli.verify() } diff --git a/crates/pop-common/src/errors.rs b/crates/pop-common/src/errors.rs index e8924290..89aa48f6 100644 --- a/crates/pop-common/src/errors.rs +++ b/crates/pop-common/src/errors.rs @@ -13,14 +13,17 @@ pub enum Error { Git(String), #[error("IO error: {0}")] IO(#[from] std::io::Error), + /// An error occurred while attempting to create a keypair from the provided URI. #[error("Failed to create keypair from URI: {0}")] KeyPairCreation(String), #[error("Manifest error: {0}")] ManifestError(#[from] cargo_toml::Error), + /// An error occurred while attempting to retrieve the manifest path. #[error("Failed to get manifest path: {0}")] ManifestPath(String), #[error("ParseError error: {0}")] ParseError(#[from] url::ParseError), + /// An error occurred while parsing the provided secret URI. #[error("Failed to parse secret URI: {0}")] ParseSecretURI(String), #[error("SourceError error: {0}")] diff --git a/crates/pop-parachains/src/errors.rs b/crates/pop-parachains/src/errors.rs index 5348d7b4..a8f3c3e7 100644 --- a/crates/pop-parachains/src/errors.rs +++ b/crates/pop-parachains/src/errors.rs @@ -9,10 +9,12 @@ pub enum Error { Aborted, #[error("Anyhow error: {0}")] AnyhowError(#[from] anyhow::Error), + /// An error occurred while encoding the call data. #[error("Failed to encode call data. {0}")] CallDataEncodingError(String), #[error("{0}")] CommonError(#[from] pop_common::Error), + /// An error occurred while attempting to establish a connection to the endpoint. #[error("Failed to establish a connection to: {0}")] ConnectionFailure(String), #[error("Configuration error: {0}")] @@ -21,15 +23,18 @@ pub enum Error { CurrentDirAccess, #[error("Failed to parse the endowment value")] EndowmentError, + /// The extrinsic is not supported. #[error("The extrinsic is not supported")] ExtrinsicNotSupported, + /// An error occurred during the submission of an extrinsic. #[error("Extrinsic submission error: {0}")] ExtrinsicSubmissionError(String), #[error("IO error: {0}")] IO(#[from] std::io::Error), #[error("JSON error: {0}")] JsonError(#[from] serde_json::Error), - #[error("Error parsing metadata for parameter {0} conversion")] + /// An error occurred while parsing metadata of a parameter. + #[error("Error parsing metadata for parameter {0}")] MetadataParsingError(String), #[error("Missing binary: {0}")] MissingBinary(String), @@ -41,8 +46,10 @@ pub enum Error { OrchestratorError(#[from] OrchestratorError), #[error("Failed to create pallet directory")] PalletDirCreation, + /// The specified pallet could not be found. #[error("Failed to find the pallet {0}")] PalletNotFound(String), + /// An error occurred while processing the arguments provided by the user. #[error("Failed to process the arguments provided by the user.")] ParamProcessingError, #[error("Invalid path")]