diff --git a/cmd/crates/soroban-test/tests/it/config.rs b/cmd/crates/soroban-test/tests/it/config.rs index b796910a8..0ec8a8fb6 100644 --- a/cmd/crates/soroban-test/tests/it/config.rs +++ b/cmd/crates/soroban-test/tests/it/config.rs @@ -393,3 +393,47 @@ fn set_default_network() { .stdout(predicate::str::contains("STELLAR_NETWORK=testnet")) .success(); } + +#[test] +fn cannot_create_contract_with_test_name() { + let sandbox = TestEnv::default(); + sandbox + .new_assert_cmd("keys") + .arg("generate") + .arg("--no-fund") + .arg("d") + .assert() + .success(); + sandbox + .new_assert_cmd("contract") + .arg("alias") + .arg("add") + .arg("d") + .arg("--id=CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE") + .assert() + .stderr(predicate::str::contains("cannot overlap with key")) + .failure(); +} + +#[test] +fn cannot_create_key_with_alias() { + let sandbox = TestEnv::default(); + sandbox + .new_assert_cmd("contract") + .arg("alias") + .arg("add") + .arg("t") + .arg("--id=CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE") + .assert() + .success(); + sandbox + .new_assert_cmd("keys") + .arg("generate") + .arg("--no-fund") + .arg("t") + .assert() + .stderr(predicate::str::contains( + "cannot overlap with contract alias", + )) + .failure(); +} diff --git a/cmd/crates/soroban-test/tests/it/integration/custom_types.rs b/cmd/crates/soroban-test/tests/it/integration/custom_types.rs index 6cdb61192..f4c2be61b 100644 --- a/cmd/crates/soroban-test/tests/it/integration/custom_types.rs +++ b/cmd/crates/soroban-test/tests/it/integration/custom_types.rs @@ -5,7 +5,7 @@ use soroban_test::TestEnv; use crate::integration::util::{deploy_custom, extend_contract}; -use super::util::invoke_with_roundtrip; +use super::util::{invoke, invoke_with_roundtrip}; fn invoke_custom(e: &TestEnv, id: &str, func: &str) -> assert_cmd::Command { let mut s = e.new_assert_cmd("contract"); @@ -40,7 +40,9 @@ async fn parse() { negative_i32(sandbox, id).await; negative_i64(sandbox, id).await; account_address(sandbox, id).await; + account_address_with_alias(sandbox, id).await; contract_address(sandbox, id).await; + contract_address_with_alias(sandbox, id).await; bytes(sandbox, id).await; const_enum(sandbox, id).await; number_arg_return_ok(sandbox, id); @@ -237,6 +239,12 @@ async fn account_address(sandbox: &TestEnv, id: &str) { .await; } +async fn account_address_with_alias(sandbox: &TestEnv, id: &str) { + let res = invoke(sandbox, id, "addresse", &json!("test").to_string()).await; + let test = format!("\"{}\"", super::tx::operations::test_address(sandbox)); + assert_eq!(test, res); +} + async fn contract_address(sandbox: &TestEnv, id: &str) { invoke_with_roundtrip( sandbox, @@ -247,6 +255,22 @@ async fn contract_address(sandbox: &TestEnv, id: &str) { .await; } +async fn contract_address_with_alias(sandbox: &TestEnv, id: &str) { + sandbox + .new_assert_cmd("contract") + .arg("alias") + .arg("add") + .arg("test_contract") + .arg("--id=CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE") + .assert() + .success(); + let res = invoke(sandbox, id, "addresse", &json!("test_contract").to_string()).await; + assert_eq!( + res, + "\"CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE\"" + ); +} + async fn bytes(sandbox: &TestEnv, id: &str) { invoke_with_roundtrip(sandbox, id, "bytes", json!("7374656c6c6172")).await; } diff --git a/cmd/crates/soroban-test/tests/it/integration/tx.rs b/cmd/crates/soroban-test/tests/it/integration/tx.rs index c3cd2693b..3fa85bc09 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx.rs @@ -4,7 +4,7 @@ use soroban_test::{AssertExt, TestEnv}; use crate::integration::util::{deploy_contract, DeployKind, HELLO_WORLD}; -mod operations; +pub mod operations; #[tokio::test] async fn simulate() { diff --git a/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs b/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs index 1ce1f06c9..7f3af38ec 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs @@ -11,7 +11,7 @@ use crate::integration::{ util::{deploy_contract, DeployKind, HELLO_WORLD}, }; -fn test_address(sandbox: &TestEnv) -> String { +pub fn test_address(sandbox: &TestEnv) -> String { sandbox .new_assert_cmd("keys") .arg("address") diff --git a/cmd/crates/soroban-test/tests/it/integration/util.rs b/cmd/crates/soroban-test/tests/it/integration/util.rs index 486b00a1b..fc7f824b6 100644 --- a/cmd/crates/soroban-test/tests/it/integration/util.rs +++ b/cmd/crates/soroban-test/tests/it/integration/util.rs @@ -11,16 +11,19 @@ pub const CUSTOM_TYPES: &Wasm = &Wasm::Custom("test-wasms", "test_custom_types") pub const CUSTOM_ACCOUNT: &Wasm = &Wasm::Custom("test-wasms", "test_custom_account"); pub const SWAP: &Wasm = &Wasm::Custom("test-wasms", "test_swap"); +pub async fn invoke(sandbox: &TestEnv, id: &str, func: &str, data: &str) -> String { + sandbox + .invoke_with_test(&["--id", id, "--", func, &format!("--{func}"), data]) + .await + .unwrap() +} pub async fn invoke_with_roundtrip(e: &TestEnv, id: &str, func: &str, data: D) where D: Display, { let data = data.to_string(); println!("{data}"); - let res = e - .invoke_with_test(&["--id", id, "--", func, &format!("--{func}"), &data]) - .await - .unwrap(); + let res = invoke(e, id, func, &data).await; assert_eq!(res, data); } diff --git a/cmd/soroban-cli/src/commands/contract/arg_parsing.rs b/cmd/soroban-cli/src/commands/contract/arg_parsing.rs index 21fa2f383..a223851ca 100644 --- a/cmd/soroban-cli/src/commands/contract/arg_parsing.rs +++ b/cmd/soroban-cli/src/commands/contract/arg_parsing.rs @@ -9,12 +9,14 @@ use ed25519_dalek::SigningKey; use heck::ToKebabCase; use crate::xdr::{ - self, Hash, InvokeContractArgs, ScAddress, ScSpecEntry, ScSpecFunctionV0, ScSpecTypeDef, ScVal, - ScVec, + self, Hash, InvokeContractArgs, ScSpecEntry, ScSpecFunctionV0, ScSpecTypeDef, ScVal, ScVec, }; use crate::commands::txn_result::TxnResult; -use crate::config::{self}; +use crate::config::{ + self, + sc_address::{self, UnresolvedScAddress}, +}; use soroban_spec_tools::Spec; #[derive(thiserror::Error, Debug)] @@ -43,6 +45,10 @@ pub enum Error { MissingArgument(String), #[error("")] MissingFileArg(PathBuf), + #[error(transparent)] + ScAddress(#[from] sc_address::Error), + #[error(transparent)] + Config(#[from] config::Error), } pub fn build_host_function_parameters( @@ -80,18 +86,18 @@ pub fn build_host_function_parameters( .map(|i| { let name = i.name.to_utf8_string()?; if let Some(mut val) = matches_.get_raw(&name) { - let mut s = val.next().unwrap().to_string_lossy().to_string(); + let mut s = val + .next() + .unwrap() + .to_string_lossy() + .trim_matches('"') + .to_string(); if matches!(i.type_, ScSpecTypeDef::Address) { - let cmd = crate::commands::keys::address::Cmd { - name: s.clone(), - hd_path: Some(0), - locator: config.locator.clone(), - }; - if let Ok(address) = cmd.public_key() { - s = address.to_string(); - } - if let Ok(key) = cmd.private_key() { - signers.push(key); + let addr = resolve_address(&s, config)?; + let signer = resolve_signer(&s, config); + s = addr; + if let Some(signer) = signer { + signers.push(signer); } } spec.from_string(&s, &i.type_) @@ -125,7 +131,7 @@ pub fn build_host_function_parameters( }) .collect::, Error>>()?; - let contract_address_arg = ScAddress::Contract(Hash(contract_id.0)); + let contract_address_arg = xdr::ScAddress::Contract(Hash(contract_id.0)); let function_symbol_arg = function .try_into() .map_err(|()| Error::FunctionNameTooLong(function.clone()))?; @@ -246,3 +252,27 @@ pub fn output_to_string( } Ok(TxnResult::Res(res_str)) } + +fn resolve_address(addr_or_alias: &str, config: &config::Args) -> Result { + let sc_address: UnresolvedScAddress = addr_or_alias.parse().unwrap(); + let account = match sc_address { + UnresolvedScAddress::Resolved(addr) => addr.to_string(), + addr @ UnresolvedScAddress::Alias(_) => { + let addr = addr.resolve(&config.locator, &config.get_network()?.network_passphrase)?; + match addr { + xdr::ScAddress::Account(account) => account.to_string(), + contract @ xdr::ScAddress::Contract(_) => contract.to_string(), + } + } + }; + Ok(account) +} + +fn resolve_signer(addr_or_alias: &str, config: &config::Args) -> Option { + let cmd = crate::commands::keys::address::Cmd { + name: addr_or_alias.to_string(), + hd_path: Some(0), + locator: config.locator.clone(), + }; + cmd.private_key().ok() +} diff --git a/cmd/soroban-cli/src/commands/contract/fetch.rs b/cmd/soroban-cli/src/commands/contract/fetch.rs index 31ed191ff..d73aac3b7 100644 --- a/cmd/soroban-cli/src/commands/contract/fetch.rs +++ b/cmd/soroban-cli/src/commands/contract/fetch.rs @@ -22,7 +22,7 @@ use crate::{ pub struct Cmd { /// Contract ID to fetch #[arg(long = "id", env = "STELLAR_CONTRACT_ID")] - pub contract_id: config::ContractAddress, + pub contract_id: config::UnresolvedContract, /// Where to write output otherwise stdout is used #[arg(long, short = 'o')] pub out_file: Option, diff --git a/cmd/soroban-cli/src/commands/contract/info/shared.rs b/cmd/soroban-cli/src/commands/contract/info/shared.rs index 2ee5d018d..3c1f39b0b 100644 --- a/cmd/soroban-cli/src/commands/contract/info/shared.rs +++ b/cmd/soroban-cli/src/commands/contract/info/shared.rs @@ -47,7 +47,7 @@ pub struct Args { conflicts_with = "wasm", conflicts_with = "wasm_hash" )] - pub contract_id: Option, + pub contract_id: Option, #[command(flatten)] pub network: network::Args, #[command(flatten)] diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index c7b631343..bd069698d 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -40,7 +40,7 @@ use soroban_spec_tools::contract; pub struct Cmd { /// Contract ID to invoke #[arg(long = "id", env = "STELLAR_CONTRACT_ID")] - pub contract_id: config::ContractAddress, + pub contract_id: config::UnresolvedContract, // For testing only #[arg(skip)] pub wasm: Option, diff --git a/cmd/soroban-cli/src/commands/events.rs b/cmd/soroban-cli/src/commands/events.rs index 48d79c1b7..16ef410bd 100644 --- a/cmd/soroban-cli/src/commands/events.rs +++ b/cmd/soroban-cli/src/commands/events.rs @@ -42,7 +42,7 @@ pub struct Cmd { num_args = 1..=6, help_heading = "FILTERS" )] - contract_ids: Vec, + contract_ids: Vec, /// A set of (up to 4) topic filters to filter event topics on. A single /// topic filter can contain 1-4 different segment filters, separated by /// commas, with an asterisk (`*` character) indicating a wildcard segment. diff --git a/cmd/soroban-cli/src/commands/snapshot/create.rs b/cmd/soroban-cli/src/commands/snapshot/create.rs index a3ba865fa..9ad39953f 100644 --- a/cmd/soroban-cli/src/commands/snapshot/create.rs +++ b/cmd/soroban-cli/src/commands/snapshot/create.rs @@ -34,7 +34,7 @@ use crate::{ tx::builder, utils::get_name_from_stellar_asset_contract_storage, }; -use crate::{config::address::Address, utils::http}; +use crate::{config::address::UnresolvedMuxedAccount, utils::http}; #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ValueEnum)] pub enum Output { @@ -413,7 +413,7 @@ impl Cmd { // Resolve an account address to an account id. The address can be a // G-address or a key name (as in `stellar keys address NAME`). fn resolve_account(&self, address: &str) -> Option { - let address: Address = address.parse().ok()?; + let address: UnresolvedMuxedAccount = address.parse().ok()?; Some(AccountId(xdr::PublicKey::PublicKeyTypeEd25519( match address.resolve_muxed_account(&self.locator, None).ok()? { diff --git a/cmd/soroban-cli/src/commands/tx/op/add/args.rs b/cmd/soroban-cli/src/commands/tx/op/add/args.rs index f1858e0b0..51ee4d476 100644 --- a/cmd/soroban-cli/src/commands/tx/op/add/args.rs +++ b/cmd/soroban-cli/src/commands/tx/op/add/args.rs @@ -23,7 +23,7 @@ pub struct Args { visible_alias = "op-source", env = "STELLAR_OPERATION_SOURCE_ACCOUNT" )] - pub operation_source_account: Option, + pub operation_source_account: Option, } impl Args { diff --git a/cmd/soroban-cli/src/config/address.rs b/cmd/soroban-cli/src/config/address.rs index 066bc8d91..356c7a991 100644 --- a/cmd/soroban-cli/src/config/address.rs +++ b/cmd/soroban-cli/src/config/address.rs @@ -6,14 +6,14 @@ use super::{locator, secret}; /// Address can be either a public key or eventually an alias of a address. #[derive(Clone, Debug)] -pub enum Address { - MuxedAccount(xdr::MuxedAccount), +pub enum UnresolvedMuxedAccount { + Resolved(xdr::MuxedAccount), AliasOrSecret(String), } -impl Default for Address { +impl Default for UnresolvedMuxedAccount { fn default() -> Self { - Address::AliasOrSecret(String::default()) + UnresolvedMuxedAccount::AliasOrSecret(String::default()) } } @@ -27,37 +27,49 @@ pub enum Error { CannotSign(xdr::MuxedAccount), } -impl FromStr for Address { +impl FromStr for UnresolvedMuxedAccount { type Err = Error; fn from_str(value: &str) -> Result { Ok(xdr::MuxedAccount::from_str(value).map_or_else( - |_| Address::AliasOrSecret(value.to_string()), - Address::MuxedAccount, + |_| UnresolvedMuxedAccount::AliasOrSecret(value.to_string()), + UnresolvedMuxedAccount::Resolved, )) } } -impl Address { +impl UnresolvedMuxedAccount { pub fn resolve_muxed_account( &self, locator: &locator::Args, hd_path: Option, ) -> Result { match self { - Address::MuxedAccount(muxed_account) => Ok(muxed_account.clone()), - Address::AliasOrSecret(alias) => alias.parse().or_else(|_| { - Ok(xdr::MuxedAccount::Ed25519( - locator.read_identity(alias)?.public_key(hd_path)?.0.into(), - )) - }), + UnresolvedMuxedAccount::Resolved(muxed_account) => Ok(muxed_account.clone()), + UnresolvedMuxedAccount::AliasOrSecret(alias) => { + Self::resolve_muxed_account_with_alias(alias, locator, hd_path) + } } } + pub fn resolve_muxed_account_with_alias( + alias: &str, + locator: &locator::Args, + hd_path: Option, + ) -> Result { + alias.parse().or_else(|_| { + Ok(xdr::MuxedAccount::Ed25519( + locator.read_identity(alias)?.public_key(hd_path)?.0.into(), + )) + }) + } + pub fn resolve_secret(&self, locator: &locator::Args) -> Result { match &self { - Address::MuxedAccount(muxed_account) => Err(Error::CannotSign(muxed_account.clone())), - Address::AliasOrSecret(alias) => Ok(locator.read_identity(alias)?), + UnresolvedMuxedAccount::Resolved(muxed_account) => { + Err(Error::CannotSign(muxed_account.clone())) + } + UnresolvedMuxedAccount::AliasOrSecret(alias) => Ok(locator.read_identity(alias)?), } } } diff --git a/cmd/soroban-cli/src/config/alias.rs b/cmd/soroban-cli/src/config/alias.rs index 9d1d8c11b..734925c4e 100644 --- a/cmd/soroban-cli/src/config/alias.rs +++ b/cmd/soroban-cli/src/config/alias.rs @@ -11,39 +11,49 @@ pub struct Data { /// Address can be either a contract address, C.. or eventually an alias of a contract address. #[derive(Clone, Debug)] -pub enum ContractAddress { - ContractId(stellar_strkey::Contract), +pub enum UnresolvedContract { + Resolved(stellar_strkey::Contract), Alias(String), } -impl Default for ContractAddress { +impl Default for UnresolvedContract { fn default() -> Self { - ContractAddress::Alias(String::default()) + UnresolvedContract::Alias(String::default()) } } -impl FromStr for ContractAddress { +impl FromStr for UnresolvedContract { type Err = Infallible; fn from_str(value: &str) -> Result { Ok(stellar_strkey::Contract::from_str(value).map_or_else( - |_| ContractAddress::Alias(value.to_string()), - ContractAddress::ContractId, + |_| UnresolvedContract::Alias(value.to_string()), + UnresolvedContract::Resolved, )) } } -impl ContractAddress { +impl UnresolvedContract { pub fn resolve_contract_id( &self, locator: &locator::Args, network_passphrase: &str, ) -> Result { match self { - ContractAddress::ContractId(muxed_account) => Ok(*muxed_account), - ContractAddress::Alias(alias) => locator - .get_contract_id(alias, network_passphrase)? - .ok_or_else(|| locator::Error::ContractNotFound(alias.to_owned())), + UnresolvedContract::Resolved(contract) => Ok(*contract), + UnresolvedContract::Alias(alias) => { + Self::resolve_alias(alias, locator, network_passphrase) + } } } + + pub fn resolve_alias( + alias: &str, + locator: &locator::Args, + network_passphrase: &str, + ) -> Result { + locator + .get_contract_id(alias, network_passphrase)? + .ok_or_else(|| locator::Error::ContractNotFound(alias.to_owned())) + } } diff --git a/cmd/soroban-cli/src/config/locator.rs b/cmd/soroban-cli/src/config/locator.rs index b6f5c75c1..4445b5dcd 100644 --- a/cmd/soroban-cli/src/config/locator.rs +++ b/cmd/soroban-cli/src/config/locator.rs @@ -83,6 +83,10 @@ pub enum Error { UpgradeCheckReadFailed { path: PathBuf, error: io::Error }, #[error("Failed to write upgrade check file: {path}: {error}")] UpgradeCheckWriteFailed { path: PathBuf, error: io::Error }, + #[error("Contract alias {0}, cannot overlap with key")] + ContractAliasCannotOverlapWithKey(String), + #[error("Key cannot {0} cannot overlap with contract alias")] + KeyCannotOverlapWithContractAlias(String), } #[derive(Debug, clap::Args, Default, Clone)] @@ -163,6 +167,9 @@ impl Args { } pub fn write_identity(&self, name: &str, secret: &Secret) -> Result<(), Error> { + if let Ok(Some(_)) = self.load_contract_from_alias(name) { + return Err(Error::KeyCannotOverlapWithContractAlias(name.to_owned())); + } KeyType::Identity.write(name, secret, &self.config_dir()?) } @@ -286,6 +293,9 @@ impl Args { contract_id: &stellar_strkey::Contract, alias: &str, ) -> Result<(), Error> { + if self.read_identity(alias).is_ok() { + return Err(Error::ContractAliasCannotOverlapWithKey(alias.to_owned())); + } let path = self.alias_path(alias)?; let dir = path.parent().ok_or(Error::CannotAccessConfigDir)?; diff --git a/cmd/soroban-cli/src/config/mod.rs b/cmd/soroban-cli/src/config/mod.rs index a429ff434..1188d3bfa 100644 --- a/cmd/soroban-cli/src/config/mod.rs +++ b/cmd/soroban-cli/src/config/mod.rs @@ -1,4 +1,3 @@ -use address::Address; use clap::{arg, command}; use serde::{Deserialize, Serialize}; use std::{ @@ -19,11 +18,14 @@ pub mod alias; pub mod data; pub mod locator; pub mod network; +pub mod sc_address; pub mod secret; pub mod sign_with; pub mod upgrade_check; -pub use alias::ContractAddress; +pub use address::UnresolvedMuxedAccount; +pub use alias::UnresolvedContract; +pub use sc_address::UnresolvedScAddress; #[derive(thiserror::Error, Debug)] pub enum Error { @@ -56,7 +58,7 @@ pub struct Args { /// or a seed phrase (--source "kite urban…"). /// If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to /// sign the final transaction. In that case, trying to sign with public key will fail. - pub source_account: Address, + pub source_account: UnresolvedMuxedAccount, #[arg(long)] /// If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` diff --git a/cmd/soroban-cli/src/config/sc_address.rs b/cmd/soroban-cli/src/config/sc_address.rs new file mode 100644 index 000000000..fc9c168f2 --- /dev/null +++ b/cmd/soroban-cli/src/config/sc_address.rs @@ -0,0 +1,67 @@ +use std::str::FromStr; + +use crate::xdr; + +use super::{address, locator, UnresolvedContract}; + +/// `ScAddress` can be either a resolved `xdr::ScAddress` or an alias of a `Contract` or `MuxedAccount`. +#[allow(clippy::module_name_repetitions)] +#[derive(Clone, Debug)] +pub enum UnresolvedScAddress { + Resolved(xdr::ScAddress), + Alias(String), +} + +impl Default for UnresolvedScAddress { + fn default() -> Self { + UnresolvedScAddress::Alias(String::default()) + } +} + +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error(transparent)] + Locator(#[from] locator::Error), + #[error(transparent)] + Address(#[from] address::Error), + #[error("Account alias not Found{0}")] + AccountAliasNotFound(String), +} + +impl FromStr for UnresolvedScAddress { + type Err = Error; + + fn from_str(value: &str) -> Result { + Ok(xdr::ScAddress::from_str(value).map_or_else( + |_| UnresolvedScAddress::Alias(value.to_string()), + UnresolvedScAddress::Resolved, + )) + } +} + +impl UnresolvedScAddress { + pub fn resolve( + self, + locator: &locator::Args, + network_passphrase: &str, + ) -> Result { + let alias = match self { + UnresolvedScAddress::Resolved(addr) => return Ok(addr), + UnresolvedScAddress::Alias(alias) => alias, + }; + let contract = UnresolvedContract::resolve_alias(&alias, locator, network_passphrase); + let muxed_account = + super::UnresolvedMuxedAccount::resolve_muxed_account_with_alias(&alias, locator, None); + match (contract, muxed_account) { + (Ok(contract), Ok(_)) => { + eprintln!( + "Warning: ScAddress alias {alias} is ambiguous, assuming it is a contract" + ); + Ok(xdr::ScAddress::Contract(xdr::Hash(contract.0))) + } + (Ok(contract), _) => Ok(xdr::ScAddress::Contract(xdr::Hash(contract.0))), + (_, Ok(muxed_account)) => Ok(xdr::ScAddress::Account(muxed_account.account_id())), + _ => Err(Error::AccountAliasNotFound(alias)), + } + } +} diff --git a/cmd/soroban-cli/src/key.rs b/cmd/soroban-cli/src/key.rs index b704541c4..c3fd7ed89 100644 --- a/cmd/soroban-cli/src/key.rs +++ b/cmd/soroban-cli/src/key.rs @@ -34,7 +34,7 @@ pub struct Args { required_unless_present = "wasm", required_unless_present = "wasm_hash" )] - pub contract_id: Option, + pub contract_id: Option, /// Storage key (symbols only) #[arg(long = "key", conflicts_with = "key_xdr")] pub key: Option>,