From ba0879961ccc1564c4ddf8d9def89f5d5066298a Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 15 Jul 2021 22:52:50 +0200 Subject: [PATCH] feat(python): add support for Taproot descriptors --- python/.changelog.d/1710.added | 1 + python/src/trezorlib/cli/btc.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 python/.changelog.d/1710.added diff --git a/python/.changelog.d/1710.added b/python/.changelog.d/1710.added new file mode 100644 index 0000000000..ec233c514a --- /dev/null +++ b/python/.changelog.d/1710.added @@ -0,0 +1 @@ +Support for Taproot descriptors diff --git a/python/src/trezorlib/cli/btc.py b/python/src/trezorlib/cli/btc.py index 98dd0ca0cd..9ffde7a5b5 100644 --- a/python/src/trezorlib/cli/btc.py +++ b/python/src/trezorlib/cli/btc.py @@ -30,6 +30,7 @@ INPUT_SCRIPTS = { "pkh": messages.InputScriptType.SPENDADDRESS, "wpkh": messages.InputScriptType.SPENDWITNESS, "sh-wpkh": messages.InputScriptType.SPENDP2SHWITNESS, + "tr": messages.InputScriptType.SPENDTAPROOT, } OUTPUT_SCRIPTS = { @@ -39,6 +40,7 @@ OUTPUT_SCRIPTS = { "pkh": messages.OutputScriptType.PAYTOADDRESS, "wpkh": messages.OutputScriptType.PAYTOWITNESS, "sh-wpkh": messages.OutputScriptType.PAYTOP2SHWITNESS, + "tr": messages.OutputScriptType.PAYTOTAPROOT, } DEFAULT_COIN = "Bitcoin" @@ -206,6 +208,9 @@ def _get_descriptor(client, coin, account, script_type, show_display): elif script_type == messages.InputScriptType.SPENDWITNESS: acc_type = 84 fmt = "wpkh({})" + elif script_type == messages.InputScriptType.SPENDTAPROOT: + acc_type = 86 + fmt = "tr({})" else: raise ValueError("Unsupported account type")