From 1470057fda1034e7ee699636a8765865836465e2 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:48:47 +1000 Subject: [PATCH] rename account to key --- cmd/soroban-cli/src/config/locator.rs | 6 +++--- cmd/soroban-cli/src/config/sign_with.rs | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/cmd/soroban-cli/src/config/locator.rs b/cmd/soroban-cli/src/config/locator.rs index a6394ed9c..bc167c977 100644 --- a/cmd/soroban-cli/src/config/locator.rs +++ b/cmd/soroban-cli/src/config/locator.rs @@ -217,11 +217,11 @@ impl Args { KeyType::Identity.read_with_global(name, &self.local_config()?) } - pub fn account(&self, account_str: &str) -> Result { - if let Ok(signer) = account_str.parse::() { + pub fn key(&self, key_or_name: &str) -> Result { + if let Ok(signer) = key_or_name.parse::() { Ok(signer) } else { - self.read_identity(account_str) + self.read_identity(key_or_name) } } diff --git a/cmd/soroban-cli/src/config/sign_with.rs b/cmd/soroban-cli/src/config/sign_with.rs index ca2918b04..b86047a1c 100644 --- a/cmd/soroban-cli/src/config/sign_with.rs +++ b/cmd/soroban-cli/src/config/sign_with.rs @@ -7,7 +7,7 @@ use clap::arg; use super::{ locator, network::{self, Network}, - secret::{self, Secret}, + secret, }; #[derive(thiserror::Error, Debug)] @@ -49,11 +49,6 @@ pub struct Args { } impl Args { - pub fn secret(&self, locator: &locator::Args) -> Result { - let account = self.sign_with_key.as_deref().ok_or(Error::NoSignWithKey)?; - Ok(locator.account(account)?) - } - pub async fn sign_tx_env( &self, tx: TransactionEnvelope, @@ -61,7 +56,8 @@ impl Args { network: &Network, quiet: bool, ) -> Result { - let secret = self.secret(locator)?; + let key_or_name = self.sign_with_key.as_deref().ok_or(Error::NoSignWithKey)?; + let secret = locator.key(key_or_name)?; let signer = secret.signer(self.hd_path, false, quiet)?; Ok(sign_tx_env(&signer, tx, network).await?) }