1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-25 22:02:05 +00:00

feat(core): add description to Delizia confirm_output()

It will allow confirming the vote account for Solana staking.

[no changelog]
This commit is contained in:
Roman Zeyde 2025-02-23 20:37:49 +02:00 committed by Roman Zeyde
parent 8a5373c733
commit 803955b047
7 changed files with 21 additions and 7 deletions

View File

@ -423,6 +423,8 @@ extern "C" fn new_flow_confirm_output(n_args: usize, args: *const Obj, kwargs: *
let block = move |_args: &[Obj], kwargs: &Map| {
let title: Option<TString> = kwargs.get(Qstr::MP_QSTR_title)?.try_into_option()?;
let subtitle: Option<TString> = kwargs.get(Qstr::MP_QSTR_subtitle)?.try_into_option()?;
let description: Option<TString> =
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?;
let message: Obj = kwargs.get(Qstr::MP_QSTR_message)?;
let amount: Option<Obj> = kwargs.get(Qstr::MP_QSTR_amount)?.try_into_option()?;
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;
@ -466,6 +468,7 @@ extern "C" fn new_flow_confirm_output(n_args: usize, args: *const Obj, kwargs: *
let layout = ModelUI::flow_confirm_output(
title,
subtitle,
description,
message,
amount,
chunkify,
@ -1351,6 +1354,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// summary_br_code: ButtonRequestType | None = None,
/// summary_br_name: str | None = None,
/// cancel_text: str | None = None,
/// description: str | None = None,
/// ) -> LayoutObj[UiResult]:
/// """Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""
Qstr::MP_QSTR_flow_confirm_output => obj_fn_kw!(0, new_flow_confirm_output).as_obj(),

View File

@ -539,6 +539,7 @@ impl FirmwareUI for UIBolt {
fn flow_confirm_output(
_title: Option<TString<'static>>,
_subtitle: Option<TString<'static>>,
_description: Option<TString<'static>>,
_message: Obj,
_amount: Option<Obj>,
_chunkify: bool,

View File

@ -678,6 +678,7 @@ impl FirmwareUI for UICaesar {
fn flow_confirm_output(
_title: Option<TString<'static>>,
_subtitle: Option<TString<'static>>,
_description: Option<TString<'static>>,
_message: Obj,
_amount: Option<Obj>,
_chunkify: bool,

View File

@ -510,6 +510,7 @@ impl FirmwareUI for UIDelizia {
fn flow_confirm_output(
title: Option<TString<'static>>,
subtitle: Option<TString<'static>>,
description: Option<TString<'static>>,
message: Obj,
amount: Option<Obj>,
chunkify: bool,
@ -527,13 +528,14 @@ impl FirmwareUI for UIDelizia {
summary_br_name: Option<TString<'static>>,
cancel_text: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
let confirm_main = ConfirmValue::new(title.unwrap_or(TString::empty()), message, None)
.with_subtitle(subtitle)
.with_menu_button()
.with_footer(TR::instructions__swipe_up.into(), None)
.with_chunkify(chunkify)
.with_text_mono(text_mono)
.with_swipe_up();
let confirm_main =
ConfirmValue::new(title.unwrap_or(TString::empty()), message, description)
.with_subtitle(subtitle)
.with_menu_button()
.with_footer(TR::instructions__swipe_up.into(), None)
.with_chunkify(chunkify)
.with_text_mono(text_mono)
.with_swipe_up();
let confirm_amount = amount.map(|amount| {
ConfirmValue::new(TR::words__amount.into(), amount, None)

View File

@ -160,6 +160,7 @@ pub trait FirmwareUI {
fn flow_confirm_output(
title: Option<TString<'static>>,
subtitle: Option<TString<'static>>,
description: Option<TString<'static>>,
message: Obj, // TODO: replace Obj
amount: Option<Obj>, // TODO: replace Obj
chunkify: bool,

View File

@ -327,6 +327,7 @@ def flow_confirm_output(
summary_br_code: ButtonRequestType | None = None,
summary_br_name: str | None = None,
cancel_text: str | None = None,
description: str | None = None,
) -> LayoutObj[UiResult]:
"""Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""

View File

@ -377,6 +377,7 @@ async def confirm_output(
source_account: str | None = None,
source_account_path: str | None = None,
cancel_text: str | None = None,
description: str | None = None,
) -> None:
if address_label is not None:
title = address_label
@ -407,6 +408,7 @@ async def confirm_output(
summary_br_name=None,
summary_br_code=None,
cancel_text=cancel_text,
description=description,
),
br_name=None,
)
@ -789,6 +791,7 @@ if not utils.BITCOIN_ONLY:
summary_br_name="confirm_total",
summary_br_code=ButtonRequestType.SignTx,
cancel_text=TR.buttons__cancel,
description=None,
),
None,
)
@ -835,6 +838,7 @@ if not utils.BITCOIN_ONLY:
summary_br_name="confirm_total",
summary_br_code=ButtonRequestType.SignTx,
cancel_text=TR.buttons__cancel, # cancel staking
description=None,
),
br_name=None,
)