From 5b52db1ed398c9a8d225668eb9c1e6b5eb783d92 Mon Sep 17 00:00:00 2001 From: grdddj Date: Tue, 7 Nov 2023 10:30:43 +0100 Subject: [PATCH] chore(core): decrease code-size a little bit [no changelog] --- core/src/apps/misc/get_ecdh_session_key.py | 2 +- core/src/trezor/ui/layouts/tr/__init__.py | 5 ++--- core/src/trezor/ui/layouts/tt/__init__.py | 21 ++++++++++----------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/core/src/apps/misc/get_ecdh_session_key.py b/core/src/apps/misc/get_ecdh_session_key.py index 5308fe6b26..8fd0caab68 100644 --- a/core/src/apps/misc/get_ecdh_session_key.py +++ b/core/src/apps/misc/get_ecdh_session_key.py @@ -33,7 +33,7 @@ async def get_ecdh_session_key(msg: GetECDHSessionKey) -> ECDHSessionKey: await confirm_address( f"Decrypt {proto}", serialize_identity_without_proto(msg_identity), - None, + "", ) # END require_confirm_ecdh_session_key diff --git a/core/src/trezor/ui/layouts/tr/__init__.py b/core/src/trezor/ui/layouts/tr/__init__.py index e10086862c..5c00508148 100644 --- a/core/src/trezor/ui/layouts/tr/__init__.py +++ b/core/src/trezor/ui/layouts/tr/__init__.py @@ -765,7 +765,7 @@ async def confirm_blob( br_type: str, title: str, data: bytes | str, - description: str | None = None, + description: str = "", verb: str = "CONFIRM", verb_cancel: str | None = "", # icon hold: bool = False, @@ -774,7 +774,6 @@ async def confirm_blob( chunkify: bool = False, ) -> None: title = title.upper() - description = description or "" layout = RustLayout( trezorui2.confirm_blob( title=title, @@ -848,7 +847,7 @@ async def _confirm_ask_pagination( def confirm_address( title: str, address: str, - description: str | None = "Address:", + description: str = "Address:", br_type: str = "confirm_address", br_code: ButtonRequestType = BR_TYPE_OTHER, ) -> Awaitable[None]: diff --git a/core/src/trezor/ui/layouts/tt/__init__.py b/core/src/trezor/ui/layouts/tt/__init__.py index 48b2a72c2c..a53f23c984 100644 --- a/core/src/trezor/ui/layouts/tt/__init__.py +++ b/core/src/trezor/ui/layouts/tt/__init__.py @@ -744,7 +744,7 @@ async def confirm_blob( br_type: str, title: str, data: bytes | str, - description: str | None = None, + description: str = "", verb: str = "CONFIRM", verb_cancel: str | None = None, hold: bool = False, @@ -753,7 +753,6 @@ async def confirm_blob( chunkify: bool = False, ) -> None: title = title.upper() - description = description or "" layout = RustLayout( trezorui2.confirm_blob( title=title, @@ -1019,11 +1018,11 @@ async def confirm_metadata( async def confirm_replacement(title: str, txid: str) -> None: await confirm_blob( - title=title.upper(), - data=txid, - description="Transaction ID:", - verb="CONTINUE", - br_type="confirm_replacement", + "confirm_replacement", + title.upper(), + txid, + "Transaction ID:", + "CONTINUE", br_code=ButtonRequestType.SignTx, ) @@ -1148,10 +1147,10 @@ async def confirm_sign_identity( proto: str, identity: str, challenge_visual: str | None ) -> None: await confirm_blob( - title=f"Sign {proto}", - data=identity, - description=challenge_visual + "\n" if challenge_visual else "", - br_type="sign_identity", + "sign_identity", + f"Sign {proto}", + identity, + challenge_visual + "\n" if challenge_visual else "", br_code=BR_TYPE_OTHER, )