1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

trezorctl/trezorlib: add show_display to StellarGetAddress/StellarGetPublicKey

This commit is contained in:
Pavol Rusnak 2018-06-11 18:55:52 +02:00
parent b791e805a1
commit 1477c9aa9e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
6 changed files with 19 additions and 12 deletions

View File

@ -1025,20 +1025,22 @@ def cosi_sign(connect, address, data, global_commitment, global_pubkey):
#
@cli.command(help='Get Stellar public address')
@click.option('-n', '--address', required=False, help="BIP32 path. Always use hardened paths and the m/44'/148'/ prefix", default=stellar.DEFAULT_BIP32_PATH)
@click.option('-d', '--show-display', is_flag=True)
@click.pass_obj
def stellar_get_address(connect, address):
def stellar_get_address(connect, address, show_display):
client = connect()
address_n = tools.parse_path(address)
return client.stellar_get_address(address_n)
return client.stellar_get_address(address_n, show_display)
@cli.command(help='Get Stellar public key')
@click.option('-n', '--address', required=False, help="BIP32 path. Always use hardened paths and the m/44'/148'/ prefix", default=stellar.DEFAULT_BIP32_PATH)
@click.option('-d', '--show-display', is_flag=True)
@click.pass_obj
def stellar_get_public_key(connect, address):
def stellar_get_public_key(connect, address, show_display):
client = connect()
address_n = tools.parse_path(address)
return client.stellar_get_public_key(address_n)
return client.stellar_get_public_key(address_n, show_display)
@cli.command(help='Sign a base64-encoded transaction envelope')

View File

@ -1100,13 +1100,13 @@ class ProtocolMixin(object):
@field('public_key')
@expect(proto.StellarPublicKey)
def stellar_get_public_key(self, address_n):
return self.call(proto.StellarGetPublicKey(address_n=address_n))
def stellar_get_public_key(self, address_n, show_display=False):
return self.call(proto.StellarGetPublicKey(address_n=address_n, show_display=show_display))
@field('address')
@expect(proto.StellarAddress)
def stellar_get_address(self, address_n):
return self.call(proto.StellarGetAddress(address_n=address_n))
def stellar_get_address(self, address_n, show_display=False):
return self.call(proto.StellarGetAddress(address_n=address_n, show_display=show_display))
def stellar_sign_transaction(self, tx, operations, address_n, network_passphrase=None):
# default networkPassphrase to the public network

View File

@ -11,10 +11,13 @@ class StellarGetAddress(p.MessageType):
MESSAGE_WIRE_TYPE = 207
FIELDS = {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('show_display', p.BoolType, 0),
}
def __init__(
self,
address_n: List[int] = None
address_n: List[int] = None,
show_display: bool = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.show_display = show_display

View File

@ -11,10 +11,13 @@ class StellarGetPublicKey(p.MessageType):
MESSAGE_WIRE_TYPE = 200
FIELDS = {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('show_display', p.BoolType, 0),
}
def __init__(
self,
address_n: List[int] = None
address_n: List[int] = None,
show_display: bool = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.show_display = show_display

View File

@ -22,7 +22,6 @@ from trezorlib.tools import parse_path
@pytest.mark.stellar
@pytest.mark.xfail(TREZOR_VERSION == 1, reason="T1 support for get address is not yet finished")
@pytest.mark.xfail(TREZOR_VERSION == 2, reason="T2 support is not yet finished")
class TestMsgStellarGetAddress(TrezorTest):

@ -1 +1 @@
Subproject commit 57a31feb2e48ac5057761fd07e5c7b280b66b5c6
Subproject commit 0bf60dbda9bd85db01ed36e5d9045a223744a35c