fix(core): exclude altcoin functions from bitcoinonly build

pull/3591/head
matejcik 2 months ago committed by matejcik
parent f34ad3daf1
commit b6e8567a49

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

@ -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)

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

@ -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)

Loading…
Cancel
Save