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

Fix: stellar contract info * commands require network when network no… #1676

Merged
merged 12 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
14 changes: 10 additions & 4 deletions cmd/soroban-cli/src/commands/contract/info/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ pub enum Error {
}

pub async fn fetch_wasm(args: &Args) -> Result<Option<Vec<u8>>, Error> {
let network = &args.network.get(&args.locator)?;
// Check if a local WASM file path is provided
if let Some(path) = &args.wasm {
// Read the WASM file and return its contents
let wasm_bytes = wasm::Args { wasm: path.clone() }.read()?;
return Ok(Some(wasm_bytes));
}

let wasm = if let Some(path) = &args.wasm {
wasm::Args { wasm: path.clone() }.read()?
} else if let Some(wasm_hash) = &args.wasm_hash {
// If no local wasm, then check for wasm_hash and fetch from the network
let network = &args.network.get(&args.locator)?;

Dhanraj30 marked this conversation as resolved.
Show resolved Hide resolved
let wasm = if let Some(wasm_hash) = &args.wasm_hash {
let hash = hex::decode(wasm_hash)
.map_err(|_| InvalidWasmHash(wasm_hash.clone()))?
.try_into()
Expand Down
2 changes: 2 additions & 0 deletions cmd/soroban-cli/src/commands/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub struct Args {
/// Do not cache your simulations and transactions
#[arg(long, env = "STELLAR_NO_CACHE", global = true)]
pub no_cache: bool,

Dhanraj30 marked this conversation as resolved.
Show resolved Hide resolved
}

#[derive(thiserror::Error, Debug)]
Expand All @@ -61,6 +62,7 @@ pub enum Error {
filepath: PathBuf,
error: soroban_ledger_snapshot::Error,
},

Dhanraj30 marked this conversation as resolved.
Show resolved Hide resolved
}

impl Args {
Expand Down
1 change: 1 addition & 0 deletions cmd/soroban-cli/src/commands/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl Cmd {
cmd.run(global_args).await?;
}
};

Dhanraj30 marked this conversation as resolved.
Show resolved Hide resolved
Ok(())
}
}
Loading