2021-06-08 11:29:03 +00:00
|
|
|
from typing import *
|
2024-03-12 19:15:20 +00:00
|
|
|
from trezor import utils
|
2024-10-18 13:11:58 +00:00
|
|
|
from trezorui_api import *
|
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 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_blob(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
data: str | bytes,
|
|
|
|
description: str | None,
|
2024-10-18 10:25:56 +00:00
|
|
|
text_mono: bool = True,
|
|
|
|
extra: str | None = None,
|
|
|
|
subtitle: str | None = None,
|
2024-03-04 11:08:57 +00:00
|
|
|
verb: str | None = None,
|
|
|
|
verb_cancel: str | None = None,
|
2024-10-18 10:25:56 +00:00
|
|
|
verb_info: str | None = None,
|
|
|
|
info: bool = True,
|
2024-03-04 11:08:57 +00:00
|
|
|
hold: bool = False,
|
|
|
|
chunkify: bool = False,
|
2024-11-13 16:53:51 +00:00
|
|
|
page_counter: bool = False,
|
2024-06-05 11:29:27 +00:00
|
|
|
prompt_screen: bool = False,
|
2024-11-14 11:35:31 +00:00
|
|
|
cancel: bool = False,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Confirm byte sequence data."""
|
|
|
|
|
|
|
|
|
2024-11-14 16:33:39 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def confirm_blob_intro(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
data: str | bytes,
|
|
|
|
subtitle: str | None = None,
|
|
|
|
verb: str | None = None,
|
|
|
|
verb_cancel: str | None = None,
|
|
|
|
chunkify: bool = False,
|
|
|
|
) -> LayoutObj[UiResult]:
|
|
|
|
"""Confirm byte sequence data by showing only the first page of the data
|
|
|
|
and instructing the user to access the menu in order to view all the data,
|
|
|
|
which can then be confirmed using confirm_blob."""
|
|
|
|
|
|
|
|
|
2024-03-04 11:08:57 +00:00
|
|
|
# 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."""
|
|
|
|
|
|
|
|
|
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_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 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-10-03 20:46:54 +00:00
|
|
|
"""Confirm given items but with third button. In mercury, the button is placed in
|
|
|
|
context menu."""
|
2024-03-04 11:08:57 +00:00
|
|
|
|
|
|
|
|
2024-04-21 20:43:12 +00:00
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
2024-10-31 13:21:48 +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-05-26 23:05:04 +00:00
|
|
|
subtitle: str,
|
2024-04-28 11:46:39 +00:00
|
|
|
words: Iterable[str],
|
2024-06-03 23:24:09 +00:00
|
|
|
description: str,
|
2024-06-03 12:36:45 +00:00
|
|
|
text_info: Iterable[str],
|
2024-04-28 11:46:39 +00:00
|
|
|
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
|
2024-06-27 14:26:03 +00:00
|
|
|
def flow_continue_recovery(
|
2024-03-04 11:08:57 +00:00
|
|
|
*,
|
2024-06-27 14:26:03 +00:00
|
|
|
first_screen: bool,
|
2024-06-04 10:47:09 +00:00
|
|
|
recovery_type: RecoveryType,
|
2024-06-27 14:26:03 +00:00
|
|
|
text: str,
|
|
|
|
subtext: str | None = None,
|
2024-08-26 15:10:04 +00:00
|
|
|
pages: Iterable[tuple[str, str]] | None = None,
|
2024-03-12 19:15:20 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-03-04 11:08:57 +00:00
|
|
|
"""Device recovery homescreen."""
|
|
|
|
|
|
|
|
|
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,
|
2024-06-06 12:48:56 +00:00
|
|
|
title: str,
|
2024-04-30 11:32:48 +00:00
|
|
|
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]],
|
2024-10-02 10:11:40 +00:00
|
|
|
title_success: str,
|
2024-05-20 16:30:57 +00:00
|
|
|
br_code: ButtonRequestType,
|
2024-07-04 14:00:36 +00:00
|
|
|
br_name: str,
|
2024-04-30 11:32:48 +00:00
|
|
|
) -> 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 = "",
|
2024-11-11 15:59:13 +00:00
|
|
|
verb_cancel: str | None = None,
|
2024-04-30 11:32:48 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
|
|
|
"""Warning modal with multiple steps to confirm."""
|
2024-05-12 18:37:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def flow_confirm_output(
|
|
|
|
*,
|
|
|
|
title: str | None,
|
2024-08-30 14:12:38 +00:00
|
|
|
subtitle: str | None,
|
|
|
|
message: str,
|
2024-08-08 13:13:43 +00:00
|
|
|
amount: str | None,
|
2024-05-12 18:37:14 +00:00
|
|
|
chunkify: bool,
|
2024-08-30 14:12:38 +00:00
|
|
|
text_mono: bool,
|
2024-05-12 18:37:14 +00:00
|
|
|
account: str | None,
|
|
|
|
account_path: str | None,
|
2024-05-20 16:30:57 +00:00
|
|
|
br_code: ButtonRequestType,
|
2024-07-04 14:00:36 +00:00
|
|
|
br_name: str,
|
2024-08-30 14:12:38 +00:00
|
|
|
address: str | None,
|
|
|
|
address_title: str | None,
|
2024-08-20 11:57:04 +00:00
|
|
|
summary_items: Iterable[tuple[str, str]] | None = None,
|
|
|
|
fee_items: Iterable[tuple[str, str]] | None = None,
|
|
|
|
summary_title: str | None = None,
|
|
|
|
summary_br_code: ButtonRequestType | None = None,
|
|
|
|
summary_br_name: str | None = None,
|
2024-08-08 13:13:43 +00:00
|
|
|
cancel_text: str | None = None,
|
2024-05-12 18:37:14 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-08-20 11:57:04 +00:00
|
|
|
"""Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""
|
2024-05-12 18:37:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rust/src/ui/model_mercury/layout.rs
|
|
|
|
def flow_confirm_summary(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
items: Iterable[tuple[str, str]],
|
|
|
|
account_items: Iterable[tuple[str, str]],
|
2024-10-04 15:17:14 +00:00
|
|
|
account_items_title: str | None,
|
2024-05-12 18:37:14 +00:00
|
|
|
fee_items: Iterable[tuple[str, str]],
|
2024-05-20 16:30:57 +00:00
|
|
|
br_code: ButtonRequestType,
|
2024-07-04 14:00:36 +00:00
|
|
|
br_name: str,
|
2024-08-08 13:13:43 +00:00
|
|
|
cancel_text: str | None = None,
|
2024-05-12 18:37:14 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
|
|
|
"""Total summary and hold to confirm."""
|
2024-10-18 13:11:58 +00:00
|
|
|
from trezor import utils
|
|
|
|
from trezorui_api import *
|
2024-03-04 11:08:57 +00:00
|
|
|
|
|
|
|
|
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,
|
2024-10-18 10:25:56 +00:00
|
|
|
text_mono: bool = True,
|
|
|
|
extra: str | None = None,
|
|
|
|
subtitle: str | None = None,
|
2023-05-12 09:19:35 +00:00
|
|
|
verb: str = "CONFIRM",
|
|
|
|
verb_cancel: str | None = None,
|
2024-10-18 10:25:56 +00:00
|
|
|
verb_info: str | None = None,
|
|
|
|
info: bool = True,
|
2023-05-12 09:19:35 +00:00
|
|
|
hold: bool = False,
|
2023-10-23 11:21:25 +00:00
|
|
|
chunkify: bool = False,
|
2024-11-13 16:53:51 +00:00
|
|
|
page_counter: bool = False,
|
2024-06-05 11:29:27 +00:00
|
|
|
prompt_screen: bool = False,
|
2024-11-14 11:35:31 +00:00
|
|
|
cancel: 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-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
|
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,
|
2024-10-24 23:53:30 +00:00
|
|
|
items_title: 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
|
|
|
|
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
|
|
|
|
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 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 confirm_recovery(
|
|
|
|
*,
|
|
|
|
title: str, # unused on TR
|
|
|
|
description: str,
|
|
|
|
button: str,
|
2024-05-23 14:09:16 +00:00
|
|
|
recovery_type: RecoveryType,
|
2023-05-12 09:19:35 +00:00
|
|
|
info_button: bool, # unused on TR
|
2023-11-20 10:58:33 +00:00
|
|
|
show_instructions: bool,
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2024-11-03 16:22:42 +00:00
|
|
|
"""Device recovery homescreen."""
|
2024-07-01 11:22:12 +00:00
|
|
|
from trezor import utils
|
2024-10-18 13:11:58 +00:00
|
|
|
from trezorui_api import *
|
2021-12-13 11:22:52 +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
|
|
|
|
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,
|
2024-10-18 10:25:56 +00:00
|
|
|
text_mono: bool = True,
|
|
|
|
extra: str | None = None,
|
|
|
|
subtitle: str | None = 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,
|
2024-10-18 10:25:56 +00:00
|
|
|
verb_info: str | None = None,
|
|
|
|
info: bool = True,
|
2022-05-24 10:54:02 +00:00
|
|
|
hold: bool = False,
|
2023-10-23 11:21:25 +00:00
|
|
|
chunkify: bool = False,
|
2024-11-13 16:53:51 +00:00
|
|
|
page_counter: bool = False,
|
2024-06-05 11:29:27 +00:00
|
|
|
prompt_screen: bool = False,
|
2024-11-14 11:35:31 +00:00
|
|
|
cancel: 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
|
|
|
|
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-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-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-10-18 10:25:56 +00:00
|
|
|
button_style_confirm: bool = False,
|
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-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-08-30 12:10:30 +00:00
|
|
|
# rust/src/ui/model_tt/layout.rs
|
|
|
|
def confirm_recovery(
|
|
|
|
*,
|
|
|
|
title: str,
|
|
|
|
description: str,
|
|
|
|
button: str,
|
2024-05-23 14:09:16 +00:00
|
|
|
recovery_type: RecoveryType,
|
2023-05-04 12:53:18 +00:00
|
|
|
info_button: bool = False,
|
2023-11-20 10:58:33 +00:00
|
|
|
show_instructions: bool = False, # unused on TT
|
2023-06-27 14:01:21 +00:00
|
|
|
) -> LayoutObj[UiResult]:
|
2023-05-04 12:53:18 +00:00
|
|
|
"""Device recovery homescreen."""
|