1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-18 10:32:02 +00:00

feat(core): allow chunkify of Stake address on TS3

This commit is contained in:
obrusvit 2024-02-21 13:17:51 +01:00 committed by Vít Obrusník
parent ebcf3e2db2
commit e602a87c90
2 changed files with 24 additions and 25 deletions

View File

@ -962,6 +962,7 @@ async def confirm_value(
verb: str | None = None, verb: str | None = None,
hold: bool = False, hold: bool = False,
info_items: Iterable[tuple[str, str]] | None = None, info_items: Iterable[tuple[str, str]] | None = None,
chunkify_info: bool = False,
) -> None: ) -> None:
"""General confirmation dialog, used by many other confirm_* functions.""" """General confirmation dialog, used by many other confirm_* functions."""
@ -1019,14 +1020,15 @@ async def confirm_value(
info_title, info_value = info_items_list[0] info_title, info_value = info_items_list[0]
await ctx_wait( await ctx_wait(
RustLayout( RustLayout(
trezorui2.confirm_action( trezorui2.confirm_blob(
title=info_title.upper(), title=info_title.upper(),
action=info_value, data=info_value,
description=description, description=description,
extra=None,
verb="", verb="",
verb_cancel="<", verb_cancel="<",
hold=False, hold=False,
reverse=False, chunkify=chunkify_info,
) )
) )
) )
@ -1076,9 +1078,9 @@ async def confirm_ethereum_staking_tx(
address: str, address: str,
address_title: str, address_title: str,
info_items: Iterable[tuple[str, str]], info_items: Iterable[tuple[str, str]],
chunkify: bool = False,
br_type: str = "confirm_ethereum_staking_tx", br_type: str = "confirm_ethereum_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx, br_code: ButtonRequestType = ButtonRequestType.SignTx,
chunkify: bool = False,
) -> None: ) -> None:
# intro # intro
@ -1090,6 +1092,7 @@ async def confirm_ethereum_staking_tx(
br_code, br_code,
verb=verb, verb=verb,
info_items=((address_title, address),), info_items=((address_title, address),),
chunkify_info=chunkify,
) )
# confirmation # confirmation

View File

@ -861,6 +861,8 @@ def confirm_value(
hold: bool = False, hold: bool = False,
value_text_mono: bool = True, value_text_mono: bool = True,
info_items: Iterable[tuple[str, str]] | None = None, info_items: Iterable[tuple[str, str]] | None = None,
info_title: str | None = None,
chunkify_info: bool = False,
) -> Awaitable[None]: ) -> Awaitable[None]:
"""General confirmation dialog, used by many other confirm_* functions.""" """General confirmation dialog, used by many other confirm_* functions."""
@ -873,8 +875,9 @@ def confirm_value(
info_items = info_items or [] info_items = info_items or []
info_layout = RustLayout( info_layout = RustLayout(
trezorui2.show_info_with_cancel( trezorui2.show_info_with_cancel(
title=TR.words__title_information, title=info_title if info_title else TR.words__title_information,
items=info_items, items=info_items,
chunkify=chunkify_info,
) )
) )
@ -889,6 +892,7 @@ def confirm_value(
verb=verb, verb=verb,
hold=hold, hold=hold,
info_button=bool(info_items), info_button=bool(info_items),
text_mono=value_text_mono,
) )
), ),
info_layout, info_layout,
@ -1039,33 +1043,25 @@ async def confirm_ethereum_staking_tx(
maximum_fee: str, maximum_fee: str,
address: str, address: str,
address_title: str, address_title: str,
info_items: Iterable[tuple[str, str]] | None = None, info_items: Iterable[tuple[str, str]],
chunkify: bool = False, chunkify: bool = False,
br_type: str = "confirm_ethereum_staking_tx", br_type: str = "confirm_ethereum_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx, br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None: ) -> None:
# intro # intro
# NOTE: this layout very similar to `confirm_value` with some adjustments await confirm_value(
msg_layout = RustLayout( title,
trezorui2.confirm_value( intro_question,
title=title, "",
value=intro_question, br_type,
description=None, br_code,
subtitle=None, verb=verb,
verb=verb, value_text_mono=False,
info_button=True, info_items=(("", address),),
text_mono=False, info_title=address_title,
) chunkify_info=chunkify,
) )
info_layout = RustLayout(
trezorui2.show_info_with_cancel(
title=address_title,
items=(("", address),),
chunkify=chunkify,
)
)
await raise_if_not_confirmed(with_info(msg_layout, info_layout, br_type, br_code))
# confirmation # confirmation
if verb == TR.ethereum__staking_claim: if verb == TR.ethereum__staking_claim: