Skip to content

Remove prepending the prefix twice #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/algokit_utils/applications/app_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,21 +449,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

Expand Down
Loading