Skip to content

Commit

Permalink
fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
OBorce committed Dec 19, 2024
1 parent dbde1a6 commit 15c716f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
7 changes: 0 additions & 7 deletions common/defs/misc/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,5 @@
"slip44": 501,
"curve": "ed25519",
"decimals": 9
},
{
"name": "Mintlayer",
"shortcut": "ML",
"slip44": 19788,
"curve": "secp256k1",
"decimals": 11
}
]
4 changes: 0 additions & 4 deletions core/src/apps/mintlayer/sign_tx/signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ def add_input(
def add_output(self, txo: MintlayerTxOutput):
self.outputs.append(txo)

def number_of_utxos(self) -> int:
return sum([1 for inp in self.inputs if inp.utxo is not None])


class Mintlayer:
def init_signing(self) -> None:
Expand Down Expand Up @@ -164,7 +161,6 @@ def __init__(
) -> None:
from trezor.messages import MintlayerTxRequest, MintlayerTxRequestDetailsType


self.progress = Progress()
self.coininfo = find_coin_by_name(tx.coin_name)
self.tx_info = TxInfo(tx=tx, inputs=[], outputs=[])
Expand Down
2 changes: 1 addition & 1 deletion core/src/apps/workflow_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _find_message_handler_module(msg_type: int) -> str:
- collecting everything as strings instead of importing directly means that we don't
need to load any of the modules into memory until we actually need them
"""
from trezor import log, utils
from trezor import utils
from trezor.enums import MessageType

# debug
Expand Down
28 changes: 23 additions & 5 deletions python/src/trezorlib/cli/mintlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ def cli() -> None:


@cli.command()
@click.option("-c", "--coin", required=True, help="coin name")
@click.option("-n", "--address", required=True, help="BIP-32 path")
@click.option("-d", "--show-display", is_flag=True)
@click.option("-C", "--chunkify", is_flag=True)
@with_client
def get_address(
client: "TrezorClient",
coin: str,
address: str,
show_display: bool,
chunkify: bool,
Expand All @@ -37,17 +39,20 @@ def get_address(
return mintlayer.get_address(
client,
address_n,
coin,
show_display,
chunkify=chunkify,
)


@cli.command()
@click.option("-c", "--coin", required=True, help="coin name")
@click.option("-n", "--address", required=True, help="BIP-32 path, e.g. m/44h/0h/0h")
@click.option("-d", "--show-display", is_flag=True)
@with_client
def get_public_key(
client: "TrezorClient",
coin: str,
address: str,
show_display: bool,
) -> dict:
Expand All @@ -60,6 +65,7 @@ def get_public_key(
result = mintlayer.get_public_key(
client,
address_n,
coin,
show_display=show_display,
)
if isinstance(result, messages.MintlayerPublicKey):
Expand All @@ -72,21 +78,29 @@ def get_public_key(


@cli.command()
@click.option("-c", "--coin", required=True, help="coin name")
@click.option("-n", "--address_n", required=True, help="BIP-32 path")
@click.option("-a", "--address", required=True, help="bech32 encoded address")
@click.option(
"-a",
"--address-type",
required=True,
help="Address type PUBLIC_KEY or PUBLIC_KEY_HASH",
)
@click.argument("message")
@with_client
def sign_message(
client: "TrezorClient",
coin: str,
address_n: str,
address: str,
address_type: str,
message: str,
) -> dict:
"""Sign message using address of given path."""
result = mintlayer.sign_message(
client,
coin_name=coin,
address_n=tools.parse_path(address_n),
address=address,
address_type=address_type,
message=message.encode(),
)
if isinstance(result, messages.MessageSignature):
Expand All @@ -100,10 +114,13 @@ def sign_message(


@cli.command()
@click.option("-c", "--coin", required=True, help="coin name")
@click.option("-C", "--chunkify", is_flag=True)
@click.argument("json_file", type=click.File())
@with_client
def sign_tx(client: "TrezorClient", json_file: TextIO, chunkify: bool) -> None:
def sign_tx(
client: "TrezorClient", coin: str, json_file: TextIO, chunkify: bool
) -> None:
"""Sign transaction.
Transaction data must be provided in a JSON file. The structure of the JSON matches the shape of the relevant protobuf messages. See
Expand All @@ -129,6 +146,7 @@ def sign_tx(client: "TrezorClient", json_file: TextIO, chunkify: bool) -> None:

results = mintlayer.sign_tx(
client,
coin,
inputs,
outputs,
prev_txs=prev_txes,
Expand All @@ -139,7 +157,7 @@ def sign_tx(client: "TrezorClient", json_file: TextIO, chunkify: bool) -> None:
click.echo()
click.echo("Signed signatures:")
for res in results:
click.echo(f"signature index: {res.signature_index}")
click.echo(f"input index: {res.input_index}")
click.echo("signature:")
for sig in res.signatures:
if sig.multisig_idx is not None:
Expand Down

0 comments on commit 15c716f

Please sign in to comment.