From 8518aa10746b8750876f464e4ce89ad39a3eaf2f Mon Sep 17 00:00:00 2001 From: CiottiGiorgio Date: Thu, 17 Apr 2025 16:16:41 +0200 Subject: [PATCH 1/2] fix: remove prepending the prefix twice --- src/algokit_utils/applications/app_client.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/algokit_utils/applications/app_client.py b/src/algokit_utils/applications/app_client.py index f1e83e8..fa6982d 100644 --- a/src/algokit_utils/applications/app_client.py +++ b/src/algokit_utils/applications/app_client.py @@ -452,21 +452,16 @@ def get_map(map_name: str) -> dict[str, ABIValue]: if not box.name_raw.startswith(prefix): continue - encoded_key = prefix + box.name_raw - base64_key = base64.b64encode(encoded_key).decode("utf-8") - try: key = get_abi_decoded_value(box.name_raw[len(prefix) :], metadata.key_type, self._app_spec.structs) value = get_abi_decoded_value( - self._algorand.app.get_box_value(self._app_id, base64.b64decode(base64_key)), + self._algorand.app.get_box_value(self._app_id, box.name_raw), metadata.value_type, self._app_spec.structs, ) result[str(key)] = value except Exception as e: - if "Failed to decode key" in str(e): - raise ValueError(f"Failed to decode key {base64_key}") from e - raise ValueError(f"Failed to decode value for key {base64_key}") from e + raise ValueError(f"Failed to decode value for key {box.name_raw.decode("utf-8")}") from e return result From 004f16629e39b3ce2a7b099ee29bbb1ace405afb Mon Sep 17 00:00:00 2001 From: Altynbek Orumbayev Date: Thu, 19 Jun 2025 14:44:45 +0300 Subject: [PATCH 2/2] chore: ruff tweaks --- src/algokit_utils/applications/app_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algokit_utils/applications/app_client.py b/src/algokit_utils/applications/app_client.py index fa6982d..c688e16 100644 --- a/src/algokit_utils/applications/app_client.py +++ b/src/algokit_utils/applications/app_client.py @@ -461,7 +461,7 @@ def get_map(map_name: str) -> dict[str, ABIValue]: ) result[str(key)] = value except Exception as e: - raise ValueError(f"Failed to decode value for key {box.name_raw.decode("utf-8")}") from e + raise ValueError(f"Failed to decode value for key {box.name_raw.decode('utf-8')}") from e return result