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
Changes from all 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
13 changes: 9 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,16 @@ 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)?;
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
Loading