What changed, and why it matters
This commit is a straightforward internal code cleanup. It introduces a new type alias called StrPropertyType for UI properties that are always text strings (never raw bytes), and replaces some str(x) conversions with x or "" to handle possible None values more cleanly. There is no indication this fixes a security bug or changes user-visible behavior.
No security action required. Treat as normal refactoring and continue routine review.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds StrPropertyType = tuple[str | None, str | None, bool | None] alongside the existing PropertyType which allows StrOrBytes in the second element. It then updates type annotations across Bitcoin, Cardano, Ethereum, Ripple, Solana, and several UI layout backends (bolt, caesar, delizia, eckhart) to use StrPropertyType where only string values are expected. It also replaces str(x) calls with x or “” in a few places to avoid converting None to the literal string “None”. The change is purely a refactor with no functional security fix evident from the diff.
Changed components
core/embed/rust/src/ui/api/firmware_micropython.rscore/mocks/generated/trezorui_api.pyicore/src/apps/bitcoin/sign_tx/layout.pycore/src/apps/cardano/layout.pycore/src/apps/ethereum/helpers.pycore/src/apps/ethereum/layout.pycore/src/apps/ethereum/sign_tx.pycore/src/apps/ripple/layout.pycore/src/apps/solana/layout.pycore/src/trezor/ui/layouts/bolt/__init__.pycore/src/trezor/ui/layouts/caesar/__init__.pycore/src/trezor/ui/layouts/common.pycore/src/trezor/ui/layouts/delizia/__init__.pycore/src/trezor/ui/layouts/eckhart/__init__.pyInspect captured patch +96 / −93
diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs
index aa697b63..3c130481 100644
--- a/core/embed/rust/src/ui/api/firmware_micropython.rs
+++ b/core/embed/rust/src/ui/api/firmware_micropython.rs
@@ -1368,6 +1368,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// from trezor.enums import ButtonRequestType, RecoveryType
///
/// PropertyType = tuple[str | None, StrOrBytes | None, bool | None]
+ /// StrPropertyType = tuple[str | None, str | None, bool | None]
/// T = TypeVar("T")
///
/// class LayoutObj(Generic[T]):
diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi
index 65f30ccb..967a405e 100644
--- a/core/mocks/generated/trezorui_api.pyi
+++ b/core/mocks/generated/trezorui_api.pyi
@@ -3,6 +3,7 @@ from buffer_types import *
from trezor import utils
from trezor.enums import ButtonRequestType, RecoveryType
PropertyType = tuple[str | None, StrOrBytes | None, bool | None]
+StrPropertyType = tuple[str | None, str | None, bool | None]
T = TypeVar("T")
diff --git a/core/src/apps/bitcoin/sign_tx/layout.py b/core/src/apps/bitcoin/sign_tx/layout.py
index d088bb05..f0a1d683 100644
--- a/core/src/apps/bitcoin/sign_tx/layout.py
+++ b/core/src/apps/bitcoin/sign_tx/layout.py
@@ -22,7 +22,7 @@ if TYPE_CHECKING:
from trezor.enums import AmountUnit
from trezor.messages import PaymentRequest, TxOutput
- from trezor.ui.layouts import PropertyType
+ from trezor.ui.layouts import StrPropertyType
from apps.common.coininfo import CoinInfo
from apps.common.paths import Bip32Path
@@ -207,7 +207,7 @@ async def show_payment_request_details(
account = account_label(coin, address_n)
account_path = address_n_to_str(address_n) if address_n else None
- account_items: list[PropertyType] = []
+ account_items: list[StrPropertyType] = []
if account:
account_items.append((TR.words__account, account, True))
if account_path:
diff --git a/core/src/apps/cardano/layout.py b/core/src/apps/cardano/layout.py
index bc4eaf0d..7623a919 100644
--- a/core/src/apps/cardano/layout.py
+++ b/core/src/apps/cardano/layout.py
@@ -31,7 +31,7 @@ if TYPE_CHECKING:
from trezor import messages
from trezor.enums import CardanoNativeScriptHashDisplayFormat
from trezor.messages import PaymentRequest
- from trezor.ui.layouts import PropertyType
+ from trezor.ui.layouts import PropertyType, StrPropertyType
from apps.common.paths import Bip32Path
@@ -1250,7 +1250,7 @@ async def require_confirm_payment_request(
raise wire.DataError("Unrecognized memo type in payment request memo.")
account_path = address_n_to_str(address_n) if address_n else None
- account_items: list[PropertyType] = []
+ account_items: list[StrPropertyType] = []
if account_path:
account_items.append((TR.address_details__derivation_path, account_path, True))
diff --git a/core/src/apps/ethereum/helpers.py b/core/src/apps/ethereum/helpers.py
index 87e172eb..952ffcb6 100644
--- a/core/src/apps/ethereum/helpers.py
+++ b/core/src/apps/ethereum/helpers.py
@@ -10,7 +10,7 @@ if TYPE_CHECKING:
from typing import Iterable
from trezor.messages import EthereumFieldType, EthereumTokenInfo
- from trezor.ui.layouts import PropertyType
+ from trezor.ui.layouts import StrPropertyType
from .networks import EthereumNetworkInfo
@@ -133,7 +133,7 @@ def decode_typed_data(data: AnyBytes, type_name: str) -> str:
def get_fee_items_regular(
gas_price: int, gas_limit: int, network: EthereumNetworkInfo
-) -> Iterable[PropertyType]:
+) -> Iterable[StrPropertyType]:
# regular
gas_limit_str = TR.ethereum__units_template.format(gas_limit)
gas_price_str = format_ethereum_amount(
@@ -151,7 +151,7 @@ def get_fee_items_eip1559(
max_priority_fee: int,
gas_limit: int,
network: EthereumNetworkInfo,
-) -> Iterable[PropertyType]:
+) -> Iterable[StrPropertyType]:
# EIP-1559
gas_limit_str = TR.ethereum__units_template.format(gas_limit)
max_gas_fee_str = format_ethereum_amount(
diff --git a/core/src/apps/ethereum/layout.py b/core/src/apps/ethereum/layout.py
index 892910fb..1f6ac338 100644
--- a/core/src/apps/ethereum/layout.py
+++ b/core/src/apps/ethereum/layout.py
@@ -27,7 +27,7 @@ if TYPE_CHECKING:
EthereumTokenInfo,
PaymentRequest,
)
- from trezor.ui.layouts import PropertyType
+ from trezor.ui.layouts import PropertyType, StrPropertyType
async def require_confirm_approve(
@@ -115,7 +115,7 @@ async def require_confirm_payment_request(
verified_payment_req: PaymentRequest,
address_n: list[int],
maximum_fee: str,
- fee_info_items: Iterable[PropertyType],
+ fee_info_items: Iterable[StrPropertyType],
chain_id: int,
network: EthereumNetworkInfo,
token: EthereumTokenInfo | None,
@@ -163,7 +163,7 @@ async def require_confirm_payment_request(
raise wire.DataError("Unrecognized memo type in payment request memo.")
account, account_path = get_account_and_path(address_n)
- account_items: list[PropertyType] = []
+ account_items: list[StrPropertyType] = []
if account:
account_items.append((TR.words__account, account, True))
if account_path:
diff --git a/core/src/apps/ethereum/sign_tx.py b/core/src/apps/ethereum/sign_tx.py
index 9dd7de13..d7b24de0 100644
--- a/core/src/apps/ethereum/sign_tx.py
+++ b/core/src/apps/ethereum/sign_tx.py
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
EthereumTokenInfo,
EthereumTxAck,
)
- from trezor.ui.layouts import PropertyType
+ from trezor.ui.layouts import PropertyType, StrPropertyType
from apps.common.keychain import Keychain
from apps.common.payment_request import PaymentRequestVerifier
@@ -149,7 +149,7 @@ async def confirm_tx_data(
defs: Definitions,
address_bytes: bytes,
maximum_fee: str,
- fee_items: Iterable[PropertyType],
+ fee_items: Iterable[StrPropertyType],
data_total_len: int,
payment_req_verifier: PaymentRequestVerifier | None,
) -> None:
diff --git a/core/src/apps/ripple/layout.py b/core/src/apps/ripple/layout.py
index 301a6f4e..8dd7286b 100644
--- a/core/src/apps/ripple/layout.py
+++ b/core/src/apps/ripple/layout.py
@@ -9,7 +9,7 @@ from .helpers import DECIMALS
if TYPE_CHECKING:
from trezor.messages import PaymentRequest
- from trezor.ui.layouts import PropertyType
+ from trezor.ui.layouts import StrPropertyType
from apps.common.paths import Bip32Path
@@ -85,7 +85,7 @@ async def require_confirm_payment_request(
raise wire.DataError("Unrecognized memo type in payment request memo.")
account_path = address_n_to_str(address_n) if address_n else None
- account_items: list[PropertyType] = []
+ account_items: list[StrPropertyType] = []
if account_path:
account_items.append((TR.address_details__derivation_path, account_path, True))
diff --git a/core/src/apps/solana/layout.py b/core/src/apps/solana/layout.py
index 794ea4be..10806164 100644
--- a/core/src/apps/solana/layout.py
+++ b/core/src/apps/solana/layout.py
@@ -22,7 +22,7 @@ if TYPE_CHECKING:
from typing import Sequence
from trezor.messages import PaymentRequest, SolanaTokenInfo
- from trezor.ui.layouts import PropertyType
+ from trezor.ui.layouts import PropertyType, StrPropertyType
from .definitions import Definitions
from .transaction import Fee
@@ -45,7 +45,7 @@ def _format_path(path: list[int]) -> str:
def _get_address_reference_props(
address: AddressReference, display_name: str
-) -> Sequence[PropertyType]:
+) -> Sequence[StrPropertyType]:
return (
(
TR.solana__is_provided_via_lookup_table_template.format(display_name),
@@ -329,7 +329,7 @@ async def confirm_token_transfer(
fee: Fee,
blockhash: bytes,
) -> None:
- items: list[PropertyType] = []
+ items: list[StrPropertyType] = []
if token_account != destination_account:
items.append(
(TR.solana__associated_token_account, base58.encode(token_account), True)
@@ -358,8 +358,8 @@ async def confirm_token_transfer(
await confirm_custom_transaction(amount, decimals, token.symbol, fee)
-def _fee_ui_info(fee: Fee | None) -> tuple[str, str, list[PropertyType]]:
- fee_items: list[PropertyType] = []
+def _fee_ui_info(fee: Fee | None) -> tuple[str, str, list[StrPropertyType]]:
+ fee_items: list[StrPropertyType] = []
if fee is None:
fee_title = f"{TR.solana__max_fees_rent}:"
fee_str = TR.words__unknown
@@ -572,7 +572,7 @@ async def confirm_payment_request(
raise wire.DataError("Unrecognized memo type in payment request memo.")
account_path = address_n_to_str(address_n) if address_n else None
- account_items: list[PropertyType] = []
+ account_items: list[StrPropertyType] = []
if account_path:
account_items.append((TR.address_details__derivation_path, account_path, True))
diff --git a/core/src/trezor/ui/layouts/bolt/__init__.py b/core/src/trezor/ui/layouts/bolt/__init__.py
index 6e86b20c..3d55a54f 100644
--- a/core/src/trezor/ui/layouts/bolt/__init__.py
+++ b/core/src/trezor/ui/layouts/bolt/__init__.py
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
from trezor.messages import StellarAsset
- from ..common import ExceptionType, PropertyType
+ from ..common import ExceptionType, PropertyType, StrPropertyType
from ..slip24 import Refund, Trade
@@ -492,9 +492,9 @@ async def confirm_payment_request(
texts: Iterable[tuple[str | None, str]],
refunds: Iterable[Refund],
trades: list[Trade],
- account_items: list[PropertyType] | None,
+ account_items: list[StrPropertyType] | None,
transaction_fee: str | None,
- fee_info_items: Iterable[PropertyType] | None,
+ fee_info_items: Iterable[StrPropertyType] | None,
extra_menu_items: list[tuple[str, str]] | None = None,
) -> None:
from ..slip24 import is_swap
@@ -512,7 +512,7 @@ async def confirm_payment_request(
"confirm_payment_request",
)
- menu_items: list[PropertyType] = []
+ menu_items: list[StrPropertyType] = []
if recipient_address is not None:
menu_items.append((TR.address__title_provider_address, recipient_address, None))
for refund in refunds:
@@ -834,7 +834,7 @@ def confirm_value(
subtitle: str | None = None,
hold: bool = False,
is_data: bool = True,
- info_items: Iterable[PropertyType] | None = None,
+ info_items: Iterable[StrPropertyType] | None = None,
info_title: str | None = None,
chunkify: bool = False,
chunkify_info: bool = False,
@@ -1219,7 +1219,7 @@ if not utils.BITCOIN_ONLY:
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
# intro
- items: list[PropertyType] = [("", address, None)]
+ items: list[StrPropertyType] = [("", address, None)]
await confirm_value(
title,
intro_question,
@@ -1268,7 +1268,7 @@ if not utils.BITCOIN_ONLY:
def confirm_solana_recipient(
recipient: str,
title: str,
- items: Iterable[PropertyType] = (),
+ items: Iterable[StrPropertyType] = (),
br_name: str = "confirm_solana_recipient",
br_code: ButtonRequestType = ButtonRequestType.ConfirmOutput,
) -> Awaitable[None]:
@@ -1313,11 +1313,11 @@ if not utils.BITCOIN_ONLY:
account: str,
account_path: str,
vote_account: str,
- stake_item: PropertyType | None,
- amount_item: PropertyType | None,
- fee_item: PropertyType,
- fee_details: Iterable[PropertyType],
- blockhash_item: PropertyType,
+ stake_item: StrPropertyType | None,
+ amount_item: StrPropertyType | None,
+ fee_item: StrPropertyType,
+ fee_details: Iterable[StrPropertyType],
+ blockhash_item: StrPropertyType,
br_name: str = "confirm_solana_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
@@ -1356,10 +1356,10 @@ if not utils.BITCOIN_ONLY:
await with_info(confirm_layout, info_layout, br_name, br_code)
await _confirm_summary(
- amount=str(amount),
+ amount=amount or "",
amount_label=amount_label,
- fee=str(fee),
- fee_label=str(fee_label),
+ fee=fee or "",
+ fee_label=fee_label or "",
account_items=None,
title=title,
extra_title=TR.confirm_total__title_fee,
diff --git a/core/src/trezor/ui/layouts/caesar/__init__.py b/core/src/trezor/ui/layouts/caesar/__init__.py
index dbb37034..3c35a215 100644
--- a/core/src/trezor/ui/layouts/caesar/__init__.py
+++ b/core/src/trezor/ui/layouts/caesar/__init__.py
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
from trezor.messages import StellarAsset
- from ..common import ExceptionType, PropertyType
+ from ..common import ExceptionType, PropertyType, StrPropertyType
from ..menu import Details
from ..slip24 import Refund, Trade
@@ -557,9 +557,9 @@ async def confirm_payment_request(
texts: Iterable[tuple[str | None, str]],
refunds: Iterable[Refund],
trades: list[Trade],
- account_items: list[PropertyType],
+ account_items: list[StrPropertyType],
transaction_fee: str | None,
- fee_info_items: Iterable[PropertyType] | None,
+ fee_info_items: Iterable[StrPropertyType] | None,
extra_menu_items: list[tuple[str, str]] | None = None,
) -> None:
from trezor.ui.layouts.menu import Menu, confirm_with_menu
@@ -584,7 +584,7 @@ async def confirm_payment_request(
create_details(TR.address__title_provider_address, recipient_address)
)
for refund in refunds:
- refund_account_items: list[PropertyType] = [("", refund.address, None)]
+ refund_account_items: list[StrPropertyType] = [("", refund.address, None)]
if refund.account:
refund_account_items.append((TR.words__account, refund.account, None))
if refund.account_path:
@@ -931,7 +931,7 @@ def confirm_value(
verb_cancel: str | None = None,
hold: bool = False,
is_data: bool = True,
- info_items: Iterable[PropertyType] | None = None,
+ info_items: Iterable[StrPropertyType] | None = None,
chunkify: bool = False,
chunkify_info: bool = False,
cancel: bool = False,
@@ -983,7 +983,7 @@ def confirm_value(
)
menu = Menu.root(
- Details.from_layout(str(name), item_factory(str(name), str(value)))
+ Details.from_layout(name or "", item_factory(name or "", value or ""))
for name, value, _is_data in info_items
)
return confirm_with_menu(main, menu, br_name, br_code)
@@ -1048,7 +1048,7 @@ async def confirm_trade(
external_menu=True,
)
- account_items: list[PropertyType] = [("", trade.address, None)]
+ account_items: list[StrPropertyType] = [("", trade.address, None)]
if trade.account:
account_items.append((TR.words__account, trade.account, None))
if trade.account_path:
@@ -1209,7 +1209,7 @@ if not utils.BITCOIN_ONLY:
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
# intro
- items: list[PropertyType] = [(address_title, address, None)]
+ items: list[StrPropertyType] = [(address_title, address, None)]
await confirm_value(
title,
intro_question,
@@ -1255,7 +1255,7 @@ if not utils.BITCOIN_ONLY:
def confirm_solana_recipient(
recipient: str,
title: str,
- items: Iterable[PropertyType] = (),
+ items: Iterable[StrPropertyType] = (),
br_name: str = "confirm_solana_recipient",
br_code: ButtonRequestType = ButtonRequestType.ConfirmOutput,
) -> Awaitable[None]:
@@ -1301,11 +1301,11 @@ if not utils.BITCOIN_ONLY:
account: str,
account_path: str,
vote_account: str,
- stake_item: PropertyType | None,
- amount_item: PropertyType | None,
- fee_item: PropertyType,
- fee_details: list[PropertyType],
- blockhash_item: PropertyType,
+ stake_item: StrPropertyType | None,
+ amount_item: StrPropertyType | None,
+ fee_item: StrPropertyType,
+ fee_details: list[StrPropertyType],
+ blockhash_item: StrPropertyType,
br_name: str = "confirm_solana_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
@@ -1319,8 +1319,11 @@ if not utils.BITCOIN_ONLY:
else:
amount_label, amount, _is_data = amount_item
fee_label, fee, _is_data = fee_item
+ fee_label = fee_label or ""
+ fee = fee or ""
+ amount = amount or ""
- items: list[PropertyType] = []
+ items: list[StrPropertyType] = []
if stake_item is not None:
items.append(stake_item)
items.append(blockhash_item)
@@ -1340,18 +1343,18 @@ if not utils.BITCOIN_ONLY:
external_menu=True,
)
menu = Menu.root(
- create_details(str(name), str(value)) for name, value, _is_data in items
+ create_details(name or "", value or "") for name, value, _is_data in items
)
await confirm_with_menu(main, menu, br_name, br_code)
main = trezorui_api.confirm_summary(
- amount=str(amount),
+ amount=amount,
amount_label=amount_label,
- fee=str(fee),
- fee_label=str(fee_label),
+ fee=fee,
+ fee_label=fee_label,
external_menu=True,
)
- account_details: list[PropertyType] = [
+ account_details: list[StrPropertyType] = [
(f"{TR.words__account}:", account, None),
(TR.address_details__derivation_path_colon, account_path, None),
]
@@ -1359,7 +1362,7 @@ if not utils.BITCOIN_ONLY:
(TR.confirm_total__title_fee, fee_details),
(TR.address_details__account_info, account_details),
]
- menu = Menu.root(create_details(str(name), props) for name, props in iter)
+ menu = Menu.root(create_details(name, props) for name, props in iter)
await confirm_with_menu(main, menu, br_name, br_code)
def confirm_cardano_tx(
@@ -1949,7 +1952,7 @@ def confirm_firmware_update(description: str, fingerprint: str) -> Awaitable[Non
)
-def create_details(name: str, value: list[PropertyType] | str) -> Details:
+def create_details(name: str, value: list[StrPropertyType] | str) -> Details:
from trezor.ui.layouts.menu import Details
return Details.from_layout(
diff --git a/core/src/trezor/ui/layouts/common.py b/core/src/trezor/ui/layouts/common.py
index f68caf06..e194db94 100644
--- a/core/src/trezor/ui/layouts/common.py
+++ b/core/src/trezor/ui/layouts/common.py
@@ -8,7 +8,7 @@ from trezor.wire import ActionCancelled
if TYPE_CHECKING:
from typing import Any, Awaitable, Callable, Coroutine, Literal, TypeVar, overload
- from trezorui_api import PropertyType # noqa: F401
+ from trezorui_api import PropertyType, StrPropertyType # noqa: F401
ExceptionType = BaseException | type[BaseException]
diff --git a/core/src/trezor/ui/layouts/delizia/__init__.py b/core/src/trezor/ui/layouts/delizia/__init__.py
index 78fa3915..2135fa2c 100644
--- a/core/src/trezor/ui/layouts/delizia/__init__.py
+++ b/core/src/trezor/ui/layouts/delizia/__init__.py
@@ -19,7 +19,7 @@ if TYPE_CHECKING:
from trezor.messages import StellarAsset
- from ..common import ExceptionType, PropertyType
+ from ..common import ExceptionType, PropertyType, StrPropertyType
from ..menu import Details
from ..slip24 import Refund, Trade
@@ -497,9 +497,9 @@ async def confirm_payment_request(
texts: Iterable[tuple[str | None, str]],
refunds: Iterable[Refund],
trades: list[Trade],
- account_items: list[PropertyType] | None,
+ account_items: list[StrPropertyType] | None,
transaction_fee: str | None,
- fee_info_items: Iterable[PropertyType] | None,
+ fee_info_items: Iterable[StrPropertyType] | None,
extra_menu_items: list[tuple[str, str]] | None = None,
) -> None:
from trezor.ui.layouts.menu import Menu, confirm_with_menu
@@ -536,7 +536,7 @@ async def confirm_payment_request(
create_details(TR.address__title_provider_address, recipient_address)
)
for refund in refunds:
- refund_account_items: list[PropertyType] = [("", refund.address, None)]
+ refund_account_items: list[StrPropertyType] = [("", refund.address, None)]
if refund.account:
refund_account_items.append((TR.words__account, refund.account, None))
if refund.account_path:
@@ -600,7 +600,7 @@ async def confirm_output(
title = TR.send__title_sending_to
if amount is not None:
- account_properties: list[PropertyType] = []
+ account_properties: list[StrPropertyType] = []
if source_account:
account_properties.append((TR.words__account, source_account, None))
if source_account_path:
@@ -847,7 +847,7 @@ def confirm_value(
is_data: bool = True,
chunkify: bool = False,
info_items: (
- Iterable[tuple[str, StrOrBytes | list[PropertyType], str | None]] | None
+ Iterable[tuple[str, str | list[StrPropertyType], str | None]] | None
) = None,
cancel: bool = False,
cancel_text: str | None = None,
@@ -873,9 +873,7 @@ def confirm_value(
info_items = info_items or []
menu_items = []
for name, p, page_title in info_items:
- menu_items.append(
- create_details(str(name), p if isinstance(p, list) else str(p), page_title)
- )
+ menu_items.append(create_details(name, p, page_title))
menu = Menu.root(
menu_items,
cancel=(cancel_text or TR.buttons__cancel),
@@ -1000,7 +998,7 @@ async def confirm_trade(
buy_amount=trade.buy_amount,
)
- account_items: list[PropertyType] = [("", trade.address, None)]
+ account_items: list[StrPropertyType] = [("", trade.address, None)]
if trade.account:
account_items.append((TR.words__account, trade.account, None))
if trade.account_path:
@@ -1266,7 +1264,7 @@ if not utils.BITCOIN_ONLY:
def confirm_solana_recipient(
recipient: str,
title: str,
- items: Iterable[PropertyType] = (),
+ items: Iterable[StrPropertyType] = (),
br_name: str = "confirm_solana_recipient",
br_code: ButtonRequestType = ButtonRequestType.ConfirmOutput,
) -> Awaitable[ui.UiResult]:
@@ -1277,7 +1275,7 @@ if not utils.BITCOIN_ONLY:
br_name=br_name,
br_code=br_code,
verb=TR.buttons__continue,
- info_items=[(str(k), str(v), None) for k, v, _ in items],
+ info_items=[(k or "", v or "", None) for k, v, _ in items],
)
def confirm_solana_tx(
@@ -1310,15 +1308,15 @@ if not utils.BITCOIN_ONLY:
account: str,
account_path: str,
vote_account: str,
- stake_item: PropertyType | None,
- amount_item: PropertyType | None,
- fee_item: PropertyType,
- fee_details: Iterable[PropertyType],
- blockhash_item: PropertyType,
+ stake_item: StrPropertyType | None,
+ amount_item: StrPropertyType | None,
+ fee_item: StrPropertyType,
+ fee_details: Iterable[StrPropertyType],
+ blockhash_item: StrPropertyType,
br_name: str = "confirm_solana_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
- summary_items: list[PropertyType] = []
+ summary_items: list[StrPropertyType] = []
if amount_item:
summary_items.append(amount_item)
summary_items.append(fee_item)
@@ -1869,7 +1867,7 @@ def tutorial(br_code: ButtonRequestType = BR_CODE_OTHER) -> Awaitable[None]:
def create_details(
- name: str, value: list[PropertyType] | str, title: str | None = None
+ name: str, value: list[StrPropertyType] | str, title: str | None = None
) -> Details:
from trezor.ui.layouts.menu import Details
diff --git a/core/src/trezor/ui/layouts/eckhart/__init__.py b/core/src/trezor/ui/layouts/eckhart/__init__.py
index f9fc8cfb..84e16e4f 100644
--- a/core/src/trezor/ui/layouts/eckhart/__init__.py
+++ b/core/src/trezor/ui/layouts/eckhart/__init__.py
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
from trezor.messages import StellarAsset
from trezor.ui.layouts.menu import Details
- from ..common import ExceptionType, PropertyType
+ from ..common import ExceptionType, PropertyType, StrPropertyType
from ..slip24 import Refund, Trade
T = TypeVar("T")
@@ -457,9 +457,9 @@ async def confirm_payment_request(
texts: Iterable[tuple[str | None, str]],
refunds: Iterable[Refund],
trades: list[Trade],
- account_items: list[PropertyType],
+ account_items: list[StrPropertyType],
transaction_fee: str | None,
- fee_info_items: Iterable[PropertyType] | None,
+ fee_info_items: Iterable[StrPropertyType] | None,
extra_menu_items: list[tuple[str, str]] | None = None,
) -> None:
from trezor.ui.layouts.menu import Menu, confirm_with_menu
@@ -500,7 +500,7 @@ async def confirm_payment_request(
create_details(TR.address__title_provider_address, recipient_address)
)
for refund in refunds:
- refund_account_info: list[PropertyType] = [(str(""), refund.address, True)]
+ refund_account_info: list[StrPropertyType] = [("", refund.address, True)]
if refund.account:
refund_account_info.append((TR.words__account, refund.account, True))
if refund.account_path:
@@ -594,7 +594,7 @@ async def confirm_output(
title = TR.send__title_sending_to
if amount is not None:
- account_properties: list[PropertyType] = []
+ account_properties: list[StrPropertyType] = []
if source_account:
account_properties.append((TR.words__wallet, source_account, None))
if source_account_path:
@@ -845,7 +845,7 @@ def confirm_value(
hold: bool = False,
is_data: bool = True,
chunkify: bool = False,
- info_items: Iterable[PropertyType] | None = None,
+ info_items: Iterable[StrPropertyType] | None = None,
info_title: str | None = None,
chunkify_info: bool = False,
warning_footer: str | None = None,
@@ -853,7 +853,7 @@ def confirm_value(
) -> Awaitable[None]:
"""General confirmation dialog, used by many other confirm_* functions."""
- items: list[PropertyType] = list(info_items) if info_items else []
+ items = list(info_items) if info_items else []
info_layout = trezorui_api.show_info_with_cancel(
title=info_title if info_title else TR.words__title_information,
items=items,
@@ -1002,7 +1002,7 @@ def confirm_trade(
back_button=back_button,
)
- account_info: list[PropertyType] = [("", trade.address, True)]
+ account_info: list[StrPropertyType] = [("", trade.address, True)]
if trade.account:
account_info.append((TR.words__account, trade.account, True))
if trade.account_path:
@@ -1287,7 +1287,7 @@ if not utils.BITCOIN_ONLY:
def confirm_solana_recipient(
recipient: str,
title: str,
- items: Iterable[PropertyType] = (),
+ items: Iterable[StrPropertyType] = (),
br_name: str = "confirm_solana_recipient",
br_code: ButtonRequestType = ButtonRequestType.ConfirmOutput,
) -> Awaitable[None]:
@@ -1331,15 +1331,15 @@ if not utils.BITCOIN_ONLY:
account: str,
account_path: str,
vote_account: str,
- stake_item: PropertyType | None,
- amount_item: PropertyType | None,
- fee_item: PropertyType,
- fee_details: Iterable[PropertyType],
- blockhash_item: PropertyType,
+ stake_item: StrPropertyType | None,
+ amount_item: StrPropertyType | None,
+ fee_item: StrPropertyType,
+ fee_details: Iterable[StrPropertyType],
+ blockhash_item: StrPropertyType,
br_name: str = "confirm_solana_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
- summary_items: list[PropertyType] = [fee_item]
+ summary_items: list[StrPropertyType] = [fee_item]
if amount_item:
summary_items.append(amount_item)
await raise_if_not_confirmed(
@@ -1905,7 +1905,7 @@ def tutorial(br_code: ButtonRequestType = BR_CODE_OTHER) -> Awaitable[None]:
def create_details(
name: str,
- value: list[PropertyType] | str,
+ value: list[StrPropertyType] | str,
title: str | None = None,
subtitle: str | None = None,
) -> Details:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.