diff --git a/common/client-libs/validator-client/src/nyxd/mod.rs b/common/client-libs/validator-client/src/nyxd/mod.rs index ec77c2ecad..e396af4053 100644 --- a/common/client-libs/validator-client/src/nyxd/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/mod.rs @@ -331,29 +331,31 @@ where .map(|block| block.block_id.hash) } - pub async fn get_cw2_contract_version( + pub async fn try_get_cw2_contract_version( &self, contract_address: &AccountId, - ) -> Result, NyxdError> { + ) -> Option { let raw_info = self .query_contract_raw(contract_address, b"contract_info".to_vec()) - .await?; + .await + .ok()?; - Ok(serde_json::from_slice(&raw_info).ok()) + serde_json::from_slice(&raw_info).ok() } - pub async fn get_contract_build_information( + pub async fn try_get_contract_build_information( &self, contract_address: &AccountId, - ) -> Result, NyxdError> { + ) -> Option { let raw_info = self .query_contract_raw( contract_address, CONTRACT_BUILD_INFO_STORAGE_KEY.as_bytes().to_vec(), ) - .await?; + .await + .ok()?; - Ok(serde_json::from_slice(&raw_info).ok()) + serde_json::from_slice(&raw_info).ok() } } diff --git a/nym-api/src/nym_contract_cache/cache/refresher.rs b/nym-api/src/nym_contract_cache/cache/refresher.rs index 5a9970008e..c1ea22e825 100644 --- a/nym-api/src/nym_contract_cache/cache/refresher.rs +++ b/nym-api/src/nym_contract_cache/cache/refresher.rs @@ -66,9 +66,11 @@ impl NymContractCacheRefresher { (multisig, "nym-cw3-multisig-contract"), ] { let (cw2, build_info) = if let Some(address) = address { - let cw2 = query_guard!(client_guard, get_cw2_contract_version(address).await)?; - let mut build_info = - query_guard!(client_guard, get_contract_build_information(address).await)?; + let cw2 = query_guard!(client_guard, try_get_cw2_contract_version(address).await); + let mut build_info = query_guard!( + client_guard, + try_get_contract_build_information(address).await + ); // for backwards compatibility until we migrate the contracts if build_info.is_none() {