From c30091b9c56f74e9ef20fc946cef4111268b8475 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 6 Aug 2021 14:12:26 +0200 Subject: [PATCH] refactor(core/stellar): replace confirm_timebounds_stellar with confirm_properties --- core/src/apps/stellar/layout.py | 12 ++++++++++-- core/src/trezor/ui/layouts/tt/altcoin.py | 23 ----------------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/core/src/apps/stellar/layout.py b/core/src/apps/stellar/layout.py index 5247a0653..9b3e98cc3 100644 --- a/core/src/apps/stellar/layout.py +++ b/core/src/apps/stellar/layout.py @@ -5,8 +5,8 @@ from trezor.ui.layouts import ( confirm_address, confirm_blob, confirm_metadata, + confirm_properties, ) -from trezor.ui.layouts.tt.altcoin import confirm_timebounds_stellar from trezor.wire import DataError from . import consts @@ -51,7 +51,15 @@ async def require_confirm_init( async def require_confirm_timebounds(ctx: Context, start: int, end: int) -> None: - await confirm_timebounds_stellar(ctx, start, end) + await confirm_properties( + ctx, + "confirm_timebounds", + title="Confirm timebounds", + props=( + ("Valid from (UTC)", str(start) if start > 0 else "[no restriction]"), + ("Valid to (UTC)", str(end) if end > 0 else "[no restriction]"), + ), + ) async def require_confirm_memo( diff --git a/core/src/trezor/ui/layouts/tt/altcoin.py b/core/src/trezor/ui/layouts/tt/altcoin.py index 8fcacb35f..0aee048f9 100644 --- a/core/src/trezor/ui/layouts/tt/altcoin.py +++ b/core/src/trezor/ui/layouts/tt/altcoin.py @@ -43,29 +43,6 @@ async def confirm_total_ripple( ) -async def confirm_timebounds_stellar( - ctx: wire.GenericContext, start: int, end: int -) -> None: - text = Text("Confirm timebounds", ui.ICON_SEND, ui.GREEN) - text.bold("Valid from (UTC):") - if start: - text.normal(str(start)) - else: - text.mono("[no restriction]") - - text.bold("Valid to (UTC):") - if end: - text.normal(str(end)) - else: - text.mono("[no restriction]") - - await raise_if_cancelled( - interact( - ctx, Confirm(text), "confirm_timebounds", ButtonRequestType.ConfirmOutput - ) - ) - - async def confirm_transfer_binance( ctx: wire.GenericContext, inputs_outputs: Sequence[tuple[str, str, str]] ) -> None: