Skip to content

Commit 7bddc11

Browse files
authored
Merge pull request #145 from keepkey/xpub-support
Xpub support
2 parents 4054710 + 866fc63 commit 7bddc11

File tree

5 files changed

+188
-76
lines changed

5 files changed

+188
-76
lines changed

device-protocol

keepkeyctl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ class Commands(object):
164164
script_type = typemap[args.script_type];
165165
return self.client.get_address(args.coin, address_n, args.show_display, script_type=script_type)
166166

167+
def get_xpub(self, args):
168+
address_n = self.client.expand_path(args.n)
169+
typemap = { 'address': types.SPENDADDRESS,
170+
'segwit': types.SPENDWITNESS,
171+
'p2shsegwit': types.SPENDP2SHWITNESS }
172+
script_type = typemap[args.script_type];
173+
return self.client.get_public_node(n=address_n, show_display=args.show_display, coin_name=args.coin, script_type=script_type).xpub
174+
167175
def ethereum_get_address(self, args):
168176
address_n = self.client.expand_path(args.n)
169177
address = self.client.ethereum_get_address(address_n, args.show_display)
@@ -500,6 +508,7 @@ class Commands(object):
500508
list.help = 'List connected KeepKey USB devices'
501509
ping.help = 'Send ping message'
502510
get_address.help = 'Get bitcoin address in base58 encoding'
511+
get_xpub.help = 'Get xpub'
503512
ethereum_get_address.help = 'Get Ethereum address in hex encoding'
504513
ethereum_sign_tx.help = 'Sign (and optionally publish) Ethereum transaction'
505514
eos_get_public_key.help = 'Get EOS public key'
@@ -536,6 +545,13 @@ class Commands(object):
536545
(('-d', '--show-display'), {'action': 'store_true', 'default': False}),
537546
)
538547

548+
get_xpub.arguments = (
549+
(('-c', '--coin'), {'type': str, 'default': 'Bitcoin'}),
550+
(('-n', '-address'), {'type': str}),
551+
(('-t', '--script-type'), {'type': str, 'choices': ['address', 'segwit', 'p2shsegwit'], 'default': 'address'}),
552+
(('-d', '--show-display'), {'action': 'store_true', 'default': False}),
553+
)
554+
539555
ethereum_get_address.arguments = (
540556
(('-n', '-address'), {'type': str}),
541557
(('-d', '--show-display'), {'action': 'store_true', 'default': False}),

keepkeylib/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ def expand_path(n):
530530
"Dogecoin": 3,
531531
"Dash": 5,
532532
"Namecoin": 7,
533+
"Digibyte": 20,
533534
"Bitsend": 91,
534535
"Groestlcoin": 17,
535536
"Zcash": 133,

keepkeylib/messages_ethereum_pb2.py

Lines changed: 91 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)