mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-24 13:22:05 +00:00
feat(core): support description
in Delizia flow_confirm_output()
It will allow confirming the vote account for Solana staking. [no changelog]
This commit is contained in:
parent
684802907a
commit
0892c8971d
@ -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)?;
|
||||
@ -453,6 +455,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,
|
||||
@ -1338,6 +1341,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(),
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
@ -529,7 +530,8 @@ impl FirmwareUI for UIDelizia {
|
||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||
let address_title = address_title.unwrap_or(TR::words__address.into());
|
||||
|
||||
let confirm_main = ConfirmValue::new(title.unwrap_or(TString::empty()), message, None)
|
||||
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)
|
||||
|
@ -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,
|
||||
|
@ -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."""
|
||||
|
||||
|
@ -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,
|
||||
)
|
||||
@ -877,14 +881,19 @@ if not utils.BITCOIN_ONLY:
|
||||
) -> None:
|
||||
(address_title, address) = stake_item
|
||||
summary_items = (amount_item, fee_item)
|
||||
description = message
|
||||
if vote_account:
|
||||
description = f"{message}\n{TR.solana__stake_provider}:"
|
||||
|
||||
await raise_if_not_confirmed(
|
||||
trezorui_api.flow_confirm_output(
|
||||
title=title,
|
||||
subtitle=None,
|
||||
message=message,
|
||||
description=description,
|
||||
message=vote_account,
|
||||
amount=None,
|
||||
chunkify=False,
|
||||
text_mono=False,
|
||||
chunkify=True,
|
||||
text_mono=True,
|
||||
account=account,
|
||||
account_path=account_path,
|
||||
br_code=ButtonRequestType.SignTx,
|
||||
|
Loading…
Reference in New Issue
Block a user