diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index 5128ce396..e393818ce 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -747,7 +747,7 @@ Optimize a WASM file Print the current value of a contract-data ledger entry -**Usage:** `stellar contract read [OPTIONS] --source-account ` +**Usage:** `stellar contract read [OPTIONS]` ###### **Options:** @@ -781,8 +781,6 @@ Print the current value of a contract-data ledger entry * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config -* `--source-account ` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), 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 -* `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config * `--config-dir ` — Location of config directory, default is "." diff --git a/cmd/crates/soroban-test/tests/it/integration/cookbook.rs b/cmd/crates/soroban-test/tests/it/integration/cookbook.rs index 82b9c5f43..5e9a30eb2 100644 --- a/cmd/crates/soroban-test/tests/it/integration/cookbook.rs +++ b/cmd/crates/soroban-test/tests/it/integration/cookbook.rs @@ -252,8 +252,6 @@ mod tests { .arg("xdr") .arg("--key") .arg("COUNTER") - .arg("--source-account") - .arg(source) .assert() .stdout_as_str(); let key_xdr = read_xdr.split(',').next().unwrap_or("").trim(); diff --git a/cmd/soroban-cli/src/commands/contract/read.rs b/cmd/soroban-cli/src/commands/contract/read.rs index 3cb253bb1..dae5f3cdf 100644 --- a/cmd/soroban-cli/src/commands/contract/read.rs +++ b/cmd/soroban-cli/src/commands/contract/read.rs @@ -28,7 +28,7 @@ pub struct Cmd { #[command(flatten)] pub key: key::Args, #[command(flatten)] - config: config::Args, + config: config::ArgsLocatorAndNetwork, } #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ValueEnum)] @@ -89,6 +89,8 @@ pub enum Error { OnlyDataAllowed, #[error(transparent)] Locator(#[from] locator::Error), + #[error(transparent)] + Network(#[from] config::network::Error), } impl Cmd { @@ -179,14 +181,15 @@ impl NetworkRunnable for Cmd { async fn run_against_rpc_server( &self, - _: Option<&global::Args>, - config: Option<&config::Args>, + _global_args: Option<&global::Args>, + _config: Option<&config::Args>, ) -> Result { - let config = config.unwrap_or(&self.config); - 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?) } } diff --git a/cookbook/contract-lifecycle.mdx b/cookbook/contract-lifecycle.mdx index b64262b34..e38a233de 100644 --- a/cookbook/contract-lifecycle.mdx +++ b/cookbook/contract-lifecycle.mdx @@ -47,7 +47,7 @@ stellar contract invoke --id --source alice --network testnet -- f 6. View the contract's state: ```bash -stellar contract read --id --network testnet --source alice --durability --key +stellar contract read --id --network testnet --durability --key ``` Note: `` is either `persistent` or `temporary`. `KEY` provides the key of the storage entry being read.