You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/src/apps/stellar/get_address.py

23 lines
804 B

from trezor.messages.StellarAddress import StellarAddress
from trezor.messages.StellarGetAddress import StellarGetAddress
from apps.common import seed
from apps.common.layout import address_n_to_str, show_address, show_qr
from apps.stellar import helpers
async def get_address(ctx, msg: StellarGetAddress):
node = await seed.derive_node(ctx, msg.address_n, helpers.STELLAR_CURVE)
pubkey = seed.remove_ed25519_prefix(node.public_key())
address = helpers.address_from_public_key(pubkey)
if msg.show_display:
desc = address_n_to_str(msg.address_n)
while True:
if await show_address(ctx, address, desc=desc):
break
if await show_qr(ctx, address.upper(), desc=desc):
break
return StellarAddress(address=address)