mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-30 17:21:21 +00:00
feat(core): show ETH account info on model T
This commit is contained in:
parent
a566f122e7
commit
ee256d24af
1
core/.changelog.d/3536.added
Normal file
1
core/.changelog.d/3536.added
Normal file
@ -0,0 +1 @@
|
|||||||
|
[T2T1] Added account info for ETH transactions.
|
@ -815,8 +815,8 @@ if not utils.BITCOIN_ONLY:
|
|||||||
async def confirm_ethereum_tx(
|
async def confirm_ethereum_tx(
|
||||||
recipient: str | None,
|
recipient: str | None,
|
||||||
total_amount: str,
|
total_amount: str,
|
||||||
_account: str | None,
|
account: str | None,
|
||||||
_account_path: str | None,
|
account_path: str | None,
|
||||||
maximum_fee: str,
|
maximum_fee: str,
|
||||||
fee_info_items: Iterable[tuple[str, str]],
|
fee_info_items: Iterable[tuple[str, str]],
|
||||||
is_contract_interaction: bool,
|
is_contract_interaction: bool,
|
||||||
@ -824,41 +824,52 @@ if not utils.BITCOIN_ONLY:
|
|||||||
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
# NOTE: fee_info used so that info button is shown
|
if not is_contract_interaction:
|
||||||
|
description = f"{TR.words__recipient}:"
|
||||||
|
else:
|
||||||
|
description = f"{TR.ethereum__interaction_contract}:" if recipient else None
|
||||||
|
|
||||||
|
address_layout = trezorui_api.confirm_value(
|
||||||
|
title=TR.words__address,
|
||||||
|
description=description,
|
||||||
|
value=recipient or TR.ethereum__new_contract,
|
||||||
|
verb=TR.buttons__continue,
|
||||||
|
verb_cancel=None,
|
||||||
|
info=True,
|
||||||
|
chunkify=(chunkify if recipient else False),
|
||||||
|
)
|
||||||
|
|
||||||
|
account_info_layout = trezorui_api.show_info_with_cancel(
|
||||||
|
title=TR.send__send_from,
|
||||||
|
items=[
|
||||||
|
(f"{TR.words__account}:", account or ""),
|
||||||
|
(f"{TR.address_details__derivation_path}:", account_path or ""),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
total_layout = trezorui_api.confirm_summary(
|
total_layout = trezorui_api.confirm_summary(
|
||||||
amount=total_amount,
|
amount=total_amount,
|
||||||
amount_label=f"{TR.words__amount}:",
|
amount_label=f"{TR.words__amount}:",
|
||||||
fee=maximum_fee,
|
fee=maximum_fee,
|
||||||
fee_label=f"{TR.send__maximum_fee}:",
|
fee_label=f"{TR.send__maximum_fee}:",
|
||||||
title=TR.words__title_summary,
|
title=TR.words__title_summary,
|
||||||
extra_items=fee_info_items,
|
extra_items=fee_info_items, # used so that info button is shown
|
||||||
extra_title=TR.confirm_total__title_fee,
|
extra_title=TR.confirm_total__title_fee,
|
||||||
verb_cancel="^",
|
verb_cancel="^",
|
||||||
)
|
)
|
||||||
info_layout = trezorui_api.show_info_with_cancel(
|
|
||||||
|
fee_info_layout = trezorui_api.show_info_with_cancel(
|
||||||
title=TR.confirm_total__title_fee,
|
title=TR.confirm_total__title_fee,
|
||||||
items=[(f"{k}:", v) for (k, v) in fee_info_items],
|
items=[(f"{k}:", v) for (k, v) in fee_info_items],
|
||||||
)
|
)
|
||||||
|
|
||||||
if not is_contract_interaction:
|
|
||||||
description = TR.words__recipient
|
|
||||||
else:
|
|
||||||
description = TR.ethereum__interaction_contract if recipient else None
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
# Allowing going back and forth between recipient and summary/details
|
await with_info(address_layout, account_info_layout, br_name, br_code)
|
||||||
await confirm_blob(
|
|
||||||
br_name,
|
|
||||||
TR.words__address,
|
|
||||||
recipient or TR.ethereum__new_contract,
|
|
||||||
description=description,
|
|
||||||
verb=TR.buttons__continue,
|
|
||||||
chunkify=(chunkify if recipient else False),
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await with_info(total_layout, info_layout, br_name, br_code)
|
await with_info(total_layout, fee_info_layout, br_name, br_code)
|
||||||
except ActionCancelled:
|
except ActionCancelled:
|
||||||
|
# Allowing going back and forth between recipient and summary
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
@ -398,6 +398,14 @@ class EthereumFlow:
|
|||||||
if cancel:
|
if cancel:
|
||||||
self.debug.press_no()
|
self.debug.press_no()
|
||||||
return
|
return
|
||||||
|
if info:
|
||||||
|
self.debug.press_info()
|
||||||
|
assert TR.words__account in self.debug.read_layout().text_content()
|
||||||
|
assert (
|
||||||
|
TR.address_details__derivation_path
|
||||||
|
in self.debug.read_layout().text_content()
|
||||||
|
)
|
||||||
|
self.debug.press_no()
|
||||||
|
|
||||||
self.debug.press_yes()
|
self.debug.press_yes()
|
||||||
assert (yield).name == "confirm_ethereum_tx"
|
assert (yield).name == "confirm_ethereum_tx"
|
||||||
|
Loading…
Reference in New Issue
Block a user