Skip to content

Commit a1bc63b

Browse files
KayanskiBuckram123CyberHoward
authored
Fix/savings app fixes (#322)
* Added first queriers * Added bank + Wasm traits * Added cw-multi-test 0.20.0 * Removed secp, removed ibc-relayer-types * Removed ibc-relayer-types completely * updated prost typesé * Start testing authz * Added authz test * Removed deprecated code * Lint * Format * add authz querier * tx handler error with anyhow test * format * Added authz builder method for options * Some nits * Revert with_authz, added sender options setter * Check rest of authz queries * Added mock state env id * Added fee grant in daemon builder and interface * Format * fix find_wasm_path_with * Generalized querier getter (#318) * show POC of generalized querier getter * update * fix merge and impl for all envs * Doon't verify mockj error anymore * Fixed test * update `QueryHandler` and WasmQuerier functions * fix smart query URL * fix compile * format and clippy --------- Co-authored-by: Kayanski <kowalski.kowalskin@gmail.com> * Added instantiate2 (#309) * Added instantiate2 * some fixes * Added instantiate2 addr getter * Format * Nits * Merged daemon queriers * Corrected querier in tests * Renamed queriers * fix tests * Fix tests * Renamed trait types * Changed types for osmosis test tube * Fixed features --------- Co-authored-by: Buckram <buckram123@gmail.com> Co-authored-by: CyberHoward <88450409+CyberHoward@users.noreply.github.com>
1 parent 7aa0123 commit a1bc63b

File tree

3 files changed

+33
-28
lines changed

3 files changed

+33
-28
lines changed

cw-orch-daemon/src/builder.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::{
2-
log::print_if_log_disabled,
3-
sender::{SenderBuilder, SenderOptions},
4-
DaemonAsync, DaemonBuilder,
2+
log::print_if_log_disabled, sender::SenderBuilder, sender::SenderOptions, DaemonAsync,
3+
DaemonBuilder,
54
};
65
use std::sync::Arc;
76

cw-orch-daemon/src/queriers/staking.rs

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ impl QuerierGetter<Staking> for Daemon {
3636
Staking::new(self)
3737
}
3838
}
39-
4039
impl Staking {
4140
/// Queries validator info for given validator address
4241
pub async fn _validator(

packages/cw-orch-core/src/contract/paths.rs

+31-24
Original file line numberDiff line numberDiff line change
@@ -160,33 +160,40 @@ mod artifacts_dir {
160160
build_postfix: BuildPostfix<T>,
161161
) -> Result<WasmPath, CwEnvError> {
162162
let build_postfix: String = build_postfix.into();
163-
let path_str = fs::read_dir(self.path())?
164-
.find_map(|entry| {
165-
let path = entry.ok()?.path();
166-
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
167-
if !path.is_file() {
168-
return None;
169-
}
170-
171-
if (path.extension().unwrap_or_default() == "wasm"
172-
// If a postfix is provided
173-
&& !build_postfix.is_empty()
163+
let mut wasm_with_postfix = None;
164+
let mut default_wasm = None;
165+
166+
for entry in fs::read_dir(self.path())? {
167+
let Ok(entry) = entry else {
168+
continue;
169+
};
170+
let path = entry.path();
171+
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
172+
if !path.is_file() {
173+
continue;
174+
}
175+
if path.extension().unwrap_or_default() == "wasm" {
176+
// If a postfix is provided
177+
if !build_postfix.is_empty()
174178
// It needs to be in the the file name as well.
175-
&& is_artifact_with_build_postfix(&file_name, name, &build_postfix))
176-
// If not found, check if the default build is present.
177-
|| is_default_artifact(&file_name, name)
179+
&& is_artifact_with_build_postfix(&file_name, name, &build_postfix)
178180
{
179-
Some(file_name.into_owned())
180-
} else {
181-
None
181+
wasm_with_postfix = Some(file_name.into_owned());
182+
break;
183+
}
184+
// If not found, check if the default build is present.
185+
else if is_default_artifact(&file_name, name) {
186+
default_wasm = Some(file_name.into_owned())
182187
}
183-
})
184-
.ok_or_else(|| {
185-
CwEnvError::WasmNotFound(
186-
name.to_owned(),
187-
self.path().to_str().unwrap_or_default().to_owned(),
188-
)
189-
})?;
188+
}
189+
}
190+
191+
let path_str = wasm_with_postfix.or(default_wasm).ok_or_else(|| {
192+
CwEnvError::WasmNotFound(
193+
name.to_owned(),
194+
self.path().to_str().unwrap_or_default().to_owned(),
195+
)
196+
})?;
190197
WasmPath::new(self.path().join(path_str))
191198
}
192199
}

0 commit comments

Comments
 (0)