1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-09 06:50:58 +00:00

refactor(core): convert parts of apps.monero to layouts

This commit is contained in:
Martin Milata 2021-02-15 23:19:34 +01:00
parent 6668921a4f
commit 2a5f5c1c20

View File

@ -3,6 +3,7 @@ from ubinascii import hexlify
from trezor import ui, wire from trezor import ui, wire
from trezor.messages import ButtonRequestType from trezor.messages import ButtonRequestType
from trezor.ui.components.tt.text import Text from trezor.ui.components.tt.text import Text
from trezor.ui.layouts import confirm_action, require
from trezor.ui.popup import Popup from trezor.ui.popup import Popup
from trezor.utils import chunks from trezor.utils import chunks
@ -22,34 +23,63 @@ if False:
async def require_confirm_watchkey(ctx): async def require_confirm_watchkey(ctx):
content = Text("Confirm export", ui.ICON_SEND, ui.GREEN) await require(
content.normal("Do you really want to", "export watch-only", "credentials?") confirm_action(
await require_confirm(ctx, content, ButtonRequestType.SignTx) ctx,
"get_watchkey",
"Confirm export",
description="Do you really want to export watch-only credentials?",
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_keyimage_sync(ctx): async def require_confirm_keyimage_sync(ctx):
content = Text("Confirm ki sync", ui.ICON_SEND, ui.GREEN) await require(
content.normal("Do you really want to", "sync key images?") confirm_action(
await require_confirm(ctx, content, ButtonRequestType.SignTx) ctx,
"key_image_sync",
"Confirm ki sync",
description="Do you really want to\nsync key images?",
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_live_refresh(ctx): async def require_confirm_live_refresh(ctx):
content = Text("Confirm refresh", ui.ICON_SEND, ui.GREEN) await require(
content.normal("Do you really want to", "start refresh?") confirm_action(
await require_confirm(ctx, content, ButtonRequestType.SignTx) ctx,
"live_refresh",
"Confirm refresh",
description="Do you really want to\nstart refresh?",
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_tx_key(ctx, export_key=False): async def require_confirm_tx_key(ctx, export_key=False):
content = Text("Confirm export", ui.ICON_SEND, ui.GREEN)
txt = ["Do you really want to"]
if export_key: if export_key:
txt.append("export tx_key?") description = "Do you really want to export tx_key?"
else: else:
txt.append("export tx_der") description = "Do you really want to export tx_der\nfor tx_proof?"
txt.append("for tx_proof?") await require(
confirm_action(
content.normal(*txt) ctx,
await require_confirm(ctx, content, ButtonRequestType.SignTx) "export_tx_key",
"Confirm export",
description=description,
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_transaction( async def require_confirm_transaction(