From b2e822177a3f50bf44c5464e0a55e169aa57a7c6 Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Thu, 12 Dec 2024 09:33:17 +0100 Subject: [PATCH] refactor: remove unnecessary function --- crates/pop-common/src/lib.rs | 5 +++-- crates/pop-parachains/src/call/mod.rs | 26 +------------------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/crates/pop-common/src/lib.rs b/crates/pop-common/src/lib.rs index f75ab8b4..70dbcc8f 100644 --- a/crates/pop-common/src/lib.rs +++ b/crates/pop-common/src/lib.rs @@ -75,8 +75,9 @@ pub fn find_free_port() -> u16 { /// Provides functionality for making calls to parachains or smart contracts. pub mod call { - // Note: cargo contract logic is used for parsing events after calling a chain. This could be refactored - // in the future so that we don't have to use cargo contract code in `pop-parachains`. + // Note: cargo contract logic is used for parsing events after calling a chain. This could be + // refactored in the future so that we don't have to use cargo contract code in + // `pop-parachains`. pub use contract_build::Verbosity; pub use contract_extrinsics::{DisplayEvents, TokenMetadata}; pub use ink_env::DefaultEnvironment; diff --git a/crates/pop-parachains/src/call/mod.rs b/crates/pop-parachains/src/call/mod.rs index a5126139..d7d53dba 100644 --- a/crates/pop-parachains/src/call/mod.rs +++ b/crates/pop-parachains/src/call/mod.rs @@ -79,7 +79,7 @@ pub async fn sign_and_submit_extrinsic( let events = events.display_events::(Verbosity::Default, &token_metadata)?; - Ok(format!("Extrinsic Submitted with hash: {:?}\n\n{}", result.extrinsic_hash(), events,)) + Ok(format!("Extrinsic Submitted with hash: {:?}\n\n{}", result.extrinsic_hash(), events)) } /// Encodes the call data for a given extrinsic into a hexadecimal string. @@ -128,30 +128,6 @@ impl Payload for CallData { } } -/// Signs and submits a given extrinsic. -/// -/// # Arguments -/// * `client` - Reference to an `OnlineClient` connected to the chain. -/// * `call_data` - SCALE encoded bytes representing the extrinsic's call data. -/// * `suri` - The secret URI (e.g., mnemonic or private key) for signing the extrinsic. -pub async fn sign_and_submit_extrinsic_with_call_data( - client: &OnlineClient, - call_data: Vec, - suri: &str, -) -> Result { - let signer = create_signer(suri)?; - let payload = CallData(call_data); - let result = client - .tx() - .sign_and_submit_then_watch_default(&payload, &signer) - .await - .map_err(|e| Error::ExtrinsicSubmissionError(format!("{:?}", e)))? - .wait_for_finalized_success() - .await - .map_err(|e| Error::ExtrinsicSubmissionError(format!("{:?}", e)))?; - Ok(format!("{:?}", result.extrinsic_hash())) -} - #[cfg(test)] mod tests { use super::*;