Skip to content

Commit

Permalink
fix: emulator.get_debug_state response
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonlesisz authored and grdddj committed Oct 14, 2024
1 parent 0c3c49d commit 766f7d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/dashboard/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const app = createApp({

if (
"response" in dataObject &&
typeof dataObject.response === 'string' &&
dataObject.response.includes("Emulator downloaded")
) {
this.downloadMessage = "";
Expand Down
13 changes: 8 additions & 5 deletions src/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,15 +910,18 @@ def get_debug_state() -> Dict[str, Any]:
debug_state_dict: Dict[str, Any] = {}
for key in dir(debug_state):
val = getattr(debug_state, key)
# Not interested in private attributes and non-JSON fields (bytes)
# Not interested in private or uppercase attributes
if key.startswith("__") or key[0].isupper():
continue
# Not interested in methods
if callable(val):
continue
# Transforming bytes to string
if isinstance(val, bytes):
try:
val = val.decode("utf-8")
except UnicodeDecodeError:
val = val.hex()

debug_state_dict[key] = val

return debug_state_dict
Expand All @@ -941,9 +944,9 @@ def get_screen_content() -> ScreenContent:
if __name__ == "__main__":
# read_and_confirm_mnemonic()
# read_and_confirm_mnemonic_t3t1()
read_and_confirm_shamir_mnemonic_t3t1(3, 2)
# read_and_confirm_shamir_mnemonic_t3t1(3, 2)
# read_and_confirm_shamir_mnemonic_t2t1(3, 2)
# state = get_debug_state()
# print("state", state)
state = get_debug_state()
print("state", state)
# screen = get_screen_content()
# print("screen", screen)

0 comments on commit 766f7d2

Please sign in to comment.