1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 17:38:39 +00:00

nem: show qr

This commit is contained in:
Tomas Susanka 2018-06-11 15:55:10 +02:00 committed by Jan Pochyla
parent 9329b0e16b
commit f41b14e935

View File

@ -4,7 +4,8 @@ from trezor.messages.NEMAddress import NEMAddress
from trezor.ui.text import Text
from apps.common import seed
from apps.common.confirm import require_confirm
from apps.common.confirm import confirm
from apps.common.display_address import show_qr
from .layout import split_address
from .helpers import get_network_str, NEM_CURVE
@ -17,16 +18,26 @@ async def get_address(ctx, msg):
address = node.nem_address(network)
if msg.show_display:
await _require_confirm_address(ctx, address, network)
while True:
if await _show_address(ctx, address, network):
break
if await show_qr(ctx, address.upper()):
break
return NEMAddress(address=address)
async def _require_confirm_address(ctx, address: str, network: int):
async def _show_address(ctx, address: str, network: int):
lines = split_address(address)
content = Text(
'Export NEM address', ui.ICON_RECEIVE,
'Confirm address', ui.ICON_RECEIVE,
ui.NORMAL, '%s network' % get_network_str(network),
ui.MONO, *lines,
icon_color=ui.GREEN)
await require_confirm(ctx, content, code=ButtonRequestType.Address)
return await confirm(
ctx,
content,
code=ButtonRequestType.Address,
cancel='QR',
cancel_style=ui.BTN_KEY)