From 6b4cb0bf3ae99368cad4a4d26c334283a6dbd26e Mon Sep 17 00:00:00 2001 From: Nando Vieira Date: Mon, 24 Jun 2024 16:03:16 -0700 Subject: [PATCH 1/2] Add support for alias on `stellar contract fetch`. --- cmd/soroban-cli/src/commands/contract/fetch.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/soroban-cli/src/commands/contract/fetch.rs b/cmd/soroban-cli/src/commands/contract/fetch.rs index e9d73db98..0dbcee3d8 100644 --- a/cmd/soroban-cli/src/commands/contract/fetch.rs +++ b/cmd/soroban-cli/src/commands/contract/fetch.rs @@ -24,7 +24,7 @@ use crate::commands::network::{self, Network}; use crate::commands::{global, NetworkRunnable}; use crate::{ rpc::{self, Client}, - utils, Pwd, + Pwd, }; #[derive(Parser, Debug, Default, Clone)] @@ -124,8 +124,10 @@ impl Cmd { } fn contract_id(&self) -> Result<[u8; 32], Error> { - utils::contract_id_from_str(&self.contract_id) - .map_err(|e| Error::CannotParseContractId(self.contract_id.clone(), e)) + let network = self.network()?; + self.locator + .resolve_contract_id(&self.contract_id, &network.network_passphrase) + .map_err(Error::from) } } From cfa0ee22578b259466008ac9759a32d02c802bb1 Mon Sep 17 00:00:00 2001 From: Nando Vieira Date: Tue, 25 Jun 2024 10:33:55 -0700 Subject: [PATCH 2/2] Address pr feedback. --- cmd/soroban-cli/src/commands/contract/fetch.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/soroban-cli/src/commands/contract/fetch.rs b/cmd/soroban-cli/src/commands/contract/fetch.rs index 0dbcee3d8..c2eb5d7f6 100644 --- a/cmd/soroban-cli/src/commands/contract/fetch.rs +++ b/cmd/soroban-cli/src/commands/contract/fetch.rs @@ -125,9 +125,9 @@ impl Cmd { fn contract_id(&self) -> Result<[u8; 32], Error> { let network = self.network()?; - self.locator - .resolve_contract_id(&self.contract_id, &network.network_passphrase) - .map_err(Error::from) + Ok(self + .locator + .resolve_contract_id(&self.contract_id, &network.network_passphrase)?) } }