From 555bb62e3f7f5a9fcaca301f10ab9f977c87a8dd Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 5 Sep 2018 15:21:11 +0200 Subject: [PATCH] btc: add script_type to get_public_node --- trezorctl | 4 +++- trezorlib/btc.py | 8 +++++++- trezorlib/tests/unit_tests/test_transport.py | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/trezorctl b/trezorctl index e1256cc673..76bbc449e6 100755 --- a/trezorctl +++ b/trezorctl @@ -597,9 +597,10 @@ def get_address(connect, coin, address, script_type, show_display): @click.option("-c", "--coin", default="Bitcoin") @click.option("-n", "--address", required=True, help="BIP-32 path, e.g. m/44'/0'/0'") @click.option("-e", "--curve") +@click.option("-t", "--script-type", type=CHOICE_INPUT_SCRIPT_TYPE, default="address") @click.option("-d", "--show-display", is_flag=True) @click.pass_obj -def get_public_node(connect, coin, address, curve, show_display): +def get_public_node(connect, coin, address, curve, script_type, show_display): client = connect() address_n = tools.parse_path(address) result = btc.get_public_node( @@ -608,6 +609,7 @@ def get_public_node(connect, coin, address, curve, show_display): ecdsa_curve_name=curve, show_display=show_display, coin_name=coin, + script_type=script_type, ) return { "node": { diff --git a/trezorlib/btc.py b/trezorlib/btc.py index a6e3b82642..3d43c415df 100644 --- a/trezorlib/btc.py +++ b/trezorlib/btc.py @@ -4,7 +4,12 @@ from .tools import CallException, expect, normalize_nfc, session @expect(proto.PublicKey) def get_public_node( - client, n, ecdsa_curve_name=None, show_display=False, coin_name=None + client, + n, + ecdsa_curve_name=None, + show_display=False, + coin_name=None, + script_type=proto.InputScriptType.SPENDADDRESS, ): return client.call( proto.GetPublicKey( @@ -12,6 +17,7 @@ def get_public_node( ecdsa_curve_name=ecdsa_curve_name, show_display=show_display, coin_name=coin_name, + script_type=script_type, ) ) diff --git a/trezorlib/tests/unit_tests/test_transport.py b/trezorlib/tests/unit_tests/test_transport.py index 62f00fbb48..4dd1f941af 100644 --- a/trezorlib/tests/unit_tests/test_transport.py +++ b/trezorlib/tests/unit_tests/test_transport.py @@ -15,7 +15,6 @@ # If not, see . import mock - from trezorlib.transport import all_transports