Skip to content

Commit

Permalink
Simplify everything.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando committed Oct 7, 2024
1 parent 34d92bb commit d2e3439
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
9 changes: 6 additions & 3 deletions cmd/soroban-cli/src/commands/contract/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ pub enum Error {
OnlyDataAllowed,
#[error(transparent)]
Locator(#[from] locator::Error),
#[error(transparent)]
Network(#[from] config::network::Error),
}

impl Cmd {
Expand Down Expand Up @@ -182,11 +184,12 @@ impl NetworkRunnable for Cmd {
_global_args: Option<&global::Args>,
_config: Option<&config::Args>,
) -> Result<FullLedgerEntries, Error> {
let config: config::Args = self.config.clone().into();
let network = config.get_network()?;
let locator = self.config.locator.clone();
let network = self.config.network.get(&locator)?;

tracing::trace!(?network);
let client = Client::new(&network.rpc_url)?;
let keys = self.key.parse_keys(&config.locator, &network)?;
let keys = self.key.parse_keys(&locator, &network)?;
Ok(client.get_full_ledger_entries(&keys).await?)
}
}
11 changes: 0 additions & 11 deletions cmd/soroban-cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,3 @@ impl ArgsLocatorAndNetwork {
Ok(self.network.get(&self.locator)?)
}
}

impl From<ArgsLocatorAndNetwork> for Args {
fn from(value: ArgsLocatorAndNetwork) -> Self {
Args {
network: value.network,
source_account: Address::AliasOrSecret(String::new()),
hd_path: Some(0),
locator: value.locator,
}
}
}

0 comments on commit d2e3439

Please sign in to comment.