diff --git a/cmd/soroban-cli/src/config/mod.rs b/cmd/soroban-cli/src/config/mod.rs index 6c8f23649..12f571a50 100644 --- a/cmd/soroban-cli/src/config/mod.rs +++ b/cmd/soroban-cli/src/config/mod.rs @@ -63,16 +63,6 @@ pub struct Args { pub locator: locator::Args, } -#[derive(Debug, clap::Args, Clone, Default)] -#[group(skip)] -pub struct ArgsLocatorAndNetwork { - #[command(flatten)] - pub network: network::Args, - - #[command(flatten)] - pub locator: locator::Args, -} - impl Args { // TODO: Replace PublicKey with MuxedAccount once https://github.com/stellar/rs-stellar-xdr/pull/396 is merged. pub fn source_account(&self) -> Result { @@ -121,7 +111,7 @@ impl Args { } pub fn get_network(&self) -> Result { - HasNetwork::get_network(self) + Ok(self.network.get(&self.locator)?) } pub async fn next_sequence_number(&self, account_str: &str) -> Result { @@ -140,37 +130,18 @@ impl Pwd for Args { #[derive(Default, Serialize, Deserialize)] pub struct Config {} -trait HasNetwork { - fn network_args(&self) -> &network::Args; - fn locator_args(&self) -> &locator::Args; - - fn get_network(&self) -> Result { - Ok(self.network_args().get(self.locator_args())?) - } -} - -impl HasNetwork for Args { - fn network_args(&self) -> &network::Args { - &self.network - } - - fn locator_args(&self) -> &locator::Args { - &self.locator - } -} - -impl HasNetwork for ArgsLocatorAndNetwork { - fn network_args(&self) -> &network::Args { - &self.network - } +#[derive(Debug, clap::Args, Clone, Default)] +#[group(skip)] +pub struct ArgsLocatorAndNetwork { + #[command(flatten)] + pub network: network::Args, - fn locator_args(&self) -> &locator::Args { - &self.locator - } + #[command(flatten)] + pub locator: locator::Args, } impl ArgsLocatorAndNetwork { pub fn get_network(&self) -> Result { - HasNetwork::get_network(self) + Ok(self.network.get(&self.locator)?) } }