Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions hwilib/devices/trezor.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,14 @@ def sign_message(self, message, keypath):

# Display address of specified type on the device. Only supports single-key based addresses.
def display_address(self, keypath, p2sh_p2wpkh, bech32):
raise NotImplementedError('The HardwareWalletClient base class does not '
'implement this method')
expanded_path = tools.parse_path(keypath)
output = btc.get_address(
self.client,
"Testnet" if self.is_testnet else "Bitcoin",
expanded_path,
show_display=True,
script_type=proto.InputScriptType.SPENDWITNESS if bech32 else (proto.InputScriptType.SPENDP2SHWITNESS if p2sh_p2wpkh else proto.InputScriptType.SPENDADDRESS)
)

# Setup a new device
def setup_device(self):
Expand Down
8 changes: 8 additions & 0 deletions test/test_trezor.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ def cleanup_bitcoind():
assert(keypool_desc['error'] == 'Path must end with /*')
assert(keypool_desc['code'] == -7)

# Test displayaddress
logging.info('Testing displayaddress legacy')
process_commands(dev_args + ['displayaddress', 'm/44h/1h/0h/0/0'])
logging.info('Testing displayaddress p2sh segwit')
process_commands(dev_args + ['displayaddress', '--sh_wpkh', 'm/49h/1h/0h/0/0'])
logging.info('Testing displayaddress native segwit')
process_commands(dev_args + ['displayaddress', '--wpkh', 'm/84h/1h/0h/0/0'])

# Test signtx
logging.info('Testing signtx')
# Import some keys to the watch only wallet and send coins to them
Expand Down