1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 21:48:13 +00:00

fix pystyle

This commit is contained in:
gabrielkerekes 2023-08-08 09:25:27 +02:00
parent f3ae77e1af
commit 6ca20053ac
2 changed files with 16 additions and 12 deletions

View File

@ -1,14 +1,21 @@
from typing import TYPE_CHECKING
import click
from .. import solana, messages, tools
from .. import messages, solana, tools
from . import with_client
if TYPE_CHECKING:
from ..client import TrezorClient
PATH_HELP = "BIP-32 path to key, e.g. m/44'/501'/0'"
@click.group(name="solana")
def cli() -> None:
"""Solana commands."""
@cli.command()
@click.option("-n", "--address", required=True, help=PATH_HELP)
@with_client
@ -21,6 +28,7 @@ def get_public_key(
client.init_device()
return solana.get_public_key(client, address_n)
@cli.command()
@click.option("-n", "--address", required=True, help=PATH_HELP)
@click.option("-d", "--show-display", is_flag=True)
@ -29,12 +37,13 @@ def get_address(
client: "TrezorClient",
address: str,
show_display: bool,
) -> messages.SolanaPublicKey:
) -> messages.SolanaAddress:
"""Get Solana public key."""
address_n = tools.parse_path(address)
client.init_device()
return solana.get_address(client, address_n, show_display)
@cli.command()
@click.option("-n", "--signer-path", required=True, help=PATH_HELP)
@click.option("-t", "--serialized-tx", required=True)
@ -43,7 +52,7 @@ def sign_tx(
client: "TrezorClient",
signer_path: str,
serialized_tx: str,
) -> messages.SolanaPublicKey:
) -> messages.SolanaSignedTx:
"""Sign Solana transaction."""
signer_path_n = tools.parse_path(signer_path)
client.init_device()

View File

@ -1,7 +1,4 @@
from typing import (
TYPE_CHECKING,
List,
)
from typing import TYPE_CHECKING, List
from . import messages
from .tools import expect
@ -16,11 +13,8 @@ def get_public_key(
client: "TrezorClient",
address_n: List[int],
) -> "MessageType":
return client.call(
messages.SolanaGetPublicKey(
address_n=address_n
)
)
return client.call(messages.SolanaGetPublicKey(address_n=address_n))
@expect(messages.SolanaAddress)
def get_address(
@ -35,6 +29,7 @@ def get_address(
)
)
@expect(messages.SolanaSignedTx)
def sign_tx(
client: "TrezorClient",