From a36c831864b605bf7fa5bfd4864320a68646ab09 Mon Sep 17 00:00:00 2001 From: poka <poka@p2p.legal> Date: Thu, 13 Mar 2025 18:48:18 +0100 Subject: [PATCH] remove unused methods --- src/commands/transfer.rs | 2 +- src/commands/vault.rs | 2 +- src/commands/vault/display.rs | 18 ------------------ src/inputs.rs | 10 ---------- src/keys.rs | 27 --------------------------- 5 files changed, 2 insertions(+), 57 deletions(-) diff --git a/src/commands/transfer.rs b/src/commands/transfer.rs index 16f2e5e..1a97717 100644 --- a/src/commands/transfer.rs +++ b/src/commands/transfer.rs @@ -1,6 +1,6 @@ use crate::*; -#[cfg(any(feature = "dev", feature = "gdev"))] // find how to get runtime calls +#[cfg(feature = "gdev")] // find how to get runtime calls type Call = runtime::runtime_types::gdev_runtime::RuntimeCall; type BalancesCall = runtime::runtime_types::pallet_balances::pallet::Call; diff --git a/src/commands/vault.rs b/src/commands/vault.rs index 10dcdb1..a3fa4b2 100644 --- a/src/commands/vault.rs +++ b/src/commands/vault.rs @@ -7,7 +7,7 @@ use crate::*; use age::secrecy::Secret; use sea_orm::ActiveValue::Set; use sea_orm::{ConnectionTrait, TransactionTrait}; -use sea_orm::{DbErr, ModelTrait}; +use sea_orm::ModelTrait; use sp_core::crypto::AddressUri; use std::cell::RefCell; use std::io::{Read, Write}; diff --git a/src/commands/vault/display.rs b/src/commands/vault/display.rs index 935b55e..5f024d6 100644 --- a/src/commands/vault/display.rs +++ b/src/commands/vault/display.rs @@ -62,14 +62,6 @@ pub fn compute_vault_accounts_table_with_g1v1( Ok(table) } -fn add_account_tree_node_to_table( - table: &mut Table, - account_tree_node: &Rc<RefCell<AccountTreeNode>>, -) -> Result<(), GcliError> { - // Appel to the new function with show_g1v1 = true to maintain compatibility - add_account_tree_node_to_table_with_g1v1(table, account_tree_node, true, false) -} - fn add_account_tree_node_to_table_with_g1v1( table: &mut Table, account_tree_node: &Rc<RefCell<AccountTreeNode>>, @@ -88,16 +80,6 @@ fn add_account_tree_node_to_table_with_g1v1( Ok(()) } -/// Computes one or more row of the table for selected account_tree_node -/// -/// For ed25519 keys, will display over 2 rows to also show the base 58 G1v1 public key if show_g1v1 is true -pub fn compute_vault_accounts_row( - account_tree_node: &Rc<RefCell<AccountTreeNode>>, -) -> Result<Vec<Vec<Cell>>, GcliError> { - // Appel to the new function with show_g1v1 = true to maintain compatibility - compute_vault_accounts_row_with_g1v1(account_tree_node, true, false) -} - /// Computes one or more row of the table for selected account_tree_node /// /// For ed25519 keys, will display over 2 rows to also show the base 58 G1v1 public key if show_g1v1 is true diff --git a/src/inputs.rs b/src/inputs.rs index 0823130..ee84a6d 100644 --- a/src/inputs.rs +++ b/src/inputs.rs @@ -8,10 +8,6 @@ pub fn prompt_password() -> Result<String, GcliError> { prompt_password_query("Password") } -pub fn prompt_password_confirm() -> Result<String, GcliError> { - prompt_password_query_confirm("Password") -} - pub fn prompt_password_query(query: impl ToString) -> Result<String, GcliError> { inquire::Password::new(query.to_string().as_str()) .without_confirmation() @@ -39,12 +35,6 @@ pub fn prompt_seed() -> Result<String, GcliError> { .map_err(|e| GcliError::Input(e.to_string())) } -pub fn prompt_password_query_confirm(query: impl ToString) -> Result<String, GcliError> { - inquire::Password::new(query.to_string().as_str()) - .prompt() - .map_err(|e| GcliError::Input(e.to_string())) -} - /// Prompt for a (direct) vault name (cannot contain derivation path) /// /// Also preventing to use '<' and '>' as those are used in the display diff --git a/src/keys.rs b/src/keys.rs index cdbfb44..6097ca5 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -249,15 +249,6 @@ pub fn seed_from_cesium(id: &str, pwd: &str) -> [u8; 32] { seed } -/// ask user to input a secret -pub fn prompt_secret_substrate() -> sr25519::Pair { - // Only interested in the keypair which is the second element of the tuple - match prompt_secret_substrate_and_compute_keypair(CryptoScheme::Sr25519).1 { - KeyPair::Sr25519(pair) => pair, - _ => panic!("Expected Sr25519 keypair"), - } -} - pub fn prompt_secret_substrate_and_compute_keypair(crypto_scheme: CryptoScheme) -> (String, KeyPair) { loop { println!("Substrate URI can be a mnemonic or a mini-secret ('0x' prefixed seed) together with optional derivation path"); @@ -302,15 +293,6 @@ pub fn prompt_secret_cesium_and_compute_keypair(_crypto_scheme: CryptoScheme) -> } } -/// ask user to input a seed -pub fn prompt_seed() -> sr25519::Pair { - // Only interested in the keypair which is the second element of the tuple - match prompt_seed_and_compute_keypair(CryptoScheme::Sr25519).1 { - KeyPair::Sr25519(pair) => pair, - _ => panic!("Expected Sr25519 keypair"), - } -} - pub fn prompt_seed_and_compute_keypair(crypto_scheme: CryptoScheme) -> (String, KeyPair) { loop { let seed_str = inputs::prompt_seed().unwrap(); @@ -333,15 +315,6 @@ pub fn prompt_seed_and_compute_keypair(crypto_scheme: CryptoScheme) -> (String, } } -/// ask user pass (Cesium format) -pub fn prompt_predefined() -> sr25519::Pair { - // Only interested in the keypair which is the second element of the tuple - match prompt_predefined_and_compute_keypair(CryptoScheme::Sr25519).1 { - KeyPair::Sr25519(pair) => pair, - _ => panic!("Expected Sr25519 keypair"), - } -} - pub fn prompt_predefined_and_compute_keypair(crypto_scheme: CryptoScheme) -> (String, KeyPair) { let deriv = inputs::prompt_password_query("Enter derivation path: ").unwrap(); let suri = predefined_suri(&deriv); -- GitLab