mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-24 21:32:03 +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 block = move |_args: &[Obj], kwargs: &Map| {
|
||||||
let title: Option<TString> = kwargs.get(Qstr::MP_QSTR_title)?.try_into_option()?;
|
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 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 message: Obj = kwargs.get(Qstr::MP_QSTR_message)?;
|
||||||
let amount: Option<Obj> = kwargs.get(Qstr::MP_QSTR_amount)?.try_into_option()?;
|
let amount: Option<Obj> = kwargs.get(Qstr::MP_QSTR_amount)?.try_into_option()?;
|
||||||
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;
|
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(
|
let layout = ModelUI::flow_confirm_output(
|
||||||
title,
|
title,
|
||||||
subtitle,
|
subtitle,
|
||||||
|
description,
|
||||||
message,
|
message,
|
||||||
amount,
|
amount,
|
||||||
chunkify,
|
chunkify,
|
||||||
@ -1338,6 +1341,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
|
|||||||
/// summary_br_code: ButtonRequestType | None = None,
|
/// summary_br_code: ButtonRequestType | None = None,
|
||||||
/// summary_br_name: str | None = None,
|
/// summary_br_name: str | None = None,
|
||||||
/// cancel_text: str | None = None,
|
/// cancel_text: str | None = None,
|
||||||
|
/// description: str | None = None,
|
||||||
/// ) -> LayoutObj[UiResult]:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""
|
/// """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(),
|
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(
|
fn flow_confirm_output(
|
||||||
_title: Option<TString<'static>>,
|
_title: Option<TString<'static>>,
|
||||||
_subtitle: Option<TString<'static>>,
|
_subtitle: Option<TString<'static>>,
|
||||||
|
_description: Option<TString<'static>>,
|
||||||
_message: Obj,
|
_message: Obj,
|
||||||
_amount: Option<Obj>,
|
_amount: Option<Obj>,
|
||||||
_chunkify: bool,
|
_chunkify: bool,
|
||||||
|
@ -678,6 +678,7 @@ impl FirmwareUI for UICaesar {
|
|||||||
fn flow_confirm_output(
|
fn flow_confirm_output(
|
||||||
_title: Option<TString<'static>>,
|
_title: Option<TString<'static>>,
|
||||||
_subtitle: Option<TString<'static>>,
|
_subtitle: Option<TString<'static>>,
|
||||||
|
_description: Option<TString<'static>>,
|
||||||
_message: Obj,
|
_message: Obj,
|
||||||
_amount: Option<Obj>,
|
_amount: Option<Obj>,
|
||||||
_chunkify: bool,
|
_chunkify: bool,
|
||||||
|
@ -510,6 +510,7 @@ impl FirmwareUI for UIDelizia {
|
|||||||
fn flow_confirm_output(
|
fn flow_confirm_output(
|
||||||
title: Option<TString<'static>>,
|
title: Option<TString<'static>>,
|
||||||
subtitle: Option<TString<'static>>,
|
subtitle: Option<TString<'static>>,
|
||||||
|
description: Option<TString<'static>>,
|
||||||
message: Obj,
|
message: Obj,
|
||||||
amount: Option<Obj>,
|
amount: Option<Obj>,
|
||||||
chunkify: bool,
|
chunkify: bool,
|
||||||
@ -529,13 +530,14 @@ impl FirmwareUI for UIDelizia {
|
|||||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
let address_title = address_title.unwrap_or(TR::words__address.into());
|
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 =
|
||||||
.with_subtitle(subtitle)
|
ConfirmValue::new(title.unwrap_or(TString::empty()), message, description)
|
||||||
.with_menu_button()
|
.with_subtitle(subtitle)
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_menu_button()
|
||||||
.with_chunkify(chunkify)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_text_mono(text_mono)
|
.with_chunkify(chunkify)
|
||||||
.with_swipe_up();
|
.with_text_mono(text_mono)
|
||||||
|
.with_swipe_up();
|
||||||
|
|
||||||
let confirm_amount = amount.map(|amount| {
|
let confirm_amount = amount.map(|amount| {
|
||||||
ConfirmValue::new(TR::words__amount.into(), amount, None)
|
ConfirmValue::new(TR::words__amount.into(), amount, None)
|
||||||
|
@ -160,6 +160,7 @@ pub trait FirmwareUI {
|
|||||||
fn flow_confirm_output(
|
fn flow_confirm_output(
|
||||||
title: Option<TString<'static>>,
|
title: Option<TString<'static>>,
|
||||||
subtitle: Option<TString<'static>>,
|
subtitle: Option<TString<'static>>,
|
||||||
|
description: Option<TString<'static>>,
|
||||||
message: Obj, // TODO: replace Obj
|
message: Obj, // TODO: replace Obj
|
||||||
amount: Option<Obj>, // TODO: replace Obj
|
amount: Option<Obj>, // TODO: replace Obj
|
||||||
chunkify: bool,
|
chunkify: bool,
|
||||||
|
@ -327,6 +327,7 @@ def flow_confirm_output(
|
|||||||
summary_br_code: ButtonRequestType | None = None,
|
summary_br_code: ButtonRequestType | None = None,
|
||||||
summary_br_name: str | None = None,
|
summary_br_name: str | None = None,
|
||||||
cancel_text: str | None = None,
|
cancel_text: str | None = None,
|
||||||
|
description: str | None = None,
|
||||||
) -> LayoutObj[UiResult]:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""
|
"""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: str | None = None,
|
||||||
source_account_path: str | None = None,
|
source_account_path: str | None = None,
|
||||||
cancel_text: str | None = None,
|
cancel_text: str | None = None,
|
||||||
|
description: str | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
if address_label is not None:
|
if address_label is not None:
|
||||||
title = address_label
|
title = address_label
|
||||||
@ -407,6 +408,7 @@ async def confirm_output(
|
|||||||
summary_br_name=None,
|
summary_br_name=None,
|
||||||
summary_br_code=None,
|
summary_br_code=None,
|
||||||
cancel_text=cancel_text,
|
cancel_text=cancel_text,
|
||||||
|
description=description,
|
||||||
),
|
),
|
||||||
br_name=None,
|
br_name=None,
|
||||||
)
|
)
|
||||||
@ -789,6 +791,7 @@ if not utils.BITCOIN_ONLY:
|
|||||||
summary_br_name="confirm_total",
|
summary_br_name="confirm_total",
|
||||||
summary_br_code=ButtonRequestType.SignTx,
|
summary_br_code=ButtonRequestType.SignTx,
|
||||||
cancel_text=TR.buttons__cancel,
|
cancel_text=TR.buttons__cancel,
|
||||||
|
description=None,
|
||||||
),
|
),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
@ -835,6 +838,7 @@ if not utils.BITCOIN_ONLY:
|
|||||||
summary_br_name="confirm_total",
|
summary_br_name="confirm_total",
|
||||||
summary_br_code=ButtonRequestType.SignTx,
|
summary_br_code=ButtonRequestType.SignTx,
|
||||||
cancel_text=TR.buttons__cancel, # cancel staking
|
cancel_text=TR.buttons__cancel, # cancel staking
|
||||||
|
description=None,
|
||||||
),
|
),
|
||||||
br_name=None,
|
br_name=None,
|
||||||
)
|
)
|
||||||
@ -877,14 +881,19 @@ if not utils.BITCOIN_ONLY:
|
|||||||
) -> None:
|
) -> None:
|
||||||
(address_title, address) = stake_item
|
(address_title, address) = stake_item
|
||||||
summary_items = (amount_item, fee_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(
|
await raise_if_not_confirmed(
|
||||||
trezorui_api.flow_confirm_output(
|
trezorui_api.flow_confirm_output(
|
||||||
title=title,
|
title=title,
|
||||||
subtitle=None,
|
subtitle=None,
|
||||||
message=message,
|
description=description,
|
||||||
|
message=vote_account,
|
||||||
amount=None,
|
amount=None,
|
||||||
chunkify=False,
|
chunkify=True,
|
||||||
text_mono=False,
|
text_mono=True,
|
||||||
account=account,
|
account=account,
|
||||||
account_path=account_path,
|
account_path=account_path,
|
||||||
br_code=ButtonRequestType.SignTx,
|
br_code=ButtonRequestType.SignTx,
|
||||||
|
Loading…
Reference in New Issue
Block a user