mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
apps.wallet: support GetAddress.coin_name
This commit is contained in:
parent
315440fc18
commit
384bde3efc
@ -3,28 +3,26 @@ from trezor.utils import unimport
|
|||||||
|
|
||||||
|
|
||||||
@unimport
|
@unimport
|
||||||
async def layout_get_address(message, session_id):
|
async def layout_get_address(msg, session_id):
|
||||||
from trezor.messages.Address import Address
|
from trezor.messages.Address import Address
|
||||||
from trezor.messages.FailureType import Other
|
from trezor.messages.FailureType import Other
|
||||||
from ..common.seed import get_node
|
from ..common.seed import get_node
|
||||||
|
from ..common import coins
|
||||||
|
|
||||||
address_n = getattr(message, 'address_n', ())
|
address_n = getattr(msg, 'address_n', ())
|
||||||
coin_name = getattr(message, 'coin_name', None)
|
coin_name = getattr(msg, 'coin_name', 'Bitcoin')
|
||||||
multisig = getattr(message, 'multisig', None)
|
multisig = getattr(msg, 'multisig', None)
|
||||||
show_display = getattr(message, 'show_display', False)
|
show_display = getattr(msg, 'show_display', False)
|
||||||
|
|
||||||
# TODO: support custom coin addresses
|
|
||||||
# TODO: support multisig addresses
|
# TODO: support multisig addresses
|
||||||
|
|
||||||
if coin_name != 'Bitcoin':
|
|
||||||
raise wire.FailureError(Other, 'GetAddress.coin_name is unsupported')
|
|
||||||
if multisig:
|
if multisig:
|
||||||
raise wire.FailureError(Other, 'GetAddress.multisig is unsupported')
|
raise wire.FailureError(Other, 'GetAddress.multisig is unsupported')
|
||||||
|
|
||||||
node = await get_node(session_id, address_n)
|
node = await get_node(session_id, address_n)
|
||||||
|
|
||||||
address_version = 0
|
coin = coins.by_name(coin_name)
|
||||||
address = node.address(address_version)
|
address = node.address(coin.address_type)
|
||||||
|
|
||||||
if show_display:
|
if show_display:
|
||||||
await _show_address(session_id, address)
|
await _show_address(session_id, address)
|
||||||
@ -36,6 +34,8 @@ async def _show_address(session_id, address):
|
|||||||
from trezor.ui.text import Text
|
from trezor.ui.text import Text
|
||||||
from ..common.confirm import require_confirm
|
from ..common.confirm import require_confirm
|
||||||
|
|
||||||
|
# TODO: qr code
|
||||||
|
|
||||||
content = Text('Confirm address', ui.ICON_RESET,
|
content = Text('Confirm address', ui.ICON_RESET,
|
||||||
ui.MONO, *_split_address(address))
|
ui.MONO, *_split_address(address))
|
||||||
await require_confirm(session_id, content, code=Address)
|
await require_confirm(session_id, content, code=Address)
|
||||||
|
Loading…
Reference in New Issue
Block a user