1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +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,
hold: bool = False,
info_items: Iterable[tuple[str, str]] | None = None,
chunkify_info: bool = False,
) -> None:
"""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]
await ctx_wait(
RustLayout(
trezorui2.confirm_action(
trezorui2.confirm_blob(
title=info_title.upper(),
action=info_value,
data=info_value,
description=description,
extra=None,
verb="",
verb_cancel="<",
hold=False,
reverse=False,
chunkify=chunkify_info,
)
)
)
@ -1076,9 +1078,9 @@ async def confirm_ethereum_staking_tx(
address: str,
address_title: str,
info_items: Iterable[tuple[str, str]],
chunkify: bool = False,
br_type: str = "confirm_ethereum_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
chunkify: bool = False,
) -> None:
# intro
@ -1090,6 +1092,7 @@ async def confirm_ethereum_staking_tx(
br_code,
verb=verb,
info_items=((address_title, address),),
chunkify_info=chunkify,
)
# confirmation

View File

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