Skip to content

Commit

Permalink
Merge pull request #3 from qtumproject/time/app_name
Browse files Browse the repository at this point in the history
Expose information for app name in enumerate ledger
  • Loading branch information
qtum-neil authored Nov 24, 2021
2 parents f9c04e6 + f83fd12 commit 8529936
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hwilib/devices/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,12 @@ def __init__(self, path: str, password: str = "", expert: bool = False, chain: C

self.app = btchip(self.dongle)

if self.app.getAppName() not in ["Qtum", "Qtum Test", "Qtum Stake", "Qtum Stake Test", "Bitcoin", "Bitcoin Test", "app"]:
@ledger_exception
def get_app_name(self) -> str:
appName = self.app.getAppName()
if appName not in ["Qtum", "Qtum Test", "Qtum Stake", "Qtum Stake Test", "Bitcoin", "Bitcoin Test", "app"]:
raise UnknownDeviceError("Ledger is not in either the Bitcoin or Bitcoin Testnet app")
return appName

@ledger_exception
def get_pubkey_at_path(self, path: str) -> ExtendedKey:
Expand Down Expand Up @@ -494,6 +498,7 @@ def enumerate(password: str = '', chain: Chain = Chain.MAIN) -> List[Dict[str, A
with handle_errors(common_err_msgs["enumerate"], d_data):
try:
client = LedgerClient(path, password, expert=False, chain=chain)
d_data['app_name'] = client.get_app_name()
d_data['fingerprint'] = client.get_master_fingerprint().hex()
d_data['needs_pin_sent'] = False
d_data['needs_passphrase_sent'] = False
Expand Down

0 comments on commit 8529936

Please sign in to comment.