1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 00:28:10 +00:00

trezorlib: Add nem_get_address

This commit is contained in:
Saleem Rashid 2017-09-03 14:35:22 +01:00 committed by Pavol Rusnak
parent 4f5d9c4323
commit eb1d66e27f
2 changed files with 16 additions and 0 deletions

View File

@ -671,6 +671,16 @@ def ethereum_sign_tx(client, host, chain_id, address, value, gas_limit, gas_pric
return 'Signed raw transaction: %s' % tx_hex
@cli.command(help='Get NEM address for specified path.')
@click.option('-n', '--address', required=True, help="BIP-32 path, e.g. m/44'/0'/43'/0/0")
@click.option('-N', '--network', type=int, default=0x68)
@click.option('-d', '--show-display', is_flag=True)
@click.pass_obj
def nem_get_address(client, address, network, show_display):
address_n = client.expand_path(address)
return client.nem_get_address(address_n, network, show_display)
@cli.command(help='Sign (and optionally broadcast) NEM transaction')
@click.option('-n', '--address', help='BIP-32 path to signing key')
@click.option('-f', '--file', type=click.File('r'), default='-', help='Transaction in NIS (RequestPrepareAnnounce) format')

View File

@ -667,6 +667,12 @@ class ProtocolMixin(object):
ret = self.call(proto.SetU2FCounter(u2f_counter=u2f_counter))
return ret
@field("address")
@expect(proto.NEMAddress)
def nem_get_address(self, n, network, show_display=False):
n = self._convert_prime(n)
return self.call(proto.NEMGetAddress(address_n=n, network=network, show_display=show_display))
@expect(proto.NEMSignedTx)
def nem_sign_tx(self, n, transaction):
n = self._convert_prime(n)