mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-13 18:18:08 +00:00
docs(core): add method signatures for LayoutObj to mocks (fixes #2672)
feat(core): annotate CONFIRMED/CANCELLED/INFO as fake class UiResult
This commit is contained in:
parent
912c88e252
commit
29acad9adf
@ -8,7 +8,7 @@ static void _librust_qstrs(void) {
|
|||||||
MP_QSTR_CANCELLED;
|
MP_QSTR_CANCELLED;
|
||||||
MP_QSTR_CONFIRMED;
|
MP_QSTR_CONFIRMED;
|
||||||
MP_QSTR_INFO;
|
MP_QSTR_INFO;
|
||||||
MP_QSTR_Layout;
|
MP_QSTR_LayoutObj;
|
||||||
MP_QSTR_MESSAGE_NAME;
|
MP_QSTR_MESSAGE_NAME;
|
||||||
MP_QSTR_MESSAGE_WIRE_TYPE;
|
MP_QSTR_MESSAGE_WIRE_TYPE;
|
||||||
MP_QSTR_Msg;
|
MP_QSTR_Msg;
|
||||||
|
@ -249,7 +249,7 @@ impl LayoutObj {
|
|||||||
|
|
||||||
fn obj_type() -> &'static Type {
|
fn obj_type() -> &'static Type {
|
||||||
static TYPE: Type = obj_type! {
|
static TYPE: Type = obj_type! {
|
||||||
name: Qstr::MP_QSTR_Layout,
|
name: Qstr::MP_QSTR_LayoutObj,
|
||||||
locals: &obj_dict!(obj_map! {
|
locals: &obj_dict!(obj_map! {
|
||||||
Qstr::MP_QSTR_attach_timer_fn => obj_fn_2!(ui_layout_attach_timer_fn).as_obj(),
|
Qstr::MP_QSTR_attach_timer_fn => obj_fn_2!(ui_layout_attach_timer_fn).as_obj(),
|
||||||
Qstr::MP_QSTR_touch_event => obj_fn_var!(4, 4, ui_layout_touch_event).as_obj(),
|
Qstr::MP_QSTR_touch_event => obj_fn_var!(4, 4, ui_layout_touch_event).as_obj(),
|
||||||
|
@ -164,7 +164,7 @@ where
|
|||||||
T: StringType + Clone,
|
T: StringType + Clone,
|
||||||
{
|
{
|
||||||
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
msg.try_into()
|
(CONFIRMED.as_obj(), msg.try_into()?).try_into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1653,13 +1653,13 @@ extern "C" fn new_confirm_firmware_update(
|
|||||||
pub static mp_module_trezorui2: Module = obj_module! {
|
pub static mp_module_trezorui2: Module = obj_module! {
|
||||||
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(),
|
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(),
|
||||||
|
|
||||||
/// CONFIRMED: object
|
/// CONFIRMED: UiResult
|
||||||
Qstr::MP_QSTR_CONFIRMED => CONFIRMED.as_obj(),
|
Qstr::MP_QSTR_CONFIRMED => CONFIRMED.as_obj(),
|
||||||
|
|
||||||
/// CANCELLED: object
|
/// CANCELLED: UiResult
|
||||||
Qstr::MP_QSTR_CANCELLED => CANCELLED.as_obj(),
|
Qstr::MP_QSTR_CANCELLED => CANCELLED.as_obj(),
|
||||||
|
|
||||||
/// INFO: object
|
/// INFO: UiResult
|
||||||
Qstr::MP_QSTR_INFO => INFO.as_obj(),
|
Qstr::MP_QSTR_INFO => INFO.as_obj(),
|
||||||
|
|
||||||
/// def disable_animation(disable: bool) -> None:
|
/// def disable_animation(disable: bool) -> None:
|
||||||
@ -1680,7 +1680,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// hold_danger: bool = False, # unused on TR
|
/// hold_danger: bool = False, # unused on TR
|
||||||
/// reverse: bool = False,
|
/// reverse: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm action."""
|
/// """Confirm action."""
|
||||||
Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(),
|
Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(),
|
||||||
|
|
||||||
@ -1702,7 +1702,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// verb_cancel: str | None = None,
|
/// verb_cancel: str | None = None,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// chunkify: bool = False,
|
/// chunkify: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm byte sequence data."""
|
/// """Confirm byte sequence data."""
|
||||||
Qstr::MP_QSTR_confirm_blob => obj_fn_kw!(0, new_confirm_blob).as_obj(),
|
Qstr::MP_QSTR_confirm_blob => obj_fn_kw!(0, new_confirm_blob).as_obj(),
|
||||||
|
|
||||||
@ -1714,7 +1714,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// extra: str | None, # unused on TR
|
/// extra: str | None, # unused on TR
|
||||||
/// verb: str = "CONFIRM",
|
/// verb: str = "CONFIRM",
|
||||||
/// chunkify: bool = False,
|
/// chunkify: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm address."""
|
/// """Confirm address."""
|
||||||
Qstr::MP_QSTR_confirm_address => obj_fn_kw!(0, new_confirm_address).as_obj(),
|
Qstr::MP_QSTR_confirm_address => obj_fn_kw!(0, new_confirm_address).as_obj(),
|
||||||
|
|
||||||
@ -1724,7 +1724,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// items: list[tuple[str | None, str | bytes | None, bool]],
|
/// items: list[tuple[str | None, str | bytes | None, bool]],
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm list of key-value pairs. The third component in the tuple should be True if
|
/// """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.
|
/// 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."""
|
/// This only concerns the text style, you need to decode the value to UTF-8 in python."""
|
||||||
@ -1734,11 +1734,11 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm TOS before device setup."""
|
/// """Confirm TOS before device setup."""
|
||||||
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
||||||
|
|
||||||
/// def confirm_backup() -> object:
|
/// def confirm_backup() -> LayoutObj[UiResult]:
|
||||||
/// """Strongly recommend user to do backup."""
|
/// """Strongly recommend user to do backup."""
|
||||||
Qstr::MP_QSTR_confirm_backup => obj_fn_kw!(0, new_confirm_backup).as_obj(),
|
Qstr::MP_QSTR_confirm_backup => obj_fn_kw!(0, new_confirm_backup).as_obj(),
|
||||||
|
|
||||||
@ -1749,7 +1749,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// account: str | None,
|
/// account: str | None,
|
||||||
/// path: str | None,
|
/// path: str | None,
|
||||||
/// xpubs: list[tuple[str, str]],
|
/// xpubs: list[tuple[str, str]],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show address details - QR code, account, path, cosigner xpubs."""
|
/// """Show address details - QR code, account, path, cosigner xpubs."""
|
||||||
Qstr::MP_QSTR_show_address_details => obj_fn_kw!(0, new_show_address_details).as_obj(),
|
Qstr::MP_QSTR_show_address_details => obj_fn_kw!(0, new_show_address_details).as_obj(),
|
||||||
|
|
||||||
@ -1760,7 +1760,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// value: str,
|
/// value: str,
|
||||||
/// verb: str | None = None,
|
/// verb: str | None = None,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm value."""
|
/// """Confirm value."""
|
||||||
Qstr::MP_QSTR_confirm_value => obj_fn_kw!(0, new_confirm_value).as_obj(),
|
Qstr::MP_QSTR_confirm_value => obj_fn_kw!(0, new_confirm_value).as_obj(),
|
||||||
|
|
||||||
@ -1768,7 +1768,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// spending_amount: str,
|
/// spending_amount: str,
|
||||||
/// total_amount: str,
|
/// total_amount: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm total if there are external inputs."""
|
/// """Confirm total if there are external inputs."""
|
||||||
Qstr::MP_QSTR_confirm_joint_total => obj_fn_kw!(0, new_confirm_joint_total).as_obj(),
|
Qstr::MP_QSTR_confirm_joint_total => obj_fn_kw!(0, new_confirm_joint_total).as_obj(),
|
||||||
|
|
||||||
@ -1778,7 +1778,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// sign: int,
|
/// sign: int,
|
||||||
/// amount_change: str,
|
/// amount_change: str,
|
||||||
/// amount_new: str,
|
/// amount_new: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Decrease or increase amount for given address."""
|
/// """Decrease or increase amount for given address."""
|
||||||
Qstr::MP_QSTR_confirm_modify_output => obj_fn_kw!(0, new_confirm_modify_output).as_obj(),
|
Qstr::MP_QSTR_confirm_modify_output => obj_fn_kw!(0, new_confirm_modify_output).as_obj(),
|
||||||
|
|
||||||
@ -1788,7 +1788,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// address_label: str,
|
/// address_label: str,
|
||||||
/// address_title: str,
|
/// address_title: str,
|
||||||
/// chunkify: bool = False,
|
/// chunkify: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm output address."""
|
/// """Confirm output address."""
|
||||||
Qstr::MP_QSTR_confirm_output_address => obj_fn_kw!(0, new_confirm_output_address).as_obj(),
|
Qstr::MP_QSTR_confirm_output_address => obj_fn_kw!(0, new_confirm_output_address).as_obj(),
|
||||||
|
|
||||||
@ -1796,7 +1796,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// amount: str,
|
/// amount: str,
|
||||||
/// amount_title: str,
|
/// amount_title: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm output amount."""
|
/// """Confirm output amount."""
|
||||||
Qstr::MP_QSTR_confirm_output_amount => obj_fn_kw!(0, new_confirm_output_amount).as_obj(),
|
Qstr::MP_QSTR_confirm_output_amount => obj_fn_kw!(0, new_confirm_output_amount).as_obj(),
|
||||||
|
|
||||||
@ -1808,7 +1808,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// account_label: str | None,
|
/// account_label: str | None,
|
||||||
/// total_label: str,
|
/// total_label: str,
|
||||||
/// fee_label: str,
|
/// fee_label: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm summary of a transaction."""
|
/// """Confirm summary of a transaction."""
|
||||||
Qstr::MP_QSTR_confirm_total => obj_fn_kw!(0, new_confirm_total).as_obj(),
|
Qstr::MP_QSTR_confirm_total => obj_fn_kw!(0, new_confirm_total).as_obj(),
|
||||||
|
|
||||||
@ -1819,11 +1819,11 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// maximum_fee: str,
|
/// maximum_fee: str,
|
||||||
/// items: Iterable[Tuple[str, str]],
|
/// items: Iterable[Tuple[str, str]],
|
||||||
/// chunkify: bool = False,
|
/// chunkify: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm details about Ethereum transaction."""
|
/// """Confirm details about Ethereum transaction."""
|
||||||
Qstr::MP_QSTR_confirm_ethereum_tx => obj_fn_kw!(0, new_confirm_ethereum_tx).as_obj(),
|
Qstr::MP_QSTR_confirm_ethereum_tx => obj_fn_kw!(0, new_confirm_ethereum_tx).as_obj(),
|
||||||
|
|
||||||
/// def tutorial() -> object:
|
/// def tutorial() -> LayoutObj[UiResult]:
|
||||||
/// """Show user how to interact with the device."""
|
/// """Show user how to interact with the device."""
|
||||||
Qstr::MP_QSTR_tutorial => obj_fn_kw!(0, tutorial).as_obj(),
|
Qstr::MP_QSTR_tutorial => obj_fn_kw!(0, tutorial).as_obj(),
|
||||||
|
|
||||||
@ -1834,7 +1834,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// user_fee_change: str,
|
/// user_fee_change: str,
|
||||||
/// total_fee_new: str,
|
/// total_fee_new: str,
|
||||||
/// fee_rate_amount: str | None,
|
/// fee_rate_amount: str | None,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Decrease or increase transaction fee."""
|
/// """Decrease or increase transaction fee."""
|
||||||
Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(),
|
Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(),
|
||||||
|
|
||||||
@ -1844,7 +1844,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// app_name: str,
|
/// app_name: str,
|
||||||
/// icon_name: str | None, # unused on TR
|
/// icon_name: str | None, # unused on TR
|
||||||
/// accounts: list[str | None],
|
/// accounts: list[str | None],
|
||||||
/// ) -> int | object:
|
/// ) -> LayoutObj[int | UiResult]:
|
||||||
/// """FIDO confirmation.
|
/// """FIDO confirmation.
|
||||||
///
|
///
|
||||||
/// Returns page index in case of confirmation and CANCELLED otherwise.
|
/// Returns page index in case of confirmation and CANCELLED otherwise.
|
||||||
@ -1856,7 +1856,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// verb: str,
|
/// verb: str,
|
||||||
/// items: list[str],
|
/// items: list[str],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show multiple texts, each on its own page."""
|
/// """Show multiple texts, each on its own page."""
|
||||||
Qstr::MP_QSTR_multiple_pages_texts => obj_fn_kw!(0, new_multiple_pages_texts).as_obj(),
|
Qstr::MP_QSTR_multiple_pages_texts => obj_fn_kw!(0, new_multiple_pages_texts).as_obj(),
|
||||||
|
|
||||||
@ -1865,7 +1865,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// button: str,
|
/// button: str,
|
||||||
/// warning: str,
|
/// warning: str,
|
||||||
/// description: str,
|
/// description: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Warning modal with middle button and centered text."""
|
/// """Warning modal with middle button and centered text."""
|
||||||
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
|
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
|
||||||
|
|
||||||
@ -1874,15 +1874,15 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Info modal."""
|
/// """Info modal."""
|
||||||
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
||||||
|
|
||||||
/// def show_passphrase() -> object:
|
/// def show_passphrase() -> LayoutObj[UiResult]:
|
||||||
/// """Show passphrase on host dialog."""
|
/// """Show passphrase on host dialog."""
|
||||||
Qstr::MP_QSTR_show_passphrase => obj_fn_0!(new_show_passphrase).as_obj(),
|
Qstr::MP_QSTR_show_passphrase => obj_fn_0!(new_show_passphrase).as_obj(),
|
||||||
|
|
||||||
/// def show_mismatch(*, title: str) -> object:
|
/// def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
|
||||||
/// """Warning modal, receiving address mismatch."""
|
/// """Warning modal, receiving address mismatch."""
|
||||||
Qstr::MP_QSTR_show_mismatch => obj_fn_kw!(0, new_show_mismatch).as_obj(),
|
Qstr::MP_QSTR_show_mismatch => obj_fn_kw!(0, new_show_mismatch).as_obj(),
|
||||||
|
|
||||||
@ -1893,7 +1893,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// info_button: str, # unused on TR
|
/// info_button: str, # unused on TR
|
||||||
/// items: Iterable[Tuple[int, str]],
|
/// items: Iterable[Tuple[int, str]],
|
||||||
/// verb_cancel: str | None = None,
|
/// verb_cancel: str | None = None,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm given items but with third button. Always single page
|
/// """Confirm given items but with third button. Always single page
|
||||||
/// without scrolling."""
|
/// without scrolling."""
|
||||||
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),
|
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),
|
||||||
@ -1912,7 +1912,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// max_rounds: str,
|
/// max_rounds: str,
|
||||||
/// max_feerate: str,
|
/// max_feerate: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm coinjoin authorization."""
|
/// """Confirm coinjoin authorization."""
|
||||||
Qstr::MP_QSTR_confirm_coinjoin => obj_fn_kw!(0, new_confirm_coinjoin).as_obj(),
|
Qstr::MP_QSTR_confirm_coinjoin => obj_fn_kw!(0, new_confirm_coinjoin).as_obj(),
|
||||||
|
|
||||||
@ -1922,7 +1922,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// subprompt: str,
|
/// subprompt: str,
|
||||||
/// allow_cancel: bool = True, # unused on TR
|
/// allow_cancel: bool = True, # unused on TR
|
||||||
/// wrong_pin: bool = False, # unused on TR
|
/// wrong_pin: bool = False, # unused on TR
|
||||||
/// ) -> str | object:
|
/// ) -> LayoutObj[str | UiResult]:
|
||||||
/// """Request pin on device."""
|
/// """Request pin on device."""
|
||||||
Qstr::MP_QSTR_request_pin => obj_fn_kw!(0, new_request_pin).as_obj(),
|
Qstr::MP_QSTR_request_pin => obj_fn_kw!(0, new_request_pin).as_obj(),
|
||||||
|
|
||||||
@ -1930,21 +1930,21 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// max_len: int, # unused on TR
|
/// max_len: int, # unused on TR
|
||||||
/// ) -> str | object:
|
/// ) -> LayoutObj[str | UiResult]:
|
||||||
/// """Get passphrase."""
|
/// """Get passphrase."""
|
||||||
Qstr::MP_QSTR_request_passphrase => obj_fn_kw!(0, new_request_passphrase).as_obj(),
|
Qstr::MP_QSTR_request_passphrase => obj_fn_kw!(0, new_request_passphrase).as_obj(),
|
||||||
|
|
||||||
/// def request_bip39(
|
/// def request_bip39(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// ) -> str:
|
/// ) -> LayoutObj[str]:
|
||||||
/// """Get recovery word for BIP39."""
|
/// """Get recovery word for BIP39."""
|
||||||
Qstr::MP_QSTR_request_bip39 => obj_fn_kw!(0, new_request_bip39).as_obj(),
|
Qstr::MP_QSTR_request_bip39 => obj_fn_kw!(0, new_request_bip39).as_obj(),
|
||||||
|
|
||||||
/// def request_slip39(
|
/// def request_slip39(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// ) -> str:
|
/// ) -> LayoutObj[str]:
|
||||||
/// """SLIP39 word input keyboard."""
|
/// """SLIP39 word input keyboard."""
|
||||||
Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(),
|
Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(),
|
||||||
|
|
||||||
@ -1953,7 +1953,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str, # unused on TR
|
/// title: str, # unused on TR
|
||||||
/// description: str,
|
/// description: str,
|
||||||
/// words: Iterable[str],
|
/// words: Iterable[str],
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[int]:
|
||||||
/// """Select mnemonic word from three possibilities - seed check after backup. The
|
/// """Select mnemonic word from three possibilities - seed check after backup. The
|
||||||
/// iterable must be of exact size. Returns index in range `0..3`."""
|
/// iterable must be of exact size. Returns index in range `0..3`."""
|
||||||
Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(),
|
Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(),
|
||||||
@ -1961,7 +1961,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// def show_share_words(
|
/// def show_share_words(
|
||||||
/// *,
|
/// *,
|
||||||
/// share_words: Iterable[str],
|
/// share_words: Iterable[str],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Shows a backup seed."""
|
/// """Shows a backup seed."""
|
||||||
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),
|
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),
|
||||||
|
|
||||||
@ -1972,7 +1972,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// min_count: int,
|
/// min_count: int,
|
||||||
/// max_count: int,
|
/// max_count: int,
|
||||||
/// description: Callable[[int], str] | None = None, # unused on TR
|
/// description: Callable[[int], str] | None = None, # unused on TR
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[tuple[UiResult, int]]:
|
||||||
/// """Number input with + and - buttons, description, and info button."""
|
/// """Number input with + and - buttons, description, and info button."""
|
||||||
Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(),
|
Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(),
|
||||||
|
|
||||||
@ -1982,7 +1982,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// items: Iterable[str],
|
/// items: Iterable[str],
|
||||||
/// active: int,
|
/// active: int,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Checklist of backup steps. Active index is highlighted, previous items have check
|
/// """Checklist of backup steps. Active index is highlighted, previous items have check
|
||||||
/// mark next to them."""
|
/// mark next to them."""
|
||||||
Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(),
|
Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(),
|
||||||
@ -1995,7 +1995,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// dry_run: bool,
|
/// dry_run: bool,
|
||||||
/// info_button: bool, # unused on TR
|
/// info_button: bool, # unused on TR
|
||||||
/// show_info: bool,
|
/// show_info: bool,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Device recovery homescreen."""
|
/// """Device recovery homescreen."""
|
||||||
Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(),
|
Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(),
|
||||||
|
|
||||||
@ -2003,13 +2003,14 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// dry_run: bool, # unused on TR
|
/// dry_run: bool, # unused on TR
|
||||||
/// ) -> int | str: # TR returns str
|
/// ) -> int | str: # TR returns str
|
||||||
|
/// ) -> LayoutObj[int | str]:
|
||||||
/// """Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
/// """Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
||||||
Qstr::MP_QSTR_select_word_count => obj_fn_kw!(0, new_select_word_count).as_obj(),
|
Qstr::MP_QSTR_select_word_count => obj_fn_kw!(0, new_select_word_count).as_obj(),
|
||||||
|
|
||||||
/// def show_group_share_success(
|
/// def show_group_share_success(
|
||||||
/// *,
|
/// *,
|
||||||
/// lines: Iterable[str],
|
/// lines: Iterable[str],
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[int]:
|
||||||
/// """Shown after successfully finishing a group."""
|
/// """Shown after successfully finishing a group."""
|
||||||
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
|
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
|
||||||
|
|
||||||
@ -2018,7 +2019,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// indeterminate: bool = False,
|
/// indeterminate: bool = False,
|
||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show progress loader. Please note that the number of lines reserved on screen for
|
/// """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
|
/// description is determined at construction time. If you want multiline descriptions
|
||||||
/// make sure the initial description has at least that amount of lines."""
|
/// make sure the initial description has at least that amount of lines."""
|
||||||
@ -2030,7 +2031,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// indeterminate: bool = False,
|
/// indeterminate: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// skip_first_paint: bool = False,
|
/// skip_first_paint: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
||||||
/// time_ms timeout is passed."""
|
/// time_ms timeout is passed."""
|
||||||
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
|
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
|
||||||
@ -2042,7 +2043,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// notification: str | None,
|
/// notification: str | None,
|
||||||
/// notification_level: int = 0,
|
/// notification_level: int = 0,
|
||||||
/// skip_first_paint: bool,
|
/// skip_first_paint: bool,
|
||||||
/// ) -> CANCELLED:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Idle homescreen."""
|
/// """Idle homescreen."""
|
||||||
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
|
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
|
||||||
|
|
||||||
@ -2052,7 +2053,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// bootscreen: bool,
|
/// bootscreen: bool,
|
||||||
/// skip_first_paint: bool,
|
/// skip_first_paint: bool,
|
||||||
/// coinjoin_authorized: bool = False,
|
/// coinjoin_authorized: bool = False,
|
||||||
/// ) -> CANCELLED:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Homescreen for locked device."""
|
/// """Homescreen for locked device."""
|
||||||
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
|
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ where
|
|||||||
let value = self.value().try_into()?;
|
let value = self.value().try_into()?;
|
||||||
match msg {
|
match msg {
|
||||||
NumberInputDialogMsg::Selected => Ok((CONFIRMED.as_obj(), value).try_into()?),
|
NumberInputDialogMsg::Selected => Ok((CONFIRMED.as_obj(), value).try_into()?),
|
||||||
NumberInputDialogMsg::InfoRequested => Ok((CANCELLED.as_obj(), value).try_into()?),
|
NumberInputDialogMsg::InfoRequested => Ok((INFO.as_obj(), value).try_into()?),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1625,15 +1625,86 @@ extern "C" fn new_confirm_firmware_update(
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static mp_module_trezorui2: Module = obj_module! {
|
pub static mp_module_trezorui2: Module = obj_module! {
|
||||||
|
/// from trezor import utils
|
||||||
|
///
|
||||||
|
/// T = TypeVar("T")
|
||||||
|
///
|
||||||
|
/// 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."""
|
||||||
|
///
|
||||||
|
/// class UiResult:
|
||||||
|
/// """Result of a UI operation."""
|
||||||
|
/// pass
|
||||||
|
///
|
||||||
|
/// mock:global
|
||||||
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(),
|
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(),
|
||||||
|
|
||||||
/// CONFIRMED: object
|
/// CONFIRMED: UiResult
|
||||||
Qstr::MP_QSTR_CONFIRMED => CONFIRMED.as_obj(),
|
Qstr::MP_QSTR_CONFIRMED => CONFIRMED.as_obj(),
|
||||||
|
|
||||||
/// CANCELLED: object
|
/// CANCELLED: UiResult
|
||||||
Qstr::MP_QSTR_CANCELLED => CANCELLED.as_obj(),
|
Qstr::MP_QSTR_CANCELLED => CANCELLED.as_obj(),
|
||||||
|
|
||||||
/// INFO: object
|
/// INFO: UiResult
|
||||||
Qstr::MP_QSTR_INFO => INFO.as_obj(),
|
Qstr::MP_QSTR_INFO => INFO.as_obj(),
|
||||||
|
|
||||||
/// def disable_animation(disable: bool) -> None:
|
/// def disable_animation(disable: bool) -> None:
|
||||||
@ -1658,7 +1729,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// hold_danger: bool = False,
|
/// hold_danger: bool = False,
|
||||||
/// reverse: bool = False,
|
/// reverse: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm action."""
|
/// """Confirm action."""
|
||||||
Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(),
|
Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(),
|
||||||
|
|
||||||
@ -1667,7 +1738,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// items: Iterable[str | tuple[bool, str]],
|
/// items: Iterable[str | tuple[bool, str]],
|
||||||
/// verb: str | None = None,
|
/// verb: str | None = None,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm formatted text that has been pre-split in python. For tuples
|
/// """Confirm formatted text that has been pre-split in python. For tuples
|
||||||
/// the first component is a bool indicating whether this part is emphasized."""
|
/// the first component is a bool indicating whether this part is emphasized."""
|
||||||
Qstr::MP_QSTR_confirm_emphasized => obj_fn_kw!(0, new_confirm_emphasized).as_obj(),
|
Qstr::MP_QSTR_confirm_emphasized => obj_fn_kw!(0, new_confirm_emphasized).as_obj(),
|
||||||
@ -1676,7 +1747,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
/// image: bytes,
|
/// image: bytes,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm homescreen."""
|
/// """Confirm homescreen."""
|
||||||
Qstr::MP_QSTR_confirm_homescreen => obj_fn_kw!(0, new_confirm_homescreen).as_obj(),
|
Qstr::MP_QSTR_confirm_homescreen => obj_fn_kw!(0, new_confirm_homescreen).as_obj(),
|
||||||
|
|
||||||
@ -1690,7 +1761,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// verb_cancel: str | None = None,
|
/// verb_cancel: str | None = None,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// chunkify: bool = False,
|
/// chunkify: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm byte sequence data."""
|
/// """Confirm byte sequence data."""
|
||||||
Qstr::MP_QSTR_confirm_blob => obj_fn_kw!(0, new_confirm_blob).as_obj(),
|
Qstr::MP_QSTR_confirm_blob => obj_fn_kw!(0, new_confirm_blob).as_obj(),
|
||||||
|
|
||||||
@ -1702,7 +1773,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// verb: str | None = "CONFIRM",
|
/// verb: str | None = "CONFIRM",
|
||||||
/// extra: str | None,
|
/// extra: str | None,
|
||||||
/// chunkify: bool = False,
|
/// chunkify: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm address. Similar to `confirm_blob` but has corner info button
|
/// """Confirm address. Similar to `confirm_blob` but has corner info button
|
||||||
/// and allows left swipe which does the same thing as the button."""
|
/// and allows left swipe which does the same thing as the button."""
|
||||||
Qstr::MP_QSTR_confirm_address => obj_fn_kw!(0, new_confirm_address).as_obj(),
|
Qstr::MP_QSTR_confirm_address => obj_fn_kw!(0, new_confirm_address).as_obj(),
|
||||||
@ -1712,7 +1783,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// items: list[tuple[str | None, str | bytes | None, bool]],
|
/// items: list[tuple[str | None, str | bytes | None, bool]],
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm list of key-value pairs. The third component in the tuple should be True if
|
/// """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."""
|
/// the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
||||||
@ -1721,7 +1792,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm TOS before device setup."""
|
/// """Confirm TOS before device setup."""
|
||||||
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
||||||
|
|
||||||
@ -1734,7 +1805,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// account: str | None,
|
/// account: str | None,
|
||||||
/// path: str | None,
|
/// path: str | None,
|
||||||
/// xpubs: list[tuple[str, str]],
|
/// xpubs: list[tuple[str, str]],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show address details - QR code, account, path, cosigner xpubs."""
|
/// """Show address details - QR code, account, path, cosigner xpubs."""
|
||||||
Qstr::MP_QSTR_show_address_details => obj_fn_kw!(0, new_show_address_details).as_obj(),
|
Qstr::MP_QSTR_show_address_details => obj_fn_kw!(0, new_show_address_details).as_obj(),
|
||||||
|
|
||||||
@ -1743,7 +1814,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// items: Iterable[Tuple[str, str]],
|
/// items: Iterable[Tuple[str, str]],
|
||||||
/// horizontal: bool = False,
|
/// horizontal: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show metadata for outgoing transaction."""
|
/// """Show metadata for outgoing transaction."""
|
||||||
Qstr::MP_QSTR_show_info_with_cancel => obj_fn_kw!(0, new_show_info_with_cancel).as_obj(),
|
Qstr::MP_QSTR_show_info_with_cancel => obj_fn_kw!(0, new_show_info_with_cancel).as_obj(),
|
||||||
|
|
||||||
@ -1758,7 +1829,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// chunkify: bool = False,
|
/// chunkify: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm value. Merge of confirm_total and confirm_output."""
|
/// """Confirm value. Merge of confirm_total and confirm_output."""
|
||||||
Qstr::MP_QSTR_confirm_value => obj_fn_kw!(0, new_confirm_value).as_obj(),
|
Qstr::MP_QSTR_confirm_value => obj_fn_kw!(0, new_confirm_value).as_obj(),
|
||||||
|
|
||||||
@ -1768,7 +1839,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// items: list[tuple[str, str]],
|
/// items: list[tuple[str, str]],
|
||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// cancel_arrow: bool = False,
|
/// cancel_arrow: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Transaction summary. Always hold to confirm."""
|
/// """Transaction summary. Always hold to confirm."""
|
||||||
Qstr::MP_QSTR_confirm_total => obj_fn_kw!(0, new_confirm_total).as_obj(),
|
Qstr::MP_QSTR_confirm_total => obj_fn_kw!(0, new_confirm_total).as_obj(),
|
||||||
|
|
||||||
@ -1778,7 +1849,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// sign: int,
|
/// sign: int,
|
||||||
/// amount_change: str,
|
/// amount_change: str,
|
||||||
/// amount_new: str,
|
/// amount_new: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Decrease or increase amount for given address."""
|
/// """Decrease or increase amount for given address."""
|
||||||
Qstr::MP_QSTR_confirm_modify_output => obj_fn_kw!(0, new_confirm_modify_output).as_obj(),
|
Qstr::MP_QSTR_confirm_modify_output => obj_fn_kw!(0, new_confirm_modify_output).as_obj(),
|
||||||
|
|
||||||
@ -1789,7 +1860,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// user_fee_change: str,
|
/// user_fee_change: str,
|
||||||
/// total_fee_new: str,
|
/// total_fee_new: str,
|
||||||
/// fee_rate_amount: str | None, # ignored
|
/// fee_rate_amount: str | None, # ignored
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Decrease or increase transaction fee."""
|
/// """Decrease or increase transaction fee."""
|
||||||
Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(),
|
Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(),
|
||||||
|
|
||||||
@ -1799,7 +1870,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// app_name: str,
|
/// app_name: str,
|
||||||
/// icon_name: str | None,
|
/// icon_name: str | None,
|
||||||
/// accounts: list[str | None],
|
/// accounts: list[str | None],
|
||||||
/// ) -> int | object:
|
/// ) -> LayoutObj[int | UiResult]:
|
||||||
/// """FIDO confirmation.
|
/// """FIDO confirmation.
|
||||||
///
|
///
|
||||||
/// Returns page index in case of confirmation and CANCELLED otherwise.
|
/// Returns page index in case of confirmation and CANCELLED otherwise.
|
||||||
@ -1813,7 +1884,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Error modal. No buttons shown when `button` is empty string."""
|
/// """Error modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_error => obj_fn_kw!(0, new_show_error).as_obj(),
|
Qstr::MP_QSTR_show_error => obj_fn_kw!(0, new_show_error).as_obj(),
|
||||||
|
|
||||||
@ -1825,7 +1896,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Warning modal. No buttons shown when `button` is empty string."""
|
/// """Warning modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
|
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
|
||||||
|
|
||||||
@ -1836,7 +1907,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Success modal. No buttons shown when `button` is empty string."""
|
/// """Success modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_success => obj_fn_kw!(0, new_show_success).as_obj(),
|
Qstr::MP_QSTR_show_success => obj_fn_kw!(0, new_show_success).as_obj(),
|
||||||
|
|
||||||
@ -1847,11 +1918,11 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Info modal. No buttons shown when `button` is empty string."""
|
/// """Info modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
||||||
|
|
||||||
/// def show_mismatch(*, title: str) -> object:
|
/// def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
|
||||||
/// """Warning modal, receiving address mismatch."""
|
/// """Warning modal, receiving address mismatch."""
|
||||||
Qstr::MP_QSTR_show_mismatch => obj_fn_kw!(0, new_show_mismatch).as_obj(),
|
Qstr::MP_QSTR_show_mismatch => obj_fn_kw!(0, new_show_mismatch).as_obj(),
|
||||||
|
|
||||||
@ -1860,7 +1931,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str | None,
|
/// title: str | None,
|
||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// button: str = "",
|
/// button: str = "",
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Simple dialog with text and one button."""
|
/// """Simple dialog with text and one button."""
|
||||||
Qstr::MP_QSTR_show_simple => obj_fn_kw!(0, new_show_simple).as_obj(),
|
Qstr::MP_QSTR_show_simple => obj_fn_kw!(0, new_show_simple).as_obj(),
|
||||||
|
|
||||||
@ -1870,7 +1941,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// button: str,
|
/// button: str,
|
||||||
/// info_button: str,
|
/// info_button: str,
|
||||||
/// items: Iterable[tuple[int, str]],
|
/// items: Iterable[tuple[int, str]],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm given items but with third button. Always single page
|
/// """Confirm given items but with third button. Always single page
|
||||||
/// without scrolling."""
|
/// without scrolling."""
|
||||||
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),
|
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),
|
||||||
@ -1880,7 +1951,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// items: Iterable[tuple[int, str]],
|
/// items: Iterable[tuple[int, str]],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm long content with the possibility to go back from any page.
|
/// """Confirm long content with the possibility to go back from any page.
|
||||||
/// Meant to be used with confirm_with_info."""
|
/// Meant to be used with confirm_with_info."""
|
||||||
Qstr::MP_QSTR_confirm_more => obj_fn_kw!(0, new_confirm_more).as_obj(),
|
Qstr::MP_QSTR_confirm_more => obj_fn_kw!(0, new_confirm_more).as_obj(),
|
||||||
@ -1889,7 +1960,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// max_rounds: str,
|
/// max_rounds: str,
|
||||||
/// max_feerate: str,
|
/// max_feerate: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm coinjoin authorization."""
|
/// """Confirm coinjoin authorization."""
|
||||||
Qstr::MP_QSTR_confirm_coinjoin => obj_fn_kw!(0, new_confirm_coinjoin).as_obj(),
|
Qstr::MP_QSTR_confirm_coinjoin => obj_fn_kw!(0, new_confirm_coinjoin).as_obj(),
|
||||||
|
|
||||||
@ -1899,7 +1970,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// subprompt: str,
|
/// subprompt: str,
|
||||||
/// allow_cancel: bool = True,
|
/// allow_cancel: bool = True,
|
||||||
/// wrong_pin: bool = False,
|
/// wrong_pin: bool = False,
|
||||||
/// ) -> str | object:
|
/// ) -> LayoutObj[str | UiResult]:
|
||||||
/// """Request pin on device."""
|
/// """Request pin on device."""
|
||||||
Qstr::MP_QSTR_request_pin => obj_fn_kw!(0, new_request_pin).as_obj(),
|
Qstr::MP_QSTR_request_pin => obj_fn_kw!(0, new_request_pin).as_obj(),
|
||||||
|
|
||||||
@ -1907,21 +1978,21 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// max_len: int,
|
/// max_len: int,
|
||||||
/// ) -> str | object:
|
/// ) -> LayoutObj[str | UiResult]:
|
||||||
/// """Passphrase input keyboard."""
|
/// """Passphrase input keyboard."""
|
||||||
Qstr::MP_QSTR_request_passphrase => obj_fn_kw!(0, new_request_passphrase).as_obj(),
|
Qstr::MP_QSTR_request_passphrase => obj_fn_kw!(0, new_request_passphrase).as_obj(),
|
||||||
|
|
||||||
/// def request_bip39(
|
/// def request_bip39(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// ) -> str:
|
/// ) -> LayoutObj[str]:
|
||||||
/// """BIP39 word input keyboard."""
|
/// """BIP39 word input keyboard."""
|
||||||
Qstr::MP_QSTR_request_bip39 => obj_fn_kw!(0, new_request_bip39).as_obj(),
|
Qstr::MP_QSTR_request_bip39 => obj_fn_kw!(0, new_request_bip39).as_obj(),
|
||||||
|
|
||||||
/// def request_slip39(
|
/// def request_slip39(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// ) -> str:
|
/// ) -> LayoutObj[str]:
|
||||||
/// """SLIP39 word input keyboard."""
|
/// """SLIP39 word input keyboard."""
|
||||||
Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(),
|
Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(),
|
||||||
|
|
||||||
@ -1930,7 +2001,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// description: str,
|
/// description: str,
|
||||||
/// words: Iterable[str],
|
/// words: Iterable[str],
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[int]:
|
||||||
/// """Select mnemonic word from three possibilities - seed check after backup. The
|
/// """Select mnemonic word from three possibilities - seed check after backup. The
|
||||||
/// iterable must be of exact size. Returns index in range `0..3`."""
|
/// iterable must be of exact size. Returns index in range `0..3`."""
|
||||||
Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(),
|
Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(),
|
||||||
@ -1939,7 +2010,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
/// pages: Iterable[str],
|
/// pages: Iterable[str],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
/// """Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
||||||
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),
|
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),
|
||||||
|
|
||||||
@ -1950,7 +2021,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// min_count: int,
|
/// min_count: int,
|
||||||
/// max_count: int,
|
/// max_count: int,
|
||||||
/// description: Callable[[int], str] | None = None,
|
/// description: Callable[[int], str] | None = None,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[tuple[UiResult, int]]:
|
||||||
/// """Number input with + and - buttons, description, and info button."""
|
/// """Number input with + and - buttons, description, and info button."""
|
||||||
Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(),
|
Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(),
|
||||||
|
|
||||||
@ -1960,7 +2031,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// items: Iterable[str],
|
/// items: Iterable[str],
|
||||||
/// active: int,
|
/// active: int,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Checklist of backup steps. Active index is highlighted, previous items have check
|
/// """Checklist of backup steps. Active index is highlighted, previous items have check
|
||||||
/// mark next to them."""
|
/// mark next to them."""
|
||||||
Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(),
|
Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(),
|
||||||
@ -1972,28 +2043,28 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// button: str,
|
/// button: str,
|
||||||
/// dry_run: bool,
|
/// dry_run: bool,
|
||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Device recovery homescreen."""
|
/// """Device recovery homescreen."""
|
||||||
Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(),
|
Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(),
|
||||||
|
|
||||||
/// def select_word_count(
|
/// def select_word_count(
|
||||||
/// *,
|
/// *,
|
||||||
/// dry_run: bool,
|
/// dry_run: bool,
|
||||||
/// ) -> int | str: # TT returns int
|
/// ) -> LayoutObj[int | str]: # TT returns int
|
||||||
/// """Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
/// """Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
||||||
Qstr::MP_QSTR_select_word_count => obj_fn_kw!(0, new_select_word_count).as_obj(),
|
Qstr::MP_QSTR_select_word_count => obj_fn_kw!(0, new_select_word_count).as_obj(),
|
||||||
|
|
||||||
/// def show_group_share_success(
|
/// def show_group_share_success(
|
||||||
/// *,
|
/// *,
|
||||||
/// lines: Iterable[str]
|
/// lines: Iterable[str]
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Shown after successfully finishing a group."""
|
/// """Shown after successfully finishing a group."""
|
||||||
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
|
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
|
||||||
|
|
||||||
/// def show_remaining_shares(
|
/// def show_remaining_shares(
|
||||||
/// *,
|
/// *,
|
||||||
/// pages: Iterable[tuple[str, str]],
|
/// pages: Iterable[tuple[str, str]],
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
/// """Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
||||||
Qstr::MP_QSTR_show_remaining_shares => obj_fn_kw!(0, new_show_remaining_shares).as_obj(),
|
Qstr::MP_QSTR_show_remaining_shares => obj_fn_kw!(0, new_show_remaining_shares).as_obj(),
|
||||||
|
|
||||||
@ -2002,7 +2073,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// indeterminate: bool = False,
|
/// indeterminate: bool = False,
|
||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show progress loader. Please note that the number of lines reserved on screen for
|
/// """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
|
/// description is determined at construction time. If you want multiline descriptions
|
||||||
/// make sure the initial description has at least that amount of lines."""
|
/// make sure the initial description has at least that amount of lines."""
|
||||||
@ -2014,7 +2085,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// indeterminate: bool = False,
|
/// indeterminate: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// skip_first_paint: bool = False,
|
/// skip_first_paint: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
||||||
/// time_ms timeout is passed."""
|
/// time_ms timeout is passed."""
|
||||||
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
|
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
|
||||||
@ -2026,7 +2097,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// notification: str | None,
|
/// notification: str | None,
|
||||||
/// notification_level: int = 0,
|
/// notification_level: int = 0,
|
||||||
/// skip_first_paint: bool,
|
/// skip_first_paint: bool,
|
||||||
/// ) -> CANCELLED:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Idle homescreen."""
|
/// """Idle homescreen."""
|
||||||
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
|
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
|
||||||
|
|
||||||
@ -2036,11 +2107,11 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// bootscreen: bool,
|
/// bootscreen: bool,
|
||||||
/// skip_first_paint: bool,
|
/// skip_first_paint: bool,
|
||||||
/// coinjoin_authorized: bool = False,
|
/// coinjoin_authorized: bool = False,
|
||||||
/// ) -> CANCELLED:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Homescreen for locked device."""
|
/// """Homescreen for locked device."""
|
||||||
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
|
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
|
||||||
|
|
||||||
/// def draw_welcome_screen() -> None:
|
/// def draw_welcome_screen() -> LayoutObj[None]:
|
||||||
/// """Show logo icon with the model name at the bottom and return."""
|
/// """Show logo icon with the model name at the bottom and return."""
|
||||||
Qstr::MP_QSTR_draw_welcome_screen => obj_fn_0!(draw_welcome_screen).as_obj(),
|
Qstr::MP_QSTR_draw_welcome_screen => obj_fn_0!(draw_welcome_screen).as_obj(),
|
||||||
|
|
||||||
@ -2048,7 +2119,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// description: str,
|
/// description: str,
|
||||||
/// fingerprint: str,
|
/// fingerprint: str,
|
||||||
/// ) -> None:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
/// """Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
||||||
Qstr::MP_QSTR_confirm_firmware_update => obj_fn_kw!(0, new_confirm_firmware_update).as_obj(),
|
Qstr::MP_QSTR_confirm_firmware_update => obj_fn_kw!(0, new_confirm_firmware_update).as_obj(),
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from typing import *
|
from typing import *
|
||||||
CONFIRMED: object
|
CONFIRMED: UiResult
|
||||||
CANCELLED: object
|
CANCELLED: UiResult
|
||||||
INFO: object
|
INFO: UiResult
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
@ -25,7 +25,7 @@ def confirm_action(
|
|||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
hold_danger: bool = False, # unused on TR
|
hold_danger: bool = False, # unused on TR
|
||||||
reverse: bool = False,
|
reverse: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm action."""
|
"""Confirm action."""
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ def confirm_blob(
|
|||||||
verb_cancel: str | None = None,
|
verb_cancel: str | None = None,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm byte sequence data."""
|
"""Confirm byte sequence data."""
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ def confirm_address(
|
|||||||
extra: str | None, # unused on TR
|
extra: str | None, # unused on TR
|
||||||
verb: str = "CONFIRM",
|
verb: str = "CONFIRM",
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm address."""
|
"""Confirm address."""
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ def confirm_properties(
|
|||||||
title: str,
|
title: str,
|
||||||
items: list[tuple[str | None, str | bytes | None, bool]],
|
items: list[tuple[str | None, str | bytes | None, bool]],
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm list of key-value pairs. The third component in the tuple should be True if
|
"""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.
|
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."""
|
This only concerns the text style, you need to decode the value to UTF-8 in python."""
|
||||||
@ -83,12 +83,12 @@ def confirm_reset_device(
|
|||||||
*,
|
*,
|
||||||
title: str,
|
title: str,
|
||||||
button: str,
|
button: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm TOS before device setup."""
|
"""Confirm TOS before device setup."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def confirm_backup() -> object:
|
def confirm_backup() -> LayoutObj[UiResult]:
|
||||||
"""Strongly recommend user to do backup."""
|
"""Strongly recommend user to do backup."""
|
||||||
|
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ def show_address_details(
|
|||||||
account: str | None,
|
account: str | None,
|
||||||
path: str | None,
|
path: str | None,
|
||||||
xpubs: list[tuple[str, str]],
|
xpubs: list[tuple[str, str]],
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show address details - QR code, account, path, cosigner xpubs."""
|
"""Show address details - QR code, account, path, cosigner xpubs."""
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ def confirm_value(
|
|||||||
value: str,
|
value: str,
|
||||||
verb: str | None = None,
|
verb: str | None = None,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm value."""
|
"""Confirm value."""
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ def confirm_joint_total(
|
|||||||
*,
|
*,
|
||||||
spending_amount: str,
|
spending_amount: str,
|
||||||
total_amount: str,
|
total_amount: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm total if there are external inputs."""
|
"""Confirm total if there are external inputs."""
|
||||||
|
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ def confirm_modify_output(
|
|||||||
sign: int,
|
sign: int,
|
||||||
amount_change: str,
|
amount_change: str,
|
||||||
amount_new: str,
|
amount_new: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Decrease or increase amount for given address."""
|
"""Decrease or increase amount for given address."""
|
||||||
|
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ def confirm_output_address(
|
|||||||
address_label: str,
|
address_label: str,
|
||||||
address_title: str,
|
address_title: str,
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm output address."""
|
"""Confirm output address."""
|
||||||
|
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ def confirm_output_amount(
|
|||||||
*,
|
*,
|
||||||
amount: str,
|
amount: str,
|
||||||
amount_title: str,
|
amount_title: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm output amount."""
|
"""Confirm output amount."""
|
||||||
|
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ def confirm_total(
|
|||||||
account_label: str | None,
|
account_label: str | None,
|
||||||
total_label: str,
|
total_label: str,
|
||||||
fee_label: str,
|
fee_label: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm summary of a transaction."""
|
"""Confirm summary of a transaction."""
|
||||||
|
|
||||||
|
|
||||||
@ -177,12 +177,12 @@ def confirm_ethereum_tx(
|
|||||||
maximum_fee: str,
|
maximum_fee: str,
|
||||||
items: Iterable[Tuple[str, str]],
|
items: Iterable[Tuple[str, str]],
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm details about Ethereum transaction."""
|
"""Confirm details about Ethereum transaction."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def tutorial() -> object:
|
def tutorial() -> LayoutObj[UiResult]:
|
||||||
"""Show user how to interact with the device."""
|
"""Show user how to interact with the device."""
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ def confirm_modify_fee(
|
|||||||
user_fee_change: str,
|
user_fee_change: str,
|
||||||
total_fee_new: str,
|
total_fee_new: str,
|
||||||
fee_rate_amount: str | None,
|
fee_rate_amount: str | None,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Decrease or increase transaction fee."""
|
"""Decrease or increase transaction fee."""
|
||||||
|
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ def confirm_fido(
|
|||||||
app_name: str,
|
app_name: str,
|
||||||
icon_name: str | None, # unused on TR
|
icon_name: str | None, # unused on TR
|
||||||
accounts: list[str | None],
|
accounts: list[str | None],
|
||||||
) -> int | object:
|
) -> LayoutObj[int | UiResult]:
|
||||||
"""FIDO confirmation.
|
"""FIDO confirmation.
|
||||||
Returns page index in case of confirmation and CANCELLED otherwise.
|
Returns page index in case of confirmation and CANCELLED otherwise.
|
||||||
"""
|
"""
|
||||||
@ -217,7 +217,7 @@ def multiple_pages_texts(
|
|||||||
title: str,
|
title: str,
|
||||||
verb: str,
|
verb: str,
|
||||||
items: list[str],
|
items: list[str],
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show multiple texts, each on its own page."""
|
"""Show multiple texts, each on its own page."""
|
||||||
|
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ def show_warning(
|
|||||||
button: str,
|
button: str,
|
||||||
warning: str,
|
warning: str,
|
||||||
description: str,
|
description: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Warning modal with middle button and centered text."""
|
"""Warning modal with middle button and centered text."""
|
||||||
|
|
||||||
|
|
||||||
@ -237,17 +237,17 @@ def show_info(
|
|||||||
title: str,
|
title: str,
|
||||||
description: str = "",
|
description: str = "",
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Info modal."""
|
"""Info modal."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def show_passphrase() -> object:
|
def show_passphrase() -> LayoutObj[UiResult]:
|
||||||
"""Show passphrase on host dialog."""
|
"""Show passphrase on host dialog."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def show_mismatch(*, title: str) -> object:
|
def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
|
||||||
"""Warning modal, receiving address mismatch."""
|
"""Warning modal, receiving address mismatch."""
|
||||||
|
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ def confirm_with_info(
|
|||||||
info_button: str, # unused on TR
|
info_button: str, # unused on TR
|
||||||
items: Iterable[Tuple[int, str]],
|
items: Iterable[Tuple[int, str]],
|
||||||
verb_cancel: str | None = None,
|
verb_cancel: str | None = None,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm given items but with third button. Always single page
|
"""Confirm given items but with third button. Always single page
|
||||||
without scrolling."""
|
without scrolling."""
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ def confirm_coinjoin(
|
|||||||
*,
|
*,
|
||||||
max_rounds: str,
|
max_rounds: str,
|
||||||
max_feerate: str,
|
max_feerate: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm coinjoin authorization."""
|
"""Confirm coinjoin authorization."""
|
||||||
|
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ def request_pin(
|
|||||||
subprompt: str,
|
subprompt: str,
|
||||||
allow_cancel: bool = True, # unused on TR
|
allow_cancel: bool = True, # unused on TR
|
||||||
wrong_pin: bool = False, # unused on TR
|
wrong_pin: bool = False, # unused on TR
|
||||||
) -> str | object:
|
) -> LayoutObj[str | UiResult]:
|
||||||
"""Request pin on device."""
|
"""Request pin on device."""
|
||||||
|
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ def request_passphrase(
|
|||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
max_len: int, # unused on TR
|
max_len: int, # unused on TR
|
||||||
) -> str | object:
|
) -> LayoutObj[str | UiResult]:
|
||||||
"""Get passphrase."""
|
"""Get passphrase."""
|
||||||
|
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ def request_passphrase(
|
|||||||
def request_bip39(
|
def request_bip39(
|
||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
) -> str:
|
) -> LayoutObj[str]:
|
||||||
"""Get recovery word for BIP39."""
|
"""Get recovery word for BIP39."""
|
||||||
|
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ def request_bip39(
|
|||||||
def request_slip39(
|
def request_slip39(
|
||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
) -> str:
|
) -> LayoutObj[str]:
|
||||||
"""SLIP39 word input keyboard."""
|
"""SLIP39 word input keyboard."""
|
||||||
|
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ def select_word(
|
|||||||
title: str, # unused on TR
|
title: str, # unused on TR
|
||||||
description: str,
|
description: str,
|
||||||
words: Iterable[str],
|
words: Iterable[str],
|
||||||
) -> int:
|
) -> LayoutObj[int]:
|
||||||
"""Select mnemonic word from three possibilities - seed check after backup. The
|
"""Select mnemonic word from three possibilities - seed check after backup. The
|
||||||
iterable must be of exact size. Returns index in range `0..3`."""
|
iterable must be of exact size. Returns index in range `0..3`."""
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ def select_word(
|
|||||||
def show_share_words(
|
def show_share_words(
|
||||||
*,
|
*,
|
||||||
share_words: Iterable[str],
|
share_words: Iterable[str],
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Shows a backup seed."""
|
"""Shows a backup seed."""
|
||||||
|
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ def request_number(
|
|||||||
min_count: int,
|
min_count: int,
|
||||||
max_count: int,
|
max_count: int,
|
||||||
description: Callable[[int], str] | None = None, # unused on TR
|
description: Callable[[int], str] | None = None, # unused on TR
|
||||||
) -> object:
|
) -> LayoutObj[tuple[UiResult, int]]:
|
||||||
"""Number input with + and - buttons, description, and info button."""
|
"""Number input with + and - buttons, description, and info button."""
|
||||||
|
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ def show_checklist(
|
|||||||
items: Iterable[str],
|
items: Iterable[str],
|
||||||
active: int,
|
active: int,
|
||||||
button: str,
|
button: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
||||||
mark next to them."""
|
mark next to them."""
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ def confirm_recovery(
|
|||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
info_button: bool, # unused on TR
|
info_button: bool, # unused on TR
|
||||||
show_info: bool,
|
show_info: bool,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Device recovery homescreen."""
|
"""Device recovery homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -381,6 +381,7 @@ def select_word_count(
|
|||||||
*,
|
*,
|
||||||
dry_run: bool, # unused on TR
|
dry_run: bool, # unused on TR
|
||||||
) -> int | str: # TR returns str
|
) -> int | str: # TR returns str
|
||||||
|
) -> LayoutObj[int | str]:
|
||||||
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
||||||
|
|
||||||
|
|
||||||
@ -388,7 +389,7 @@ def select_word_count(
|
|||||||
def show_group_share_success(
|
def show_group_share_success(
|
||||||
*,
|
*,
|
||||||
lines: Iterable[str],
|
lines: Iterable[str],
|
||||||
) -> int:
|
) -> LayoutObj[int]:
|
||||||
"""Shown after successfully finishing a group."""
|
"""Shown after successfully finishing a group."""
|
||||||
|
|
||||||
|
|
||||||
@ -398,7 +399,7 @@ def show_progress(
|
|||||||
title: str,
|
title: str,
|
||||||
indeterminate: bool = False,
|
indeterminate: bool = False,
|
||||||
description: str = "",
|
description: str = "",
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show progress loader. Please note that the number of lines reserved on screen for
|
"""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
|
description is determined at construction time. If you want multiline descriptions
|
||||||
make sure the initial description has at least that amount of lines."""
|
make sure the initial description has at least that amount of lines."""
|
||||||
@ -411,7 +412,7 @@ def show_progress_coinjoin(
|
|||||||
indeterminate: bool = False,
|
indeterminate: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
skip_first_paint: bool = False,
|
skip_first_paint: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
||||||
time_ms timeout is passed."""
|
time_ms timeout is passed."""
|
||||||
|
|
||||||
@ -424,7 +425,7 @@ def show_homescreen(
|
|||||||
notification: str | None,
|
notification: str | None,
|
||||||
notification_level: int = 0,
|
notification_level: int = 0,
|
||||||
skip_first_paint: bool,
|
skip_first_paint: bool,
|
||||||
) -> CANCELLED:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Idle homescreen."""
|
"""Idle homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -435,7 +436,7 @@ def show_lockscreen(
|
|||||||
bootscreen: bool,
|
bootscreen: bool,
|
||||||
skip_first_paint: bool,
|
skip_first_paint: bool,
|
||||||
coinjoin_authorized: bool = False,
|
coinjoin_authorized: bool = False,
|
||||||
) -> CANCELLED:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Homescreen for locked device."""
|
"""Homescreen for locked device."""
|
||||||
|
|
||||||
|
|
||||||
@ -451,9 +452,65 @@ def confirm_firmware_update(
|
|||||||
fingerprint: str,
|
fingerprint: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
"""Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
||||||
CONFIRMED: object
|
from trezor import utils
|
||||||
CANCELLED: object
|
T = TypeVar("T")
|
||||||
INFO: object
|
|
||||||
|
|
||||||
|
# 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."""
|
||||||
|
|
||||||
|
|
||||||
|
# rust/src/ui/model_tt/layout.rs
|
||||||
|
class UiResult:
|
||||||
|
"""Result of a UI operation."""
|
||||||
|
pass
|
||||||
|
CONFIRMED: UiResult
|
||||||
|
CANCELLED: UiResult
|
||||||
|
INFO: UiResult
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tt/layout.rs
|
# rust/src/ui/model_tt/layout.rs
|
||||||
@ -482,7 +539,7 @@ def confirm_action(
|
|||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
hold_danger: bool = False,
|
hold_danger: bool = False,
|
||||||
reverse: bool = False,
|
reverse: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm action."""
|
"""Confirm action."""
|
||||||
|
|
||||||
|
|
||||||
@ -492,7 +549,7 @@ def confirm_emphasized(
|
|||||||
title: str,
|
title: str,
|
||||||
items: Iterable[str | tuple[bool, str]],
|
items: Iterable[str | tuple[bool, str]],
|
||||||
verb: str | None = None,
|
verb: str | None = None,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm formatted text that has been pre-split in python. For tuples
|
"""Confirm formatted text that has been pre-split in python. For tuples
|
||||||
the first component is a bool indicating whether this part is emphasized."""
|
the first component is a bool indicating whether this part is emphasized."""
|
||||||
|
|
||||||
@ -502,7 +559,7 @@ def confirm_homescreen(
|
|||||||
*,
|
*,
|
||||||
title: str,
|
title: str,
|
||||||
image: bytes,
|
image: bytes,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm homescreen."""
|
"""Confirm homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -517,7 +574,7 @@ def confirm_blob(
|
|||||||
verb_cancel: str | None = None,
|
verb_cancel: str | None = None,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm byte sequence data."""
|
"""Confirm byte sequence data."""
|
||||||
|
|
||||||
|
|
||||||
@ -530,7 +587,7 @@ def confirm_address(
|
|||||||
verb: str | None = "CONFIRM",
|
verb: str | None = "CONFIRM",
|
||||||
extra: str | None,
|
extra: str | None,
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm address. Similar to `confirm_blob` but has corner info button
|
"""Confirm address. Similar to `confirm_blob` but has corner info button
|
||||||
and allows left swipe which does the same thing as the button."""
|
and allows left swipe which does the same thing as the button."""
|
||||||
|
|
||||||
@ -541,7 +598,7 @@ def confirm_properties(
|
|||||||
title: str,
|
title: str,
|
||||||
items: list[tuple[str | None, str | bytes | None, bool]],
|
items: list[tuple[str | None, str | bytes | None, bool]],
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm list of key-value pairs. The third component in the tuple should be True if
|
"""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."""
|
the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
|
|
||||||
@ -551,7 +608,7 @@ def confirm_reset_device(
|
|||||||
*,
|
*,
|
||||||
title: str,
|
title: str,
|
||||||
button: str,
|
button: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm TOS before device setup."""
|
"""Confirm TOS before device setup."""
|
||||||
|
|
||||||
|
|
||||||
@ -565,7 +622,7 @@ def show_address_details(
|
|||||||
account: str | None,
|
account: str | None,
|
||||||
path: str | None,
|
path: str | None,
|
||||||
xpubs: list[tuple[str, str]],
|
xpubs: list[tuple[str, str]],
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show address details - QR code, account, path, cosigner xpubs."""
|
"""Show address details - QR code, account, path, cosigner xpubs."""
|
||||||
|
|
||||||
|
|
||||||
@ -575,7 +632,7 @@ def show_info_with_cancel(
|
|||||||
title: str,
|
title: str,
|
||||||
items: Iterable[Tuple[str, str]],
|
items: Iterable[Tuple[str, str]],
|
||||||
horizontal: bool = False,
|
horizontal: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show metadata for outgoing transaction."""
|
"""Show metadata for outgoing transaction."""
|
||||||
|
|
||||||
|
|
||||||
@ -591,7 +648,7 @@ def confirm_value(
|
|||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm value. Merge of confirm_total and confirm_output."""
|
"""Confirm value. Merge of confirm_total and confirm_output."""
|
||||||
|
|
||||||
|
|
||||||
@ -602,7 +659,7 @@ def confirm_total(
|
|||||||
items: list[tuple[str, str]],
|
items: list[tuple[str, str]],
|
||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
cancel_arrow: bool = False,
|
cancel_arrow: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Transaction summary. Always hold to confirm."""
|
"""Transaction summary. Always hold to confirm."""
|
||||||
|
|
||||||
|
|
||||||
@ -613,7 +670,7 @@ def confirm_modify_output(
|
|||||||
sign: int,
|
sign: int,
|
||||||
amount_change: str,
|
amount_change: str,
|
||||||
amount_new: str,
|
amount_new: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Decrease or increase amount for given address."""
|
"""Decrease or increase amount for given address."""
|
||||||
|
|
||||||
|
|
||||||
@ -625,7 +682,7 @@ def confirm_modify_fee(
|
|||||||
user_fee_change: str,
|
user_fee_change: str,
|
||||||
total_fee_new: str,
|
total_fee_new: str,
|
||||||
fee_rate_amount: str | None, # ignored
|
fee_rate_amount: str | None, # ignored
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Decrease or increase transaction fee."""
|
"""Decrease or increase transaction fee."""
|
||||||
|
|
||||||
|
|
||||||
@ -636,7 +693,7 @@ def confirm_fido(
|
|||||||
app_name: str,
|
app_name: str,
|
||||||
icon_name: str | None,
|
icon_name: str | None,
|
||||||
accounts: list[str | None],
|
accounts: list[str | None],
|
||||||
) -> int | object:
|
) -> LayoutObj[int | UiResult]:
|
||||||
"""FIDO confirmation.
|
"""FIDO confirmation.
|
||||||
Returns page index in case of confirmation and CANCELLED otherwise.
|
Returns page index in case of confirmation and CANCELLED otherwise.
|
||||||
"""
|
"""
|
||||||
@ -650,7 +707,7 @@ def show_error(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Error modal. No buttons shown when `button` is empty string."""
|
"""Error modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
@ -663,7 +720,7 @@ def show_warning(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Warning modal. No buttons shown when `button` is empty string."""
|
"""Warning modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
@ -675,7 +732,7 @@ def show_success(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Success modal. No buttons shown when `button` is empty string."""
|
"""Success modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
@ -687,12 +744,12 @@ def show_info(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Info modal. No buttons shown when `button` is empty string."""
|
"""Info modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tt/layout.rs
|
# rust/src/ui/model_tt/layout.rs
|
||||||
def show_mismatch(*, title: str) -> object:
|
def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
|
||||||
"""Warning modal, receiving address mismatch."""
|
"""Warning modal, receiving address mismatch."""
|
||||||
|
|
||||||
|
|
||||||
@ -702,7 +759,7 @@ def show_simple(
|
|||||||
title: str | None,
|
title: str | None,
|
||||||
description: str = "",
|
description: str = "",
|
||||||
button: str = "",
|
button: str = "",
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Simple dialog with text and one button."""
|
"""Simple dialog with text and one button."""
|
||||||
|
|
||||||
|
|
||||||
@ -713,7 +770,7 @@ def confirm_with_info(
|
|||||||
button: str,
|
button: str,
|
||||||
info_button: str,
|
info_button: str,
|
||||||
items: Iterable[tuple[int, str]],
|
items: Iterable[tuple[int, str]],
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm given items but with third button. Always single page
|
"""Confirm given items but with third button. Always single page
|
||||||
without scrolling."""
|
without scrolling."""
|
||||||
|
|
||||||
@ -724,7 +781,7 @@ def confirm_more(
|
|||||||
title: str,
|
title: str,
|
||||||
button: str,
|
button: str,
|
||||||
items: Iterable[tuple[int, str]],
|
items: Iterable[tuple[int, str]],
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm long content with the possibility to go back from any page.
|
"""Confirm long content with the possibility to go back from any page.
|
||||||
Meant to be used with confirm_with_info."""
|
Meant to be used with confirm_with_info."""
|
||||||
|
|
||||||
@ -734,7 +791,7 @@ def confirm_coinjoin(
|
|||||||
*,
|
*,
|
||||||
max_rounds: str,
|
max_rounds: str,
|
||||||
max_feerate: str,
|
max_feerate: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm coinjoin authorization."""
|
"""Confirm coinjoin authorization."""
|
||||||
|
|
||||||
|
|
||||||
@ -745,7 +802,7 @@ def request_pin(
|
|||||||
subprompt: str,
|
subprompt: str,
|
||||||
allow_cancel: bool = True,
|
allow_cancel: bool = True,
|
||||||
wrong_pin: bool = False,
|
wrong_pin: bool = False,
|
||||||
) -> str | object:
|
) -> LayoutObj[str | UiResult]:
|
||||||
"""Request pin on device."""
|
"""Request pin on device."""
|
||||||
|
|
||||||
|
|
||||||
@ -754,7 +811,7 @@ def request_passphrase(
|
|||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
max_len: int,
|
max_len: int,
|
||||||
) -> str | object:
|
) -> LayoutObj[str | UiResult]:
|
||||||
"""Passphrase input keyboard."""
|
"""Passphrase input keyboard."""
|
||||||
|
|
||||||
|
|
||||||
@ -762,7 +819,7 @@ def request_passphrase(
|
|||||||
def request_bip39(
|
def request_bip39(
|
||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
) -> str:
|
) -> LayoutObj[str]:
|
||||||
"""BIP39 word input keyboard."""
|
"""BIP39 word input keyboard."""
|
||||||
|
|
||||||
|
|
||||||
@ -770,7 +827,7 @@ def request_bip39(
|
|||||||
def request_slip39(
|
def request_slip39(
|
||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
) -> str:
|
) -> LayoutObj[str]:
|
||||||
"""SLIP39 word input keyboard."""
|
"""SLIP39 word input keyboard."""
|
||||||
|
|
||||||
|
|
||||||
@ -780,7 +837,7 @@ def select_word(
|
|||||||
title: str,
|
title: str,
|
||||||
description: str,
|
description: str,
|
||||||
words: Iterable[str],
|
words: Iterable[str],
|
||||||
) -> int:
|
) -> LayoutObj[int]:
|
||||||
"""Select mnemonic word from three possibilities - seed check after backup. The
|
"""Select mnemonic word from three possibilities - seed check after backup. The
|
||||||
iterable must be of exact size. Returns index in range `0..3`."""
|
iterable must be of exact size. Returns index in range `0..3`."""
|
||||||
|
|
||||||
@ -790,7 +847,7 @@ def show_share_words(
|
|||||||
*,
|
*,
|
||||||
title: str,
|
title: str,
|
||||||
pages: Iterable[str],
|
pages: Iterable[str],
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
"""Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
||||||
|
|
||||||
|
|
||||||
@ -802,7 +859,7 @@ def request_number(
|
|||||||
min_count: int,
|
min_count: int,
|
||||||
max_count: int,
|
max_count: int,
|
||||||
description: Callable[[int], str] | None = None,
|
description: Callable[[int], str] | None = None,
|
||||||
) -> object:
|
) -> LayoutObj[tuple[UiResult, int]]:
|
||||||
"""Number input with + and - buttons, description, and info button."""
|
"""Number input with + and - buttons, description, and info button."""
|
||||||
|
|
||||||
|
|
||||||
@ -813,7 +870,7 @@ def show_checklist(
|
|||||||
items: Iterable[str],
|
items: Iterable[str],
|
||||||
active: int,
|
active: int,
|
||||||
button: str,
|
button: str,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
||||||
mark next to them."""
|
mark next to them."""
|
||||||
|
|
||||||
@ -826,7 +883,7 @@ def confirm_recovery(
|
|||||||
button: str,
|
button: str,
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Device recovery homescreen."""
|
"""Device recovery homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -834,7 +891,7 @@ def confirm_recovery(
|
|||||||
def select_word_count(
|
def select_word_count(
|
||||||
*,
|
*,
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
) -> int | str: # TT returns int
|
) -> LayoutObj[int | str]: # TT returns int
|
||||||
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
||||||
|
|
||||||
|
|
||||||
@ -842,7 +899,7 @@ def select_word_count(
|
|||||||
def show_group_share_success(
|
def show_group_share_success(
|
||||||
*,
|
*,
|
||||||
lines: Iterable[str]
|
lines: Iterable[str]
|
||||||
) -> int:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Shown after successfully finishing a group."""
|
"""Shown after successfully finishing a group."""
|
||||||
|
|
||||||
|
|
||||||
@ -850,7 +907,7 @@ def show_group_share_success(
|
|||||||
def show_remaining_shares(
|
def show_remaining_shares(
|
||||||
*,
|
*,
|
||||||
pages: Iterable[tuple[str, str]],
|
pages: Iterable[tuple[str, str]],
|
||||||
) -> int:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
||||||
|
|
||||||
|
|
||||||
@ -860,7 +917,7 @@ def show_progress(
|
|||||||
title: str,
|
title: str,
|
||||||
indeterminate: bool = False,
|
indeterminate: bool = False,
|
||||||
description: str = "",
|
description: str = "",
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show progress loader. Please note that the number of lines reserved on screen for
|
"""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
|
description is determined at construction time. If you want multiline descriptions
|
||||||
make sure the initial description has at least that amount of lines."""
|
make sure the initial description has at least that amount of lines."""
|
||||||
@ -873,7 +930,7 @@ def show_progress_coinjoin(
|
|||||||
indeterminate: bool = False,
|
indeterminate: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
skip_first_paint: bool = False,
|
skip_first_paint: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
||||||
time_ms timeout is passed."""
|
time_ms timeout is passed."""
|
||||||
|
|
||||||
@ -886,7 +943,7 @@ def show_homescreen(
|
|||||||
notification: str | None,
|
notification: str | None,
|
||||||
notification_level: int = 0,
|
notification_level: int = 0,
|
||||||
skip_first_paint: bool,
|
skip_first_paint: bool,
|
||||||
) -> CANCELLED:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Idle homescreen."""
|
"""Idle homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -897,12 +954,12 @@ def show_lockscreen(
|
|||||||
bootscreen: bool,
|
bootscreen: bool,
|
||||||
skip_first_paint: bool,
|
skip_first_paint: bool,
|
||||||
coinjoin_authorized: bool = False,
|
coinjoin_authorized: bool = False,
|
||||||
) -> CANCELLED:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Homescreen for locked device."""
|
"""Homescreen for locked device."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tt/layout.rs
|
# rust/src/ui/model_tt/layout.rs
|
||||||
def draw_welcome_screen() -> None:
|
def draw_welcome_screen() -> LayoutObj[None]:
|
||||||
"""Show logo icon with the model name at the bottom and return."""
|
"""Show logo icon with the model name at the bottom and return."""
|
||||||
|
|
||||||
|
|
||||||
@ -911,5 +968,5 @@ def confirm_firmware_update(
|
|||||||
*,
|
*,
|
||||||
description: str,
|
description: str,
|
||||||
fingerprint: str,
|
fingerprint: str,
|
||||||
) -> None:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
"""Ask whether to update firmware, optionally show fingerprint. Shared with bootloader."""
|
||||||
|
Loading…
Reference in New Issue
Block a user