1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-01 18:30:56 +00:00

fix(core): exclude altcoin functions from bitcoinonly build

This commit is contained in:
matejcik 2024-03-07 13:47:22 +01:00 committed by matejcik
parent f34ad3daf1
commit b6e8567a49
4 changed files with 241 additions and 241 deletions

View File

@ -1,7 +1,7 @@
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import trezorui2 import trezorui2
from trezor import TR, io, loop, ui from trezor import TR, io, loop, ui, utils
from trezor.enums import ButtonRequestType from trezor.enums import ButtonRequestType
from trezor.wire import ActionCancelled from trezor.wire import ActionCancelled
from trezor.wire.context import wait as ctx_wait from trezor.wire.context import wait as ctx_wait
@ -1079,128 +1079,128 @@ def confirm_total(
) )
async def confirm_ethereum_staking_tx( if not utils.BITCOIN_ONLY:
title: str,
intro_question: str,
verb: str,
total_amount: str,
maximum_fee: str,
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,
) -> None:
# intro
await confirm_value(
title,
intro_question,
"",
br_type,
br_code,
verb=verb,
info_items=((address_title, address),),
chunkify_info=chunkify,
)
# confirmation async def confirm_ethereum_staking_tx(
if verb == TR.ethereum__staking_claim: title: str,
amount_title = verb intro_question: str,
amount_value = "" verb: str,
else: total_amount: str,
amount_title = TR.words__amount + ":" maximum_fee: str,
amount_value = total_amount address: str,
await raise_if_not_confirmed( address_title: str,
interact( info_items: Iterable[tuple[str, str]],
RustLayout( chunkify: bool = False,
trezorui2.altcoin_tx_summary( br_type: str = "confirm_ethereum_staking_tx",
amount_title=amount_title, br_code: ButtonRequestType = ButtonRequestType.SignTx,
amount_value=amount_value, ) -> None:
fee_title=TR.send__maximum_fee, # intro
fee_value=maximum_fee, await confirm_value(
items=info_items, title,
cancel_cross=True, intro_question,
) "",
),
br_type=br_type,
br_code=br_code,
)
)
def confirm_solana_tx(
amount: str,
fee: str,
items: Iterable[tuple[str, str]],
amount_title: str | None = None,
fee_title: str | None = None,
br_type: str = "confirm_solana_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> Awaitable[None]:
amount_title = (
amount_title if amount_title is not None else f"{TR.words__amount}:"
) # def_arg
fee_title = fee_title or TR.words__fee # def_arg
return raise_if_not_confirmed(
interact(
RustLayout(
trezorui2.altcoin_tx_summary(
amount_title=amount_title,
amount_value=amount,
fee_title=fee_title,
fee_value=fee,
items=items,
cancel_cross=True,
)
),
br_type=br_type,
br_code=br_code,
)
)
async def confirm_ethereum_tx(
recipient: str,
total_amount: str,
maximum_fee: str,
items: Iterable[tuple[str, str]],
br_type: str = "confirm_ethereum_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
chunkify: bool = False,
) -> None:
summary_layout = RustLayout(
trezorui2.altcoin_tx_summary(
amount_title=f"{TR.words__amount}:",
amount_value=total_amount,
fee_title=TR.send__maximum_fee,
fee_value=maximum_fee,
items=items,
)
)
while True:
# Allowing going back and forth between recipient and summary/details
await confirm_blob(
br_type, br_type,
TR.words__recipient, br_code,
recipient, verb=verb,
verb=TR.buttons__continue, info_items=((address_title, address),),
chunkify=chunkify, chunkify_info=chunkify,
) )
try: # confirmation
summary_layout.request_complete_repaint() if verb == TR.ethereum__staking_claim:
await raise_if_not_confirmed( amount_title = verb
interact( amount_value = ""
summary_layout, else:
br_type, amount_title = TR.words__amount + ":"
br_code, amount_value = total_amount
) await raise_if_not_confirmed(
interact(
RustLayout(
trezorui2.altcoin_tx_summary(
amount_title=amount_title,
amount_value=amount_value,
fee_title=TR.send__maximum_fee,
fee_value=maximum_fee,
items=info_items,
cancel_cross=True,
)
),
br_type=br_type,
br_code=br_code,
) )
break )
except ActionCancelled:
continue def confirm_solana_tx(
amount: str,
fee: str,
items: Iterable[tuple[str, str]],
amount_title: str | None = None,
fee_title: str | None = None,
br_type: str = "confirm_solana_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> Awaitable[None]:
amount_title = (
amount_title if amount_title is not None else f"{TR.words__amount}:"
) # def_arg
fee_title = fee_title or TR.words__fee # def_arg
return raise_if_not_confirmed(
interact(
RustLayout(
trezorui2.altcoin_tx_summary(
amount_title=amount_title,
amount_value=amount,
fee_title=fee_title,
fee_value=fee,
items=items,
cancel_cross=True,
)
),
br_type=br_type,
br_code=br_code,
)
)
async def confirm_ethereum_tx(
recipient: str,
total_amount: str,
maximum_fee: str,
items: Iterable[tuple[str, str]],
br_type: str = "confirm_ethereum_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
chunkify: bool = False,
) -> None:
summary_layout = RustLayout(
trezorui2.altcoin_tx_summary(
amount_title=f"{TR.words__amount}:",
amount_value=total_amount,
fee_title=TR.send__maximum_fee,
fee_value=maximum_fee,
items=items,
)
)
while True:
# Allowing going back and forth between recipient and summary/details
await confirm_blob(
br_type,
TR.words__recipient,
recipient,
verb=TR.buttons__continue,
chunkify=chunkify,
)
try:
summary_layout.request_complete_repaint()
await raise_if_not_confirmed(
interact(
summary_layout,
br_type,
br_code,
)
)
break
except ActionCancelled:
continue
def confirm_joint_total(spending_amount: str, total_amount: str) -> Awaitable[None]: def confirm_joint_total(spending_amount: str, total_amount: str) -> Awaitable[None]:

View File

@ -1,7 +1,7 @@
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import trezorui2 import trezorui2
from trezor import TR, ui from trezor import TR, ui, utils
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any from typing import Any
@ -57,13 +57,13 @@ def pin_progress(message: str, description: str) -> ProgressLayout:
return progress(message, description) return progress(message, description)
def monero_keyimage_sync_progress() -> ProgressLayout: if not utils.BITCOIN_ONLY:
return progress("", TR.progress__syncing)
def monero_keyimage_sync_progress() -> ProgressLayout:
return progress("", TR.progress__syncing)
def monero_live_refresh_progress() -> ProgressLayout: def monero_live_refresh_progress() -> ProgressLayout:
return progress("", TR.progress__refreshing, indeterminate=True) return progress("", TR.progress__refreshing, indeterminate=True)
def monero_transaction_progress_inner() -> ProgressLayout:
def monero_transaction_progress_inner() -> ProgressLayout: return progress("", TR.progress__signing_transaction)
return progress("", TR.progress__signing_transaction)

View File

@ -1,7 +1,7 @@
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import trezorui2 import trezorui2
from trezor import TR, io, loop, ui from trezor import TR, io, loop, ui, utils
from trezor.enums import ButtonRequestType from trezor.enums import ButtonRequestType
from trezor.wire import ActionCancelled from trezor.wire import ActionCancelled
from trezor.wire.context import wait as ctx_wait from trezor.wire.context import wait as ctx_wait
@ -1001,117 +1001,117 @@ def confirm_summary(
) )
async def confirm_ethereum_tx( if not utils.BITCOIN_ONLY:
recipient: str,
total_amount: str,
maximum_fee: str,
items: Iterable[tuple[str, str]],
br_type: str = "confirm_ethereum_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
chunkify: bool = False,
) -> None:
total_layout = RustLayout(
trezorui2.confirm_total(
title=TR.words__title_summary,
items=[
(f"{TR.words__amount}:", total_amount),
(TR.send__maximum_fee, maximum_fee),
],
info_button=True,
cancel_arrow=True,
)
)
info_layout = RustLayout(
trezorui2.show_info_with_cancel(
title=TR.confirm_total__title_fee,
items=items,
)
)
while True: async def confirm_ethereum_tx(
# Allowing going back and forth between recipient and summary/details recipient: str,
await confirm_blob( total_amount: str,
br_type, maximum_fee: str,
TR.words__recipient.upper(), items: Iterable[tuple[str, str]],
recipient, br_type: str = "confirm_ethereum_tx",
verb=TR.buttons__continue, br_code: ButtonRequestType = ButtonRequestType.SignTx,
chunkify=chunkify, chunkify: bool = False,
) ) -> None:
total_layout = RustLayout(
try: trezorui2.confirm_total(
total_layout.request_complete_repaint() title=TR.words__title_summary,
await raise_if_not_confirmed( items=[
with_info(total_layout, info_layout, br_type, br_code) (f"{TR.words__amount}:", total_amount),
(TR.send__maximum_fee, maximum_fee),
],
info_button=True,
cancel_arrow=True,
)
)
info_layout = RustLayout(
trezorui2.show_info_with_cancel(
title=TR.confirm_total__title_fee,
items=items,
) )
break
except ActionCancelled:
continue
async def confirm_ethereum_staking_tx(
title: str,
intro_question: str,
verb: str,
total_amount: str,
maximum_fee: str,
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,
) -> None:
# intro
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,
)
# confirmation
if verb == TR.ethereum__staking_claim:
items = ((TR.send__maximum_fee, maximum_fee),)
else:
items = (
(TR.words__amount + ":", total_amount),
(TR.send__maximum_fee, maximum_fee),
) )
await confirm_summary(
items, # items
title=title,
info_title=TR.confirm_total__title_fee,
info_items=info_items,
br_type=br_type,
br_code=br_code,
)
while True:
# Allowing going back and forth between recipient and summary/details
await confirm_blob(
br_type,
TR.words__recipient.upper(),
recipient,
verb=TR.buttons__continue,
chunkify=chunkify,
)
def confirm_solana_tx( try:
amount: str, total_layout.request_complete_repaint()
fee: str, await raise_if_not_confirmed(
items: Iterable[tuple[str, str]], with_info(total_layout, info_layout, br_type, br_code)
amount_title: str | None = None, )
fee_title: str | None = None, break
br_type: str = "confirm_solana_tx", except ActionCancelled:
br_code: ButtonRequestType = ButtonRequestType.SignTx, continue
) -> Awaitable[None]:
amount_title = ( async def confirm_ethereum_staking_tx(
amount_title if amount_title is not None else f"{TR.words__amount}:" title: str,
) # def_arg intro_question: str,
fee_title = fee_title or TR.words__fee # def_arg verb: str,
return confirm_summary( total_amount: str,
((amount_title, amount), (fee_title, fee)), maximum_fee: str,
info_items=items, address: str,
br_type=br_type, address_title: str,
br_code=br_code, info_items: Iterable[tuple[str, str]],
) chunkify: bool = False,
br_type: str = "confirm_ethereum_staking_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
# intro
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,
)
# confirmation
if verb == TR.ethereum__staking_claim:
items = ((TR.send__maximum_fee, maximum_fee),)
else:
items = (
(TR.words__amount + ":", total_amount),
(TR.send__maximum_fee, maximum_fee),
)
await confirm_summary(
items, # items
title=title,
info_title=TR.confirm_total__title_fee,
info_items=info_items,
br_type=br_type,
br_code=br_code,
)
def confirm_solana_tx(
amount: str,
fee: str,
items: Iterable[tuple[str, str]],
amount_title: str | None = None,
fee_title: str | None = None,
br_type: str = "confirm_solana_tx",
br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> Awaitable[None]:
amount_title = (
amount_title if amount_title is not None else f"{TR.words__amount}:"
) # def_arg
fee_title = fee_title or TR.words__fee # def_arg
return confirm_summary(
((amount_title, amount), (fee_title, fee)),
info_items=items,
br_type=br_type,
br_code=br_code,
)
def confirm_joint_total(spending_amount: str, total_amount: str) -> Awaitable[None]: def confirm_joint_total(spending_amount: str, total_amount: str) -> Awaitable[None]:

View File

@ -1,7 +1,7 @@
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import trezorui2 import trezorui2
from trezor import TR, ui from trezor import TR, ui, utils
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any from typing import Any
@ -60,13 +60,13 @@ def pin_progress(message: str, description: str) -> ProgressLayout:
return progress(message, description=description) return progress(message, description=description)
def monero_keyimage_sync_progress() -> ProgressLayout: if not utils.BITCOIN_ONLY:
return progress("", TR.progress__syncing)
def monero_keyimage_sync_progress() -> ProgressLayout:
return progress("", TR.progress__syncing)
def monero_live_refresh_progress() -> ProgressLayout: def monero_live_refresh_progress() -> ProgressLayout:
return progress("", TR.progress__refreshing, indeterminate=True) return progress("", TR.progress__refreshing, indeterminate=True)
def monero_transaction_progress_inner() -> ProgressLayout:
def monero_transaction_progress_inner() -> ProgressLayout: return progress("", TR.progress__signing_transaction)
return progress("", TR.progress__signing_transaction)