From 4281c46be789e38f93d2885497abfb3b2bcc6ff3 Mon Sep 17 00:00:00 2001 From: ducphamle2 Date: Sat, 30 Nov 2024 19:48:16 -0800 Subject: [PATCH] fix: always return valid result query tx --- contracts/plus/swapmap/src/contract.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/plus/swapmap/src/contract.rs b/contracts/plus/swapmap/src/contract.rs index 2574233..d52b175 100755 --- a/contracts/plus/swapmap/src/contract.rs +++ b/contracts/plus/swapmap/src/contract.rs @@ -88,7 +88,9 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { fn query_tx(deps: Deps, hash: Binary) -> StdResult { // same StdErr can use ? - let hash = MAPPED_TXS.load(deps.storage, hash.as_slice())?; + let hash = MAPPED_TXS + .load(deps.storage, hash.as_slice()) + .unwrap_or_default(); to_json_binary(&hash) }