@@ -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 }),
0 commit comments