|
|
|
@ -38,13 +38,18 @@ def cli() -> None:
|
|
|
|
|
@click.option("-n", "--address", required=True, help=PATH_HELP)
|
|
|
|
|
@click.option("-N", "--network", type=int, default=0x68)
|
|
|
|
|
@click.option("-d", "--show-display", is_flag=True)
|
|
|
|
|
@click.option("-C", "--chunkify", is_flag=True)
|
|
|
|
|
@with_client
|
|
|
|
|
def get_address(
|
|
|
|
|
client: "TrezorClient", address: str, network: int, show_display: bool
|
|
|
|
|
client: "TrezorClient",
|
|
|
|
|
address: str,
|
|
|
|
|
network: int,
|
|
|
|
|
show_display: bool,
|
|
|
|
|
chunkify: bool,
|
|
|
|
|
) -> str:
|
|
|
|
|
"""Get NEM address for specified path."""
|
|
|
|
|
address_n = tools.parse_path(address)
|
|
|
|
|
return nem.get_address(client, address_n, network, show_display)
|
|
|
|
|
return nem.get_address(client, address_n, network, show_display, chunkify)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cli.command()
|
|
|
|
@ -52,16 +57,21 @@ def get_address(
|
|
|
|
|
@click.option("-n", "--address", required=True, help=PATH_HELP)
|
|
|
|
|
@click.option("-f", "--file", "_ignore", is_flag=True, hidden=True, expose_value=False)
|
|
|
|
|
@click.option("-b", "--broadcast", help="NIS to announce transaction to")
|
|
|
|
|
@click.option("-C", "--chunkify", is_flag=True)
|
|
|
|
|
@with_client
|
|
|
|
|
def sign_tx(
|
|
|
|
|
client: "TrezorClient", address: str, file: TextIO, broadcast: Optional[str]
|
|
|
|
|
client: "TrezorClient",
|
|
|
|
|
address: str,
|
|
|
|
|
file: TextIO,
|
|
|
|
|
broadcast: Optional[str],
|
|
|
|
|
chunkify: bool,
|
|
|
|
|
) -> dict:
|
|
|
|
|
"""Sign (and optionally broadcast) NEM transaction.
|
|
|
|
|
|
|
|
|
|
Transaction file is expected in the NIS (RequestPrepareAnnounce) format.
|
|
|
|
|
"""
|
|
|
|
|
address_n = tools.parse_path(address)
|
|
|
|
|
transaction = nem.sign_tx(client, address_n, json.load(file))
|
|
|
|
|
transaction = nem.sign_tx(client, address_n, json.load(file), chunkify=chunkify)
|
|
|
|
|
|
|
|
|
|
payload = {"data": transaction.data.hex(), "signature": transaction.signature.hex()}
|
|
|
|
|
|
|
|
|
|