1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00

Merge pull request #60 from Arachnid/ethereum

Add support for get_ethereum_address to trezorlib and trezorctl
This commit is contained in:
Pavol Rusnak 2016-05-26 11:13:40 +02:00
commit cbbd7004a8
3 changed files with 394 additions and 75 deletions

View File

@ -98,6 +98,11 @@ class Commands(object):
address_n = self.client.expand_path(args.n) address_n = self.client.expand_path(args.n)
return self.client.get_address(args.coin, address_n, args.show_display) return self.client.get_address(args.coin, address_n, args.show_display)
def ethereum_get_address(self, args):
address_n = self.client.expand_path(args.n)
address = self.client.ethereum_get_address(address_n, args.show_display)
return "0x%s" % (binascii.hexlify(address),)
def get_entropy(self, args): def get_entropy(self, args):
return binascii.hexlify(self.client.get_entropy(args.size)) return binascii.hexlify(self.client.get_entropy(args.size))
@ -242,6 +247,7 @@ class Commands(object):
list.help = 'List connected TREZOR USB devices' list.help = 'List connected TREZOR USB devices'
ping.help = 'Send ping message' ping.help = 'Send ping message'
get_address.help = 'Get bitcoin address in base58 encoding' get_address.help = 'Get bitcoin address in base58 encoding'
ethereum_get_address.help = 'Get Ethereum address in hex encoding'
get_entropy.help = 'Get example entropy' get_entropy.help = 'Get example entropy'
get_features.help = 'Retrieve device features and settings' get_features.help = 'Retrieve device features and settings'
get_public_node.help = 'Get public node of given path' get_public_node.help = 'Get public node of given path'
@ -268,6 +274,11 @@ class Commands(object):
(('-d', '--show-display'), {'action': 'store_true', 'default': False}), (('-d', '--show-display'), {'action': 'store_true', 'default': False}),
) )
ethereum_get_address.arguments = (
(('-n', '-address'), {'type': str}),
(('-d', '--show-display'), {'action': 'store_true', 'default': False}),
)
get_entropy.arguments = ( get_entropy.arguments = (
(('size',), {'type': int}), (('size',), {'type': int}),
) )

View File

@ -417,6 +417,12 @@ class ProtocolMixin(object):
else: else:
return self.call(proto.GetAddress(address_n=n, coin_name=coin_name, show_display=show_display)) return self.call(proto.GetAddress(address_n=n, coin_name=coin_name, show_display=show_display))
@field('address')
@expect(proto.EthereumAddress)
def ethereum_get_address(self, n, show_display=False, multisig=None):
n = self._convert_prime(n)
return self.call(proto.EthereumGetAddress(address_n=n, show_display=show_display))
@field('entropy') @field('entropy')
@expect(proto.Entropy) @expect(proto.Entropy)
def get_entropy(self, size): def get_entropy(self, size):

File diff suppressed because one or more lines are too long