From 1477c9aa9eca2c0e7fab3decee61ebd1bd90e873 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 11 Jun 2018 18:55:52 +0200 Subject: [PATCH] trezorctl/trezorlib: add show_display to StellarGetAddress/StellarGetPublicKey --- trezorctl | 10 ++++++---- trezorlib/client.py | 8 ++++---- trezorlib/messages/StellarGetAddress.py | 5 ++++- trezorlib/messages/StellarGetPublicKey.py | 5 ++++- .../tests/device_tests/test_msg_stellar_get_address.py | 1 - vendor/trezor-common | 2 +- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/trezorctl b/trezorctl index b90a39d95d..3f2ba2470f 100755 --- a/trezorctl +++ b/trezorctl @@ -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') diff --git a/trezorlib/client.py b/trezorlib/client.py index 811dc6c641..8614d447b3 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -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 diff --git a/trezorlib/messages/StellarGetAddress.py b/trezorlib/messages/StellarGetAddress.py index 75e0c01ad8..f1c7a29fb8 100644 --- a/trezorlib/messages/StellarGetAddress.py +++ b/trezorlib/messages/StellarGetAddress.py @@ -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 diff --git a/trezorlib/messages/StellarGetPublicKey.py b/trezorlib/messages/StellarGetPublicKey.py index 3629086d0d..43098c4eab 100644 --- a/trezorlib/messages/StellarGetPublicKey.py +++ b/trezorlib/messages/StellarGetPublicKey.py @@ -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 diff --git a/trezorlib/tests/device_tests/test_msg_stellar_get_address.py b/trezorlib/tests/device_tests/test_msg_stellar_get_address.py index a20673e18d..7adbd058b0 100644 --- a/trezorlib/tests/device_tests/test_msg_stellar_get_address.py +++ b/trezorlib/tests/device_tests/test_msg_stellar_get_address.py @@ -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): diff --git a/vendor/trezor-common b/vendor/trezor-common index 57a31feb2e..0bf60dbda9 160000 --- a/vendor/trezor-common +++ b/vendor/trezor-common @@ -1 +1 @@ -Subproject commit 57a31feb2e48ac5057761fd07e5c7b280b66b5c6 +Subproject commit 0bf60dbda9bd85db01ed36e5d9045a223744a35c