Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require source account when reading contract. #1658

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <SOURCE_ACCOUNT>`
**Usage:** `stellar contract read [OPTIONS]`

###### **Options:**

Expand Down Expand Up @@ -781,8 +781,6 @@ Print the current value of a contract-data ledger entry
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <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 <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 <CONFIG_DIR>` — Location of config directory, default is "."

Expand Down
8 changes: 4 additions & 4 deletions cmd/soroban-cli/src/commands/contract/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -179,10 +179,10 @@ 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<FullLedgerEntries, Error> {
let config = config.unwrap_or(&self.config);
let config: config::Args = self.config.clone().into();
fnando marked this conversation as resolved.
Show resolved Hide resolved
let network = config.get_network()?;
tracing::trace!(?network);
let client = Client::new(&network.rpc_url)?;
Expand Down
11 changes: 11 additions & 0 deletions cmd/soroban-cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,14 @@ 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,
}
}
}
fnando marked this conversation as resolved.
Show resolved Hide resolved
Loading