diff --git a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs index c1503052eb..57ddbac226 100644 --- a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs +++ b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs @@ -327,7 +327,7 @@ impl NetworkRunnable for Cmd { data::write(get_txn_resp.clone().try_into()?, &network.rpc_uri()?)?; } - if let Some(url) = utils::explorer_url_for_contract(&network, &contract_id) { + if let Some(url) = utils::lab_url_for_contract(&network, &contract_id) { print.linkln(url); } diff --git a/cmd/soroban-cli/src/utils.rs b/cmd/soroban-cli/src/utils.rs index c4fe89d959..2e5351af32 100644 --- a/cmd/soroban-cli/src/utils.rs +++ b/cmd/soroban-cli/src/utils.rs @@ -41,19 +41,24 @@ static EXPLORERS: phf::Map<&'static str, &'static str> = phf_map! { "Public Global Stellar Network ; September 2015" => "https://stellar.expert/explorer/public", }; +static LAB_CONTRACT_URLS: phf::Map<&'static str, &'static str> = phf_map! { + "Test SDF Network ; September 2015" => "https://lab.stellar.org/r/testnet/contract/{contract_id}", + "Public Global Stellar Network ; September 2015" => "https://lab.stellar.org/r/mainnet/contract/{contract_id}", +}; + pub fn explorer_url_for_transaction(network: &Network, tx_hash: &str) -> Option { EXPLORERS .get(&network.network_passphrase) .map(|base_url| format!("{base_url}/tx/{tx_hash}")) } -pub fn explorer_url_for_contract( +pub fn lab_url_for_contract( network: &Network, contract_id: &stellar_strkey::Contract, ) -> Option { - EXPLORERS + LAB_CONTRACT_URLS .get(&network.network_passphrase) - .map(|base_url| format!("{base_url}/contract/{contract_id}")) + .map(|base_url| base_url.replace("{contract_id}", &contract_id.to_string())) } /// # Errors