Skip to content
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

fix: emulator.get_debug_state response #271

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
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
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 @@ -909,15 +909,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 @@ -940,9 +943,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)