mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
chore(core/ui): delete altcoin.py file
This commit is contained in:
parent
56e0c91a71
commit
bd6f3d5f46
@ -578,14 +578,12 @@ if FROZEN:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/reset.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/recovery.py'))
|
||||
if EVERYTHING:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/altcoin.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/webauthn.py'))
|
||||
if TREZOR_MODEL in ('T',):
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/__init__.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/reset.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/recovery.py'))
|
||||
if EVERYTHING:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/altcoin.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/webauthn.py'))
|
||||
elif TREZOR_MODEL in ('1',):
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/t1.py'))
|
||||
|
@ -532,14 +532,12 @@ if FROZEN:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/reset.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/recovery.py'))
|
||||
if EVERYTHING:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/altcoin.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/webauthn.py'))
|
||||
if TREZOR_MODEL in ('T',):
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/__init__.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/reset.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/recovery.py'))
|
||||
if EVERYTHING:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/altcoin.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/tt_v2/webauthn.py'))
|
||||
elif TREZOR_MODEL in ('1',):
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/t1.py'))
|
||||
|
@ -153,8 +153,6 @@ trezor.ui.components.common.confirm
|
||||
import trezor.ui.components.common.confirm
|
||||
trezor.ui.layouts
|
||||
import trezor.ui.layouts
|
||||
trezor.ui.layouts.altcoin
|
||||
import trezor.ui.layouts.altcoin
|
||||
trezor.ui.layouts.common
|
||||
import trezor.ui.layouts.common
|
||||
trezor.ui.layouts.recovery
|
||||
@ -167,8 +165,6 @@ trezor.ui.layouts.tr
|
||||
import trezor.ui.layouts.tr
|
||||
trezor.ui.layouts.tt_v2
|
||||
import trezor.ui.layouts.tt_v2
|
||||
trezor.ui.layouts.tt_v2.altcoin
|
||||
import trezor.ui.layouts.tt_v2.altcoin
|
||||
trezor.ui.layouts.tt_v2.recovery
|
||||
import trezor.ui.layouts.tt_v2.recovery
|
||||
trezor.ui.layouts.tt_v2.reset
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Sequence
|
||||
|
||||
from trezor.enums import ButtonRequestType
|
||||
from trezor.strings import format_amount
|
||||
@ -17,8 +17,6 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
async def require_confirm_transfer(ctx: Context, msg: BinanceTransferMsg) -> None:
|
||||
from trezor.ui.layouts.altcoin import confirm_transfer_binance
|
||||
|
||||
items: list[tuple[str, str, str]] = []
|
||||
|
||||
def make_input_output_pages(msg: BinanceInputOutput, direction: str) -> None:
|
||||
@ -37,7 +35,21 @@ async def require_confirm_transfer(ctx: Context, msg: BinanceTransferMsg) -> Non
|
||||
for txoutput in msg.outputs:
|
||||
make_input_output_pages(txoutput, "Confirm output")
|
||||
|
||||
await confirm_transfer_binance(ctx, items)
|
||||
await confirm_transfer(ctx, items)
|
||||
|
||||
|
||||
async def confirm_transfer(
|
||||
ctx: Context, inputs_outputs: Sequence[tuple[str, str, str]]
|
||||
) -> None:
|
||||
from trezor.ui.layouts import confirm_output
|
||||
|
||||
for title, amount, address in inputs_outputs:
|
||||
await confirm_output(
|
||||
ctx,
|
||||
address,
|
||||
amount,
|
||||
title,
|
||||
)
|
||||
|
||||
|
||||
async def require_confirm_cancel(ctx: Context, msg: BinanceCancelMsg) -> None:
|
||||
|
@ -1,7 +1,6 @@
|
||||
from micropython import const
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from trezor import utils
|
||||
from trezor.enums import ButtonRequestType
|
||||
from trezor.strings import format_amount
|
||||
from trezor.ui import layouts
|
||||
@ -10,10 +9,6 @@ from trezor.ui.layouts import confirm_metadata
|
||||
from .. import addresses
|
||||
from ..common import format_fee_rate
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.ui.layouts import altcoin
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
|
||||
@ -96,9 +91,26 @@ async def confirm_decred_sstx_submission(
|
||||
) -> None:
|
||||
assert output.address is not None
|
||||
address_short = addresses.address_short(coin, output.address)
|
||||
amount = format_coin_amount(output.amount, coin, amount_unit)
|
||||
|
||||
await altcoin.confirm_decred_sstx_submission(
|
||||
ctx, address_short, format_coin_amount(output.amount, coin, amount_unit)
|
||||
await layouts.confirm_value(
|
||||
ctx,
|
||||
"Purchase ticket",
|
||||
amount,
|
||||
"Ticket amount:",
|
||||
"confirm_decred_sstx_submission",
|
||||
ButtonRequestType.ConfirmOutput,
|
||||
verb="CONFIRM",
|
||||
)
|
||||
|
||||
await layouts.confirm_value(
|
||||
ctx,
|
||||
"Purchase ticket",
|
||||
address_short,
|
||||
"Voting rights to:",
|
||||
"confirm_decred_sstx_submission",
|
||||
ButtonRequestType.ConfirmOutput,
|
||||
verb="PURCHASE",
|
||||
)
|
||||
|
||||
|
||||
|
@ -3,7 +3,13 @@ from typing import TYPE_CHECKING
|
||||
from trezor import ui
|
||||
from trezor.enums import ButtonRequestType
|
||||
from trezor.strings import format_plural
|
||||
from trezor.ui.layouts import confirm_blob, confirm_text, should_show_more
|
||||
from trezor.ui.layouts import (
|
||||
confirm_amount,
|
||||
confirm_blob,
|
||||
confirm_text,
|
||||
confirm_total,
|
||||
should_show_more,
|
||||
)
|
||||
|
||||
from . import networks
|
||||
from .helpers import decode_typed_data
|
||||
@ -38,21 +44,26 @@ def require_confirm_tx(
|
||||
)
|
||||
|
||||
|
||||
def require_confirm_fee(
|
||||
async def require_confirm_fee(
|
||||
ctx: Context,
|
||||
spending: int,
|
||||
gas_price: int,
|
||||
gas_limit: int,
|
||||
chain_id: int,
|
||||
token: tokens.TokenInfo | None = None,
|
||||
) -> Awaitable[None]:
|
||||
from trezor.ui.layouts.altcoin import confirm_total_ethereum
|
||||
|
||||
return confirm_total_ethereum(
|
||||
) -> None:
|
||||
await confirm_amount(
|
||||
ctx,
|
||||
format_ethereum_amount(spending, token, chain_id),
|
||||
format_ethereum_amount(gas_price, None, chain_id),
|
||||
format_ethereum_amount(gas_price * gas_limit, None, chain_id),
|
||||
title="Confirm fee",
|
||||
description="Gas price:",
|
||||
amount=format_ethereum_amount(gas_price, None, chain_id),
|
||||
)
|
||||
await confirm_total(
|
||||
ctx,
|
||||
total_amount=format_ethereum_amount(spending, token, chain_id),
|
||||
fee_amount=format_ethereum_amount(gas_price * gas_limit, None, chain_id),
|
||||
total_label="Amount sent:",
|
||||
fee_label="Maximum fee:",
|
||||
)
|
||||
|
||||
|
||||
@ -65,8 +76,6 @@ async def require_confirm_eip1559_fee(
|
||||
chain_id: int,
|
||||
token: tokens.TokenInfo | None = None,
|
||||
) -> None:
|
||||
from trezor.ui.layouts import confirm_amount, confirm_total
|
||||
|
||||
await confirm_amount(
|
||||
ctx,
|
||||
"Confirm fee",
|
||||
|
@ -33,7 +33,6 @@ async def require_confirm_destination_tag(ctx: Context, tag: int) -> None:
|
||||
|
||||
|
||||
async def require_confirm_tx(ctx: Context, to: str, value: int) -> None:
|
||||
# NOTE: local imports here saves 4 bytes
|
||||
from trezor.ui.layouts.altcoin import confirm_total_ripple
|
||||
from trezor.ui.layouts import confirm_output
|
||||
|
||||
await confirm_total_ripple(ctx, to, format_amount(value, DECIMALS))
|
||||
await confirm_output(ctx, to, format_amount(value, DECIMALS) + " XRP")
|
||||
|
@ -1 +0,0 @@
|
||||
from .tt_v2.altcoin import * # noqa: F401,F403
|
@ -1,68 +0,0 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from trezor.enums import ButtonRequestType
|
||||
from trezor.ui.layouts import (
|
||||
confirm_amount,
|
||||
confirm_blob,
|
||||
confirm_output,
|
||||
confirm_total,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence
|
||||
from trezor.wire import GenericContext
|
||||
|
||||
pass
|
||||
|
||||
|
||||
async def confirm_total_ethereum(
|
||||
ctx: GenericContext, total_amount: str, gas_price: str, fee_max: str
|
||||
) -> None:
|
||||
await confirm_amount(
|
||||
ctx,
|
||||
title="Confirm fee",
|
||||
description="Gas price:",
|
||||
amount=gas_price,
|
||||
)
|
||||
await confirm_total(
|
||||
ctx,
|
||||
total_amount=total_amount,
|
||||
fee_amount=fee_max,
|
||||
total_label="Amount sent:",
|
||||
fee_label="Maximum fee:",
|
||||
)
|
||||
|
||||
|
||||
async def confirm_total_ripple(
|
||||
ctx: GenericContext,
|
||||
address: str,
|
||||
amount: str,
|
||||
) -> None:
|
||||
await confirm_output(ctx, address, amount + " XRP")
|
||||
|
||||
|
||||
async def confirm_transfer_binance(
|
||||
ctx: GenericContext, inputs_outputs: Sequence[tuple[str, str, str]]
|
||||
) -> None:
|
||||
for title, amount, address in inputs_outputs:
|
||||
await confirm_blob(
|
||||
ctx,
|
||||
"confirm_transfer",
|
||||
title,
|
||||
f"{amount}\nto\n{address}",
|
||||
br_code=ButtonRequestType.ConfirmOutput,
|
||||
)
|
||||
|
||||
|
||||
async def confirm_decred_sstx_submission(
|
||||
ctx: GenericContext,
|
||||
address: str,
|
||||
amount: str,
|
||||
) -> None:
|
||||
await confirm_blob(
|
||||
ctx,
|
||||
"confirm_decred_sstx_submission",
|
||||
"Purchase ticket",
|
||||
f"{amount}\nwith voting rights to\n{address}",
|
||||
br_code=ButtonRequestType.ConfirmOutput,
|
||||
)
|
Loading…
Reference in New Issue
Block a user