2021-06-08 11:29:03 +00:00
|
|
|
from typing import *
|
2024-03-12 19:15:20 +00:00
|
|
|
from trezor import utils
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
class LayoutObj(Generic[T]):
|
|
|
|
"""Representation of a Rust-based layout object.
|
|
|
|
see `trezor::ui::layout::obj::LayoutObj`.
|
|
|
|
"""
|
|
|
|
def attach_timer_fn(self, fn: Callable[[int, int], None]) -> None:
|
|
|
|
"""Attach a timer setter function.
|
|
|
|
The layout object can call the timer setter with two arguments,
|
|
|
|
`token` and `deadline`. When `deadline` is reached, the layout object
|
|
|
|
expects a callback to `self.timer(token)`.
|
|
|
|
"""
|
|
|
|
if utils.USE_TOUCH:
|
|
|
|
def touch_event(self, event: int, x: int, y: int) -> T | None:
|
|
|
|
"""Receive a touch event `event` at coordinates `x`, `y`."""
|
|
|
|
if utils.USE_BUTTON:
|
|
|
|
def button_event(self, event: int, button: int) -> T | None:
|
|
|
|
"""Receive a button event `event` for button `button`."""
|
|
|
|
def progress_event(self, value: int, description: str) -> T | None:
|
|
|
|
"""Receive a progress event."""
|
|
|
|
def usb_event(self, connected: bool) -> T | None:
|
|
|
|
"""Receive a USB connect/disconnect event."""
|
|
|
|
def timer(self, token: int) -> T | None:
|
|
|
|
"""Callback for the timer set by `attach_timer_fn`.
|
|
|
|
This function should be called by the executor after the corresponding
|
|
|
|
deadline is reached.
|
|
|
|
"""
|
|
|
|
def paint(self) -> bool:
|
|
|
|
"""Paint the layout object on screen.
|
|
|
|
Will only paint updated parts of the layout as required.
|
|
|
|
Returns True if any painting actually happened.
|
|
|
|
"""
|
|
|
|
def request_complete_repaint(self) -> None:
|
|
|
|
"""Request a complete repaint of the screen.
|
|
|
|
Does not repaint the screen, a subsequent call to `paint()` is required.
|
|
|
|
"""
|
|
|
|
if __debug__:
|
|
|
|
def trace(self, tracer: Callable[[str], None]) -> None:
|
|
|
|
"""Generate a JSON trace of the layout object.
|
|
|
|
The JSON can be emitted as a sequence of calls to `tracer`, each of
|
|
|
|
which is not necessarily a valid JSON chunk. The caller must
|
|
|
|
reassemble the chunks to get a sensible result.
|
|
|
|
"""
|
|
|
|
def bounds(self) -> None:
|
|
|
|
"""Paint bounds of individual components on screen."""
|
|
|
|
def page_count(self) -> int:
|
|
|
|
"""Return the number of pages in the layout object."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
class UiResult:
|
|
|
|
"""Result of a UI operation."""
|
|
|
|
pass
|
2023-06-27 14:01:21 +00:00
|
|
|
CONFIRMED: UiResult
|
|
|
|
CANCELLED: UiResult
|
|
|
|
INFO: UiResult
|
2021-06-08 11:29:03 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2024-03-04 11:08:57 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def disable_animation(disable: bool) -> None:
|
|
|
|
"""Disable animations, debug builds only."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def check_homescreen_format(data: bytes) -> bool:
|
|
|
|
"""Check homescreen format and dimensions."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_action(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
action: str | None,
|
|
|
|
description: str | None,
|
2024-05-09 21:54:33 +00:00
|
|
|
subtitle: str | None = None,
|
2024-03-04 11:08:57 +00:00
|
|
|
verb: str | None = None,
|
|
|
|
verb_cancel: str | None = None,
|
|
|
|
hold: bool = False,
|
|
|
|
hold_danger: bool = False,
|
|
|
|
reverse: bool = False,
|
2024-05-09 21:54:33 +00:00
|
|
|
prompt_screen: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm action."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_emphasized(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: Iterable[str | tuple[bool, str]],
|
|
|
|
verb: str | None = None,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm formatted text that has been pre-split in python. For tuples
|
|
|
|
the first component is a bool indicating whether this part is emphasized."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_homescreen(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
image: bytes,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm homescreen."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_blob(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
data: str | bytes,
|
|
|
|
description: str | None,
|
|
|
|
extra: str | None,
|
|
|
|
verb: str | None = None,
|
|
|
|
verb_cancel: str | None = None,
|
|
|
|
hold: bool = False,
|
|
|
|
chunkify: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm byte sequence data."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_address(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
data: str | bytes,
|
|
|
|
description: str | None,
|
|
|
|
verb: str | None = "CONFIRM",
|
|
|
|
extra: str | None,
|
|
|
|
chunkify: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm address. Similar to `confirm_blob` but has corner info button
|
|
|
|
and allows left swipe which does the same thing as the button."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_properties(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: list[tuple[str | None, str | bytes | None, bool]],
|
|
|
|
hold: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm list of key-value pairs. The third component in the tuple should be True if
|
|
|
|
the value is to be rendered as binary with monospace font, False otherwise."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-04-28 11:46:39 +00:00
|
|
|
def flow_confirm_reset_recover() -> LayoutObj[UiResult]:
|
|
|
|
"""Confirm TOS before recovery process."""
|
2024-03-04 11:08:57 +00:00
|
|
|
|
|
|
|
|
2024-04-25 21:41:16 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-04-28 11:46:39 +00:00
|
|
|
def flow_confirm_reset_create() -> LayoutObj[UiResult]:
|
|
|
|
"""Confirm TOS before creating a wallet and have a user hold to confirm creation."""
|
2024-04-25 21:41:16 +00:00
|
|
|
|
|
|
|
|
2024-05-09 16:01:51 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def flow_confirm_set_new_pin(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
) -> LayoutObj[UiResult]:
|
|
|
|
"""Confirm new PIN setup with an option to cancel action."""
|
|
|
|
|
|
|
|
|
2024-03-04 11:08:57 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_info_with_cancel(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: Iterable[Tuple[str, str]],
|
|
|
|
horizontal: bool = False,
|
|
|
|
chunkify: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Show metadata for outgoing transaction."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_value(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
value: str,
|
|
|
|
description: str | None,
|
|
|
|
subtitle: str | None,
|
|
|
|
verb: str | None = None,
|
|
|
|
verb_cancel: str | None = None,
|
|
|
|
info_button: bool = False,
|
|
|
|
hold: bool = False,
|
|
|
|
chunkify: bool = False,
|
|
|
|
text_mono: bool = True,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm value. Merge of confirm_total and confirm_output."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_total(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: Iterable[tuple[str, str]],
|
|
|
|
info_button: bool = False,
|
|
|
|
cancel_arrow: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Transaction summary. Always hold to confirm."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_modify_output(
|
|
|
|
*,
|
|
|
|
sign: int,
|
|
|
|
amount_change: str,
|
|
|
|
amount_new: str,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Decrease or increase output amount."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_modify_fee(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
sign: int,
|
|
|
|
user_fee_change: str,
|
|
|
|
total_fee_new: str,
|
|
|
|
fee_rate_amount: str | None, # ignored
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Decrease or increase transaction fee."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_fido(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
app_name: str,
|
|
|
|
icon_name: str | None,
|
|
|
|
accounts: list[str | None],
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[int | UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""FIDO confirmation.
|
|
|
|
Returns page index in case of confirmation and CANCELLED otherwise.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_error(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str = "CONTINUE",
|
|
|
|
description: str = "",
|
|
|
|
allow_cancel: bool = False,
|
|
|
|
time_ms: int = 0,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Error modal. No buttons shown when `button` is empty string."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_warning(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str = "CONTINUE",
|
|
|
|
value: str = "",
|
|
|
|
description: str = "",
|
|
|
|
allow_cancel: bool = False,
|
|
|
|
time_ms: int = 0,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Warning modal. No buttons shown when `button` is empty string."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_success(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str = "CONTINUE",
|
|
|
|
description: str = "",
|
|
|
|
allow_cancel: bool = False,
|
|
|
|
time_ms: int = 0,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Success modal. No buttons shown when `button` is empty string."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_info(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str = "CONTINUE",
|
|
|
|
description: str = "",
|
|
|
|
allow_cancel: bool = False,
|
|
|
|
time_ms: int = 0,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Info modal. No buttons shown when `button` is empty string."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-03-12 19:15:20 +00:00
|
|
|
def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Warning modal, receiving address mismatch."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_simple(
|
|
|
|
*,
|
|
|
|
title: str | None,
|
|
|
|
description: str = "",
|
|
|
|
button: str = "",
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Simple dialog with text and one button."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_with_info(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str,
|
|
|
|
info_button: str,
|
|
|
|
items: Iterable[tuple[int, str]],
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm given items but with third button. Always single page
|
|
|
|
without scrolling."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_more(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str,
|
|
|
|
items: Iterable[tuple[int, str]],
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm long content with the possibility to go back from any page.
|
|
|
|
Meant to be used with confirm_with_info."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_coinjoin(
|
|
|
|
*,
|
|
|
|
max_rounds: str,
|
|
|
|
max_feerate: str,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm coinjoin authorization."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def request_pin(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
|
|
|
subprompt: str,
|
|
|
|
allow_cancel: bool = True,
|
|
|
|
wrong_pin: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[str | UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Request pin on device."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def request_passphrase(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
|
|
|
max_len: int,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[str | UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Passphrase input keyboard."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def request_bip39(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
|
|
|
prefill_word: str,
|
|
|
|
can_go_back: bool,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[str]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""BIP39 word input keyboard."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def request_slip39(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
|
|
|
prefill_word: str,
|
|
|
|
can_go_back: bool,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[str]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""SLIP39 word input keyboard."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def select_word(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
words: Iterable[str],
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[int]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Select mnemonic word from three possibilities - seed check after backup. The
|
|
|
|
iterable must be of exact size. Returns index in range `0..3`."""
|
|
|
|
|
|
|
|
|
2024-04-21 20:43:12 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-04-28 11:46:39 +00:00
|
|
|
def flow_prompt_backup() -> LayoutObj[UiResult]
|
|
|
|
"""Prompt a user to create backup with an option to skip."""
|
2024-04-21 20:43:12 +00:00
|
|
|
|
|
|
|
|
2024-03-04 11:08:57 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-04-28 11:46:39 +00:00
|
|
|
def flow_show_share_words(
|
2024-03-04 11:08:57 +00:00
|
|
|
*,
|
|
|
|
title: str,
|
2024-04-28 11:46:39 +00:00
|
|
|
words: Iterable[str],
|
|
|
|
text_info: str,
|
|
|
|
text_confirm: str,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-04-28 11:46:39 +00:00
|
|
|
"""Show wallet backup words preceded by an instruction screen and followed by
|
|
|
|
confirmation."""
|
2024-04-21 20:43:12 +00:00
|
|
|
|
|
|
|
|
2024-03-04 11:08:57 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def request_number(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
count: int,
|
|
|
|
min_count: int,
|
|
|
|
max_count: int,
|
|
|
|
description: Callable[[int], str] | None = None,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[tuple[UiResult, int]]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Number input with + and - buttons, description, and info button."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_checklist(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: Iterable[str],
|
|
|
|
active: int,
|
|
|
|
button: str,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
|
|
|
mark next to them."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_recovery(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
button: str,
|
|
|
|
dry_run: bool,
|
|
|
|
info_button: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Device recovery homescreen."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def select_word_count(
|
|
|
|
*,
|
|
|
|
dry_run: bool,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[int | str]: # TT returns int
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_group_share_success(
|
|
|
|
*,
|
|
|
|
lines: Iterable[str]
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Shown after successfully finishing a group."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_remaining_shares(
|
|
|
|
*,
|
|
|
|
pages: Iterable[tuple[str, str]],
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_progress(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
indeterminate: bool = False,
|
|
|
|
description: str = "",
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Show progress loader. Please note that the number of lines reserved on screen for
|
|
|
|
description is determined at construction time. If you want multiline descriptions
|
|
|
|
make sure the initial description has at least that amount of lines."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_progress_coinjoin(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
indeterminate: bool = False,
|
|
|
|
time_ms: int = 0,
|
|
|
|
skip_first_paint: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
|
|
|
time_ms timeout is passed."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_homescreen(
|
|
|
|
*,
|
|
|
|
label: str | None,
|
|
|
|
hold: bool,
|
|
|
|
notification: str | None,
|
|
|
|
notification_level: int = 0,
|
|
|
|
skip_first_paint: bool,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Idle homescreen."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def show_lockscreen(
|
|
|
|
*,
|
|
|
|
label: str | None,
|
|
|
|
bootscreen: bool,
|
|
|
|
skip_first_paint: bool,
|
|
|
|
coinjoin_authorized: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Homescreen for locked device."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_firmware_update(
|
|
|
|
*,
|
|
|
|
description: str,
|
|
|
|
fingerprint: str,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-03-12 19:15:20 +00:00
|
|
|
def show_wait_text(message: str, /) -> LayoutObj[None]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Show single-line text in the middle of the screen."""
|
2024-04-11 22:21:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-04-30 11:32:48 +00:00
|
|
|
def flow_get_address(
|
|
|
|
*,
|
|
|
|
address: str | bytes,
|
|
|
|
description: str | None,
|
|
|
|
extra: str | None,
|
|
|
|
chunkify: bool,
|
|
|
|
address_qr: str | None,
|
|
|
|
case_sensitive: bool,
|
|
|
|
account: str | None,
|
|
|
|
path: str | None,
|
|
|
|
xpubs: list[tuple[str, str]],
|
|
|
|
) -> LayoutObj[UiResult]:
|
2024-04-11 22:21:05 +00:00
|
|
|
"""Get address / receive funds."""
|
2024-04-30 11:32:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def flow_warning_hi_prio(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
value: str = "",
|
|
|
|
) -> LayoutObj[UiResult]:
|
|
|
|
"""Warning modal with multiple steps to confirm."""
|
2024-03-12 19:15:20 +00:00
|
|
|
CONFIRMED: UiResult
|
|
|
|
CANCELLED: UiResult
|
|
|
|
INFO: UiResult
|
2024-03-04 11:08:57 +00:00
|
|
|
|
|
|
|
|
2022-11-03 10:51:04 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def disable_animation(disable: bool) -> None:
|
|
|
|
"""Disable animations, debug builds only."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-11-17 22:02:20 +00:00
|
|
|
def check_homescreen_format(data: bytes) -> bool:
|
|
|
|
"""Check homescreen format and dimensions."""
|
2023-05-12 09:19:35 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-01 12:08:31 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_action(
|
|
|
|
*,
|
|
|
|
title: str,
|
2023-05-12 09:19:35 +00:00
|
|
|
action: str | None,
|
|
|
|
description: str | None,
|
|
|
|
verb: str = "CONFIRM",
|
2022-05-01 12:08:31 +00:00
|
|
|
verb_cancel: str | None = None,
|
2023-01-12 13:48:50 +00:00
|
|
|
hold: bool = False,
|
|
|
|
hold_danger: bool = False, # unused on TR
|
2022-05-01 12:08:31 +00:00
|
|
|
reverse: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-05-01 12:08:31 +00:00
|
|
|
"""Confirm action."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-09-19 08:59:03 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_homescreen(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
image: bytes,
|
|
|
|
) -> object:
|
|
|
|
"""Confirm homescreen."""
|
|
|
|
|
|
|
|
|
2022-05-01 12:08:31 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-05-12 09:19:35 +00:00
|
|
|
def confirm_blob(
|
2022-05-01 12:08:31 +00:00
|
|
|
*,
|
|
|
|
title: str,
|
2023-05-12 09:19:35 +00:00
|
|
|
data: str | bytes,
|
2022-05-01 12:08:31 +00:00
|
|
|
description: str | None,
|
2023-05-12 09:19:35 +00:00
|
|
|
extra: str | None,
|
|
|
|
verb: str = "CONFIRM",
|
|
|
|
verb_cancel: str | None = None,
|
|
|
|
hold: bool = False,
|
2023-10-23 11:21:25 +00:00
|
|
|
chunkify: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm byte sequence data."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_address(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
data: str,
|
|
|
|
description: str | None, # unused on TR
|
|
|
|
extra: str | None, # unused on TR
|
2023-10-19 15:29:29 +00:00
|
|
|
verb: str = "CONFIRM",
|
2023-09-14 10:25:13 +00:00
|
|
|
chunkify: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm address."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_properties(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: list[tuple[str | None, str | bytes | None, bool]],
|
|
|
|
hold: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm list of key-value pairs. The third component in the tuple should be True if
|
|
|
|
the value is to be rendered as binary with monospace font, False otherwise.
|
|
|
|
This only concerns the text style, you need to decode the value to UTF-8 in python."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_reset_device(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm TOS before device setup."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-06-26 08:50:28 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-06-27 14:01:21 +00:00
|
|
|
def confirm_backup() -> LayoutObj[UiResult]:
|
2023-06-26 08:50:28 +00:00
|
|
|
"""Strongly recommend user to do backup."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_address_details(
|
|
|
|
*,
|
|
|
|
address: str,
|
|
|
|
case_sensitive: bool,
|
|
|
|
account: str | None,
|
|
|
|
path: str | None,
|
|
|
|
xpubs: list[tuple[str, str]],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Show address details - QR code, account, path, cosigner xpubs."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_value(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
value: str,
|
|
|
|
verb: str | None = None,
|
|
|
|
hold: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm value."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_joint_total(
|
|
|
|
*,
|
|
|
|
spending_amount: str,
|
|
|
|
total_amount: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm total if there are external inputs."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_modify_output(
|
|
|
|
*,
|
|
|
|
sign: int,
|
|
|
|
amount_change: str,
|
|
|
|
amount_new: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-11-07 10:06:08 +00:00
|
|
|
"""Decrease or increase output amount."""
|
2023-05-12 09:19:35 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-09-14 15:00:50 +00:00
|
|
|
def confirm_output_address(
|
2023-05-12 09:19:35 +00:00
|
|
|
*,
|
|
|
|
address: str,
|
2023-06-20 15:19:56 +00:00
|
|
|
address_label: str,
|
2023-05-12 09:19:35 +00:00
|
|
|
address_title: str,
|
2023-09-14 10:25:13 +00:00
|
|
|
chunkify: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-09-14 15:00:50 +00:00
|
|
|
"""Confirm output address."""
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_output_amount(
|
|
|
|
*,
|
|
|
|
amount: str,
|
|
|
|
amount_title: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-09-14 15:00:50 +00:00
|
|
|
"""Confirm output amount."""
|
2023-05-12 09:19:35 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_total(
|
|
|
|
*,
|
|
|
|
total_amount: str,
|
|
|
|
fee_amount: str,
|
|
|
|
fee_rate_amount: str | None,
|
2023-06-20 15:19:56 +00:00
|
|
|
account_label: str | None,
|
2023-05-12 09:19:35 +00:00
|
|
|
total_label: str,
|
|
|
|
fee_label: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm summary of a transaction."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-07-31 15:02:36 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-12-01 15:18:58 +00:00
|
|
|
def altcoin_tx_summary(
|
2023-07-31 15:02:36 +00:00
|
|
|
*,
|
2023-12-01 15:18:58 +00:00
|
|
|
amount_title: str,
|
|
|
|
amount_value: str,
|
|
|
|
fee_title: str,
|
|
|
|
fee_value: str,
|
2023-07-31 15:02:36 +00:00
|
|
|
items: Iterable[Tuple[str, str]],
|
2023-12-01 15:18:58 +00:00
|
|
|
cancel_cross: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-12-01 15:18:58 +00:00
|
|
|
"""Confirm details about altcoin transaction."""
|
2023-07-31 15:02:36 +00:00
|
|
|
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-06-27 14:01:21 +00:00
|
|
|
def tutorial() -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Show user how to interact with the device."""
|
|
|
|
|
2023-06-20 07:25:02 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_modify_fee(
|
|
|
|
*,
|
2023-05-31 11:16:07 +00:00
|
|
|
title: str, # ignored
|
2023-05-12 09:19:35 +00:00
|
|
|
sign: int,
|
|
|
|
user_fee_change: str,
|
|
|
|
total_fee_new: str,
|
|
|
|
fee_rate_amount: str | None,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Decrease or increase transaction fee."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_fido(
|
|
|
|
*,
|
2023-06-14 12:15:36 +00:00
|
|
|
title: str,
|
2023-05-12 09:19:35 +00:00
|
|
|
app_name: str,
|
|
|
|
icon_name: str | None, # unused on TR
|
|
|
|
accounts: list[str | None],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[int | UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""FIDO confirmation.
|
|
|
|
Returns page index in case of confirmation and CANCELLED otherwise.
|
|
|
|
"""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-06-20 07:25:02 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def multiple_pages_texts(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
verb: str,
|
|
|
|
items: list[str],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-06-20 07:25:02 +00:00
|
|
|
"""Show multiple texts, each on its own page."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-06-29 15:26:51 +00:00
|
|
|
def show_warning(
|
|
|
|
*,
|
|
|
|
button: str,
|
|
|
|
warning: str,
|
|
|
|
description: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-06-29 15:26:51 +00:00
|
|
|
"""Warning modal with middle button and centered text."""
|
2023-06-20 07:25:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_info(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str = "",
|
|
|
|
time_ms: int = 0,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Info modal."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-06-21 10:00:15 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-06-27 14:01:21 +00:00
|
|
|
def show_passphrase() -> LayoutObj[UiResult]:
|
2023-06-21 10:00:15 +00:00
|
|
|
"""Show passphrase on host dialog."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2023-06-27 14:01:21 +00:00
|
|
|
def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Warning modal, receiving address mismatch."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_with_info(
|
|
|
|
*,
|
|
|
|
title: str,
|
2023-08-08 10:35:28 +00:00
|
|
|
button: str,
|
2023-05-12 09:19:35 +00:00
|
|
|
info_button: str, # unused on TR
|
2024-04-29 11:02:40 +00:00
|
|
|
items: Iterable[Tuple[int, str | bytes]],
|
2023-08-08 10:35:28 +00:00
|
|
|
verb_cancel: str | None = None,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm given items but with third button. Always single page
|
|
|
|
without scrolling."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-08-02 10:47:33 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_more(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str,
|
2024-04-29 11:02:40 +00:00
|
|
|
items: Iterable[tuple[int, str | bytes]],
|
2023-08-02 10:47:33 +00:00
|
|
|
) -> object:
|
|
|
|
"""Confirm long content with the possibility to go back from any page.
|
|
|
|
Meant to be used with confirm_with_info."""
|
|
|
|
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_coinjoin(
|
|
|
|
*,
|
|
|
|
max_rounds: str,
|
|
|
|
max_feerate: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Confirm coinjoin authorization."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def request_pin(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
|
|
|
subprompt: str,
|
|
|
|
allow_cancel: bool = True, # unused on TR
|
|
|
|
wrong_pin: bool = False, # unused on TR
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str | UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Request pin on device."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def request_passphrase(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
|
|
|
max_len: int, # unused on TR
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str | UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Get passphrase."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def request_bip39(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
2024-01-29 13:38:02 +00:00
|
|
|
prefill_word: str,
|
|
|
|
can_go_back: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Get recovery word for BIP39."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def request_slip39(
|
|
|
|
*,
|
|
|
|
prompt: str,
|
2024-01-29 13:38:02 +00:00
|
|
|
prefill_word: str,
|
|
|
|
can_go_back: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""SLIP39 word input keyboard."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def select_word(
|
|
|
|
*,
|
|
|
|
title: str, # unused on TR
|
|
|
|
description: str,
|
|
|
|
words: Iterable[str],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[int]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Select mnemonic word from three possibilities - seed check after backup. The
|
|
|
|
iterable must be of exact size. Returns index in range `0..3`."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_share_words(
|
|
|
|
*,
|
|
|
|
share_words: Iterable[str],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Shows a backup seed."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def request_number(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
count: int,
|
|
|
|
min_count: int,
|
|
|
|
max_count: int,
|
|
|
|
description: Callable[[int], str] | None = None, # unused on TR
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[tuple[UiResult, int]]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Number input with + and - buttons, description, and info button."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_checklist(
|
|
|
|
*,
|
|
|
|
title: str, # unused on TR
|
|
|
|
items: Iterable[str],
|
|
|
|
active: int,
|
|
|
|
button: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
|
|
|
mark next to them."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_recovery(
|
|
|
|
*,
|
|
|
|
title: str, # unused on TR
|
|
|
|
description: str,
|
|
|
|
button: str,
|
|
|
|
dry_run: bool,
|
|
|
|
info_button: bool, # unused on TR
|
2023-06-29 15:26:51 +00:00
|
|
|
show_info: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Device recovery homescreen."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def select_word_count(
|
|
|
|
*,
|
|
|
|
dry_run: bool, # unused on TR
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[int | str]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_group_share_success(
|
|
|
|
*,
|
|
|
|
lines: Iterable[str],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[int]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Shown after successfully finishing a group."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_progress(
|
|
|
|
*,
|
2024-03-15 10:47:31 +00:00
|
|
|
description: str,
|
2023-05-12 09:19:35 +00:00
|
|
|
indeterminate: bool = False,
|
2024-03-15 10:47:31 +00:00
|
|
|
title: str | None = None,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Show progress loader. Please note that the number of lines reserved on screen for
|
|
|
|
description is determined at construction time. If you want multiline descriptions
|
|
|
|
make sure the initial description has at least that amount of lines."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_progress_coinjoin(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
indeterminate: bool = False,
|
|
|
|
time_ms: int = 0,
|
|
|
|
skip_first_paint: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-07-11 13:05:39 +00:00
|
|
|
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
|
|
|
time_ms timeout is passed."""
|
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_homescreen(
|
|
|
|
*,
|
|
|
|
label: str | None,
|
|
|
|
hold: bool, # unused on TR
|
|
|
|
notification: str | None,
|
|
|
|
notification_level: int = 0,
|
|
|
|
skip_first_paint: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Idle homescreen."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def show_lockscreen(
|
|
|
|
*,
|
|
|
|
label: str | None,
|
|
|
|
bootscreen: bool,
|
|
|
|
skip_first_paint: bool,
|
2023-10-18 17:19:32 +00:00
|
|
|
coinjoin_authorized: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-12 09:19:35 +00:00
|
|
|
"""Homescreen for locked device."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-10-20 12:58:32 +00:00
|
|
|
# rust/src/ui/model_tr/layout.rs
|
|
|
|
def confirm_firmware_update(
|
|
|
|
*,
|
|
|
|
description: str,
|
|
|
|
fingerprint: str,
|
|
|
|
) -> None:
|
|
|
|
"""Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
2023-08-11 15:57:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_tr/layout.rs
|
2024-02-29 10:56:34 +00:00
|
|
|
def show_wait_text(message: str, /) -> None:
|
2023-08-11 15:57:32 +00:00
|
|
|
"""Show single-line text in the middle of the screen."""
|
2023-06-27 14:01:21 +00:00
|
|
|
from trezor import utils
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
class LayoutObj(Generic[T]):
|
|
|
|
"""Representation of a Rust-based layout object.
|
|
|
|
see `trezor::ui::layout::obj::LayoutObj`.
|
|
|
|
"""
|
|
|
|
def attach_timer_fn(self, fn: Callable[[int, int], None]) -> None:
|
|
|
|
"""Attach a timer setter function.
|
|
|
|
The layout object can call the timer setter with two arguments,
|
|
|
|
`token` and `deadline`. When `deadline` is reached, the layout object
|
|
|
|
expects a callback to `self.timer(token)`.
|
|
|
|
"""
|
|
|
|
if utils.USE_TOUCH:
|
|
|
|
def touch_event(self, event: int, x: int, y: int) -> T | None:
|
|
|
|
"""Receive a touch event `event` at coordinates `x`, `y`."""
|
|
|
|
if utils.USE_BUTTON:
|
|
|
|
def button_event(self, event: int, button: int) -> T | None:
|
|
|
|
"""Receive a button event `event` for button `button`."""
|
|
|
|
def progress_event(self, value: int, description: str) -> T | None:
|
|
|
|
"""Receive a progress event."""
|
|
|
|
def usb_event(self, connected: bool) -> T | None:
|
|
|
|
"""Receive a USB connect/disconnect event."""
|
|
|
|
def timer(self, token: int) -> T | None:
|
|
|
|
"""Callback for the timer set by `attach_timer_fn`.
|
|
|
|
This function should be called by the executor after the corresponding
|
|
|
|
deadline is reached.
|
|
|
|
"""
|
|
|
|
def paint(self) -> bool:
|
|
|
|
"""Paint the layout object on screen.
|
|
|
|
Will only paint updated parts of the layout as required.
|
|
|
|
Returns True if any painting actually happened.
|
|
|
|
"""
|
|
|
|
def request_complete_repaint(self) -> None:
|
|
|
|
"""Request a complete repaint of the screen.
|
|
|
|
Does not repaint the screen, a subsequent call to `paint()` is required.
|
|
|
|
"""
|
|
|
|
if __debug__:
|
|
|
|
def trace(self, tracer: Callable[[str], None]) -> None:
|
|
|
|
"""Generate a JSON trace of the layout object.
|
|
|
|
The JSON can be emitted as a sequence of calls to `tracer`, each of
|
|
|
|
which is not necessarily a valid JSON chunk. The caller must
|
|
|
|
reassemble the chunks to get a sensible result.
|
|
|
|
"""
|
|
|
|
def bounds(self) -> None:
|
|
|
|
"""Paint bounds of individual components on screen."""
|
|
|
|
def page_count(self) -> int:
|
|
|
|
"""Return the number of pages in the layout object."""
|
2024-04-24 21:09:00 +00:00
|
|
|
def button_request(self) -> tuple[int, str] | None:
|
|
|
|
"""Return (code, type) of button request made during the last event or timer pass."""
|
2023-06-27 14:01:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
class UiResult:
|
|
|
|
"""Result of a UI operation."""
|
|
|
|
pass
|
|
|
|
CONFIRMED: UiResult
|
|
|
|
CANCELLED: UiResult
|
|
|
|
INFO: UiResult
|
2021-12-13 11:22:52 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-11-03 10:51:04 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def disable_animation(disable: bool) -> None:
|
|
|
|
"""Disable animations, debug builds only."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-10-13 11:37:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2023-11-17 22:02:20 +00:00
|
|
|
def check_homescreen_format(data: bytes) -> bool:
|
|
|
|
"""Check homescreen format and dimensions."""
|
2022-10-13 11:37:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-02-19 12:49:04 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_action(
|
2022-02-07 16:09:39 +00:00
|
|
|
*,
|
2022-02-19 12:49:04 +00:00
|
|
|
title: str,
|
2022-10-25 13:08:19 +00:00
|
|
|
action: str | None,
|
|
|
|
description: str | None,
|
2022-02-19 12:49:04 +00:00
|
|
|
verb: str | None = None,
|
|
|
|
verb_cancel: str | None = None,
|
2022-05-24 10:54:02 +00:00
|
|
|
hold: bool = False,
|
2022-10-20 12:28:29 +00:00
|
|
|
hold_danger: bool = False,
|
2022-02-19 12:49:04 +00:00
|
|
|
reverse: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-02-19 12:49:04 +00:00
|
|
|
"""Confirm action."""
|
2022-02-07 16:09:39 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-04-28 12:43:59 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_emphasized(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: Iterable[str | tuple[bool, str]],
|
|
|
|
verb: str | None = None,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-04-28 12:43:59 +00:00
|
|
|
"""Confirm formatted text that has been pre-split in python. For tuples
|
|
|
|
the first component is a bool indicating whether this part is emphasized."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-01-03 15:13:30 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_homescreen(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
image: bytes,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-01-03 15:13:30 +00:00
|
|
|
"""Confirm homescreen."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_blob(
|
|
|
|
*,
|
|
|
|
title: str,
|
2022-10-19 16:06:13 +00:00
|
|
|
data: str | bytes,
|
|
|
|
description: str | None,
|
|
|
|
extra: str | None,
|
2023-02-14 22:47:20 +00:00
|
|
|
verb: str | None = None,
|
2022-05-24 10:54:02 +00:00
|
|
|
verb_cancel: str | None = None,
|
|
|
|
hold: bool = False,
|
2023-10-23 11:21:25 +00:00
|
|
|
chunkify: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-05-24 10:54:02 +00:00
|
|
|
"""Confirm byte sequence data."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-02-14 22:47:20 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_address(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
data: str | bytes,
|
|
|
|
description: str | None,
|
2023-10-19 15:29:29 +00:00
|
|
|
verb: str | None = "CONFIRM",
|
2023-02-14 22:47:20 +00:00
|
|
|
extra: str | None,
|
2023-09-14 10:25:13 +00:00
|
|
|
chunkify: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-02-14 22:47:20 +00:00
|
|
|
"""Confirm address. Similar to `confirm_blob` but has corner info button
|
|
|
|
and allows left swipe which does the same thing as the button."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-09-14 21:07:56 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_properties(
|
|
|
|
*,
|
|
|
|
title: str,
|
2022-10-19 16:06:13 +00:00
|
|
|
items: list[tuple[str | None, str | bytes | None, bool]],
|
2022-09-14 21:07:56 +00:00
|
|
|
hold: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-09-14 21:07:56 +00:00
|
|
|
"""Confirm list of key-value pairs. The third component in the tuple should be True if
|
2022-10-19 16:06:13 +00:00
|
|
|
the value is to be rendered as binary with monospace font, False otherwise."""
|
2022-09-14 21:07:56 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-07-07 16:07:07 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_reset_device(
|
|
|
|
*,
|
|
|
|
title: str,
|
2023-01-13 19:41:58 +00:00
|
|
|
button: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-07-07 16:07:07 +00:00
|
|
|
"""Confirm TOS before device setup."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-02-14 22:47:20 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_address_details(
|
|
|
|
*,
|
2023-07-26 14:45:10 +00:00
|
|
|
qr_title: str,
|
2023-02-14 22:47:20 +00:00
|
|
|
address: str,
|
|
|
|
case_sensitive: bool,
|
2023-07-26 14:45:10 +00:00
|
|
|
details_title: str,
|
2023-02-14 22:47:20 +00:00
|
|
|
account: str | None,
|
|
|
|
path: str | None,
|
|
|
|
xpubs: list[tuple[str, str]],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-02-14 22:47:20 +00:00
|
|
|
"""Show address details - QR code, account, path, cosigner xpubs."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-03-30 22:14:44 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2023-08-01 14:54:01 +00:00
|
|
|
def show_info_with_cancel(
|
2023-03-30 22:14:44 +00:00
|
|
|
*,
|
2023-08-01 14:54:01 +00:00
|
|
|
title: str,
|
|
|
|
items: Iterable[Tuple[str, str]],
|
2023-10-19 15:29:29 +00:00
|
|
|
horizontal: bool = False,
|
2024-02-11 17:30:20 +00:00
|
|
|
chunkify: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-10-19 15:29:29 +00:00
|
|
|
"""Show metadata for outgoing transaction."""
|
2023-03-30 22:14:44 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2022-09-13 10:13:04 +00:00
|
|
|
def confirm_value(
|
2022-05-24 10:54:02 +00:00
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
value: str,
|
2023-05-04 12:53:18 +00:00
|
|
|
description: str | None,
|
|
|
|
subtitle: str | None,
|
2022-09-13 10:13:04 +00:00
|
|
|
verb: str | None = None,
|
2023-03-30 22:14:44 +00:00
|
|
|
verb_cancel: str | None = None,
|
|
|
|
info_button: bool = False,
|
2022-09-13 10:13:04 +00:00
|
|
|
hold: bool = False,
|
2023-09-14 10:25:13 +00:00
|
|
|
chunkify: bool = False,
|
2024-02-11 17:30:20 +00:00
|
|
|
text_mono: bool = True,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-09-13 10:13:04 +00:00
|
|
|
"""Confirm value. Merge of confirm_total and confirm_output."""
|
2022-05-24 10:54:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2023-03-30 22:14:44 +00:00
|
|
|
def confirm_total(
|
2022-05-24 10:54:02 +00:00
|
|
|
*,
|
2023-03-30 22:14:44 +00:00
|
|
|
title: str,
|
2023-12-01 15:18:58 +00:00
|
|
|
items: Iterable[tuple[str, str]],
|
2023-03-30 22:14:44 +00:00
|
|
|
info_button: bool = False,
|
2023-08-01 14:54:01 +00:00
|
|
|
cancel_arrow: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-03-30 22:14:44 +00:00
|
|
|
"""Transaction summary. Always hold to confirm."""
|
2022-05-24 10:54:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_modify_output(
|
|
|
|
*,
|
|
|
|
sign: int,
|
|
|
|
amount_change: str,
|
|
|
|
amount_new: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-11-07 10:06:08 +00:00
|
|
|
"""Decrease or increase output amount."""
|
2022-05-24 10:54:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_modify_fee(
|
|
|
|
*,
|
2023-05-22 19:07:18 +00:00
|
|
|
title: str,
|
2022-05-24 10:54:02 +00:00
|
|
|
sign: int,
|
|
|
|
user_fee_change: str,
|
|
|
|
total_fee_new: str,
|
2023-05-31 11:16:07 +00:00
|
|
|
fee_rate_amount: str | None, # ignored
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-05-24 10:54:02 +00:00
|
|
|
"""Decrease or increase transaction fee."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-10-12 13:30:53 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_fido(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
app_name: str,
|
|
|
|
icon_name: str | None,
|
|
|
|
accounts: list[str | None],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[int | UiResult]:
|
2022-10-12 13:30:53 +00:00
|
|
|
"""FIDO confirmation.
|
|
|
|
Returns page index in case of confirmation and CANCELLED otherwise.
|
|
|
|
"""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-07-07 15:08:53 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_error(
|
|
|
|
*,
|
|
|
|
title: str,
|
2022-08-30 12:10:30 +00:00
|
|
|
button: str = "CONTINUE",
|
2022-07-07 15:08:53 +00:00
|
|
|
description: str = "",
|
|
|
|
allow_cancel: bool = False,
|
2022-08-30 12:10:30 +00:00
|
|
|
time_ms: int = 0,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-10-30 16:59:59 +00:00
|
|
|
"""Error modal. No buttons shown when `button` is empty string."""
|
2022-07-07 15:08:53 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_warning(
|
|
|
|
*,
|
|
|
|
title: str,
|
2022-08-30 12:10:30 +00:00
|
|
|
button: str = "CONTINUE",
|
2023-08-30 14:31:41 +00:00
|
|
|
value: str = "",
|
2022-05-24 10:54:02 +00:00
|
|
|
description: str = "",
|
2022-07-07 15:08:53 +00:00
|
|
|
allow_cancel: bool = False,
|
2022-08-30 12:10:30 +00:00
|
|
|
time_ms: int = 0,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-10-30 16:59:59 +00:00
|
|
|
"""Warning modal. No buttons shown when `button` is empty string."""
|
2022-05-24 10:54:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_success(
|
|
|
|
*,
|
|
|
|
title: str,
|
2022-08-30 12:10:30 +00:00
|
|
|
button: str = "CONTINUE",
|
2022-05-24 10:54:02 +00:00
|
|
|
description: str = "",
|
2022-07-07 15:08:53 +00:00
|
|
|
allow_cancel: bool = False,
|
2022-08-30 12:10:30 +00:00
|
|
|
time_ms: int = 0,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-10-30 16:59:59 +00:00
|
|
|
"""Success modal. No buttons shown when `button` is empty string."""
|
2022-05-24 10:54:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-07-07 15:08:53 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_info(
|
|
|
|
*,
|
|
|
|
title: str,
|
2022-08-30 12:10:30 +00:00
|
|
|
button: str = "CONTINUE",
|
2022-07-07 15:08:53 +00:00
|
|
|
description: str = "",
|
|
|
|
allow_cancel: bool = False,
|
2022-08-30 12:10:30 +00:00
|
|
|
time_ms: int = 0,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-10-30 16:59:59 +00:00
|
|
|
"""Info modal. No buttons shown when `button` is empty string."""
|
2022-07-07 15:08:53 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-02-14 22:47:20 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2023-06-27 14:01:21 +00:00
|
|
|
def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
|
2023-02-14 22:47:20 +00:00
|
|
|
"""Warning modal, receiving address mismatch."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-07-12 18:31:34 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_simple(
|
|
|
|
*,
|
|
|
|
title: str | None,
|
2023-05-04 12:53:18 +00:00
|
|
|
description: str = "",
|
|
|
|
button: str = "",
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-07-12 18:31:34 +00:00
|
|
|
"""Simple dialog with text and one button."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2022-07-15 12:33:17 +00:00
|
|
|
def confirm_with_info(
|
2022-05-24 10:54:02 +00:00
|
|
|
*,
|
2022-07-15 12:33:17 +00:00
|
|
|
title: str,
|
|
|
|
button: str,
|
|
|
|
info_button: str,
|
2024-04-29 11:02:40 +00:00
|
|
|
items: Iterable[tuple[int, str | bytes]],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-10-17 15:50:12 +00:00
|
|
|
"""Confirm given items but with third button. Always single page
|
|
|
|
without scrolling."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-10-17 15:50:12 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_more(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
button: str,
|
2024-04-29 11:02:40 +00:00
|
|
|
items: Iterable[tuple[int, str | bytes]],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-10-17 15:50:12 +00:00
|
|
|
"""Confirm long content with the possibility to go back from any page.
|
|
|
|
Meant to be used with confirm_with_info."""
|
2022-05-24 10:54:02 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-05-24 10:54:02 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_coinjoin(
|
|
|
|
*,
|
|
|
|
max_rounds: str,
|
|
|
|
max_feerate: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-05-24 10:54:02 +00:00
|
|
|
"""Confirm coinjoin authorization."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-02-19 12:49:04 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def request_pin(
|
2022-03-04 11:56:49 +00:00
|
|
|
*,
|
|
|
|
prompt: str,
|
2022-05-24 10:54:02 +00:00
|
|
|
subprompt: str,
|
2022-02-19 12:49:04 +00:00
|
|
|
allow_cancel: bool = True,
|
2023-01-12 13:48:50 +00:00
|
|
|
wrong_pin: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str | UiResult]:
|
2022-02-19 12:49:04 +00:00
|
|
|
"""Request pin on device."""
|
2022-03-04 11:56:49 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-02-19 12:49:04 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def request_passphrase(
|
2022-03-04 11:56:49 +00:00
|
|
|
*,
|
|
|
|
prompt: str,
|
2022-02-19 12:49:04 +00:00
|
|
|
max_len: int,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str | UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Passphrase input keyboard."""
|
2022-03-04 11:56:49 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-02-19 12:49:04 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def request_bip39(
|
2022-03-04 11:56:49 +00:00
|
|
|
*,
|
|
|
|
prompt: str,
|
2024-01-29 13:38:02 +00:00
|
|
|
prefill_word: str,
|
|
|
|
can_go_back: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""BIP39 word input keyboard."""
|
2022-03-04 11:56:49 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-02-19 12:49:04 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def request_slip39(
|
2021-12-13 11:22:52 +00:00
|
|
|
*,
|
2022-02-19 12:49:04 +00:00
|
|
|
prompt: str,
|
2024-01-29 13:38:02 +00:00
|
|
|
prefill_word: str,
|
|
|
|
can_go_back: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[str]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""SLIP39 word input keyboard."""
|
2022-07-07 16:07:07 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-07-07 16:07:07 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def select_word(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
words: Iterable[str],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[int]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Select mnemonic word from three possibilities - seed check after backup. The
|
2023-07-11 13:05:39 +00:00
|
|
|
iterable must be of exact size. Returns index in range `0..3`."""
|
|
|
|
|
2022-07-07 16:07:07 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_share_words(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
pages: Iterable[str],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
2022-07-12 18:31:34 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-07-12 18:31:34 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def request_number(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
count: int,
|
|
|
|
min_count: int,
|
|
|
|
max_count: int,
|
2023-01-12 13:48:50 +00:00
|
|
|
description: Callable[[int], str] | None = None,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[tuple[UiResult, int]]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Number input with + and - buttons, description, and info button."""
|
2022-07-12 18:31:34 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-07-12 18:31:34 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_checklist(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: Iterable[str],
|
|
|
|
active: int,
|
|
|
|
button: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
2023-07-11 13:05:39 +00:00
|
|
|
mark next to them."""
|
|
|
|
|
2022-08-30 12:10:30 +00:00
|
|
|
|
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_recovery(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
button: str,
|
|
|
|
dry_run: bool,
|
2023-05-04 12:53:18 +00:00
|
|
|
info_button: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Device recovery homescreen."""
|
2022-08-30 12:10:30 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-08-30 12:10:30 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def select_word_count(
|
|
|
|
*,
|
|
|
|
dry_run: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[int | str]: # TT returns int
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
2022-08-30 12:10:30 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-08-30 12:10:30 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2023-07-11 13:05:39 +00:00
|
|
|
def show_group_share_success(
|
|
|
|
*,
|
|
|
|
lines: Iterable[str]
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Shown after successfully finishing a group."""
|
2022-08-30 12:10:30 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-08-30 12:10:30 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_remaining_shares(
|
|
|
|
*,
|
|
|
|
pages: Iterable[tuple[str, str]],
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
2022-10-30 16:59:59 +00:00
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-10-30 16:59:59 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_progress(
|
|
|
|
*,
|
2024-03-15 10:47:31 +00:00
|
|
|
description: str,
|
2022-10-30 16:59:59 +00:00
|
|
|
indeterminate: bool = False,
|
2024-03-15 10:47:31 +00:00
|
|
|
title: str | None = None,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Show progress loader. Please note that the number of lines reserved on screen for
|
2023-07-11 13:05:39 +00:00
|
|
|
description is determined at construction time. If you want multiline descriptions
|
|
|
|
make sure the initial description has at least that amount of lines."""
|
|
|
|
|
2022-09-26 21:07:29 +00:00
|
|
|
|
2023-03-24 15:54:47 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_progress_coinjoin(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
indeterminate: bool = False,
|
|
|
|
time_ms: int = 0,
|
|
|
|
skip_first_paint: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
2023-07-11 13:05:39 +00:00
|
|
|
time_ms timeout is passed."""
|
|
|
|
|
2023-03-24 15:54:47 +00:00
|
|
|
|
2022-09-26 21:07:29 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_homescreen(
|
|
|
|
*,
|
2023-05-12 09:19:35 +00:00
|
|
|
label: str | None,
|
2022-09-26 21:07:29 +00:00
|
|
|
hold: bool,
|
|
|
|
notification: str | None,
|
|
|
|
notification_level: int = 0,
|
|
|
|
skip_first_paint: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-09-26 21:07:29 +00:00
|
|
|
"""Idle homescreen."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2022-09-26 21:07:29 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def show_lockscreen(
|
|
|
|
*,
|
2023-05-12 09:19:35 +00:00
|
|
|
label: str | None,
|
2022-09-26 21:07:29 +00:00
|
|
|
bootscreen: bool,
|
|
|
|
skip_first_paint: bool,
|
2023-10-18 17:19:32 +00:00
|
|
|
coinjoin_authorized: bool = False,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2022-09-26 21:07:29 +00:00
|
|
|
"""Homescreen for locked device."""
|
|
|
|
|
2023-07-11 13:05:39 +00:00
|
|
|
|
2023-10-20 12:58:32 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_firmware_update(
|
|
|
|
*,
|
|
|
|
description: str,
|
|
|
|
fingerprint: str,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-10-20 12:58:32 +00:00
|
|
|
"""Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
2023-08-11 15:57:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_tt/layout.rs
|
2024-02-29 10:56:34 +00:00
|
|
|
def show_wait_text(message: str, /) -> LayoutObj[None]:
|
2023-08-11 15:57:32 +00:00
|
|
|
"""Show single-line text in the middle of the screen."""
|