mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-07 07:12:34 +00:00
fix pystyle
This commit is contained in:
parent
f3ae77e1af
commit
6ca20053ac
@ -1,14 +1,21 @@
|
|||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from .. import solana, messages, tools
|
from .. import messages, solana, tools
|
||||||
from . import with_client
|
from . import with_client
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..client import TrezorClient
|
||||||
|
|
||||||
PATH_HELP = "BIP-32 path to key, e.g. m/44'/501'/0'"
|
PATH_HELP = "BIP-32 path to key, e.g. m/44'/501'/0'"
|
||||||
|
|
||||||
|
|
||||||
@click.group(name="solana")
|
@click.group(name="solana")
|
||||||
def cli() -> None:
|
def cli() -> None:
|
||||||
"""Solana commands."""
|
"""Solana commands."""
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("-n", "--address", required=True, help=PATH_HELP)
|
@click.option("-n", "--address", required=True, help=PATH_HELP)
|
||||||
@with_client
|
@with_client
|
||||||
@ -21,6 +28,7 @@ def get_public_key(
|
|||||||
client.init_device()
|
client.init_device()
|
||||||
return solana.get_public_key(client, address_n)
|
return solana.get_public_key(client, address_n)
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("-n", "--address", required=True, help=PATH_HELP)
|
@click.option("-n", "--address", required=True, help=PATH_HELP)
|
||||||
@click.option("-d", "--show-display", is_flag=True)
|
@click.option("-d", "--show-display", is_flag=True)
|
||||||
@ -29,12 +37,13 @@ def get_address(
|
|||||||
client: "TrezorClient",
|
client: "TrezorClient",
|
||||||
address: str,
|
address: str,
|
||||||
show_display: bool,
|
show_display: bool,
|
||||||
) -> messages.SolanaPublicKey:
|
) -> messages.SolanaAddress:
|
||||||
"""Get Solana public key."""
|
"""Get Solana public key."""
|
||||||
address_n = tools.parse_path(address)
|
address_n = tools.parse_path(address)
|
||||||
client.init_device()
|
client.init_device()
|
||||||
return solana.get_address(client, address_n, show_display)
|
return solana.get_address(client, address_n, show_display)
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("-n", "--signer-path", required=True, help=PATH_HELP)
|
@click.option("-n", "--signer-path", required=True, help=PATH_HELP)
|
||||||
@click.option("-t", "--serialized-tx", required=True)
|
@click.option("-t", "--serialized-tx", required=True)
|
||||||
@ -43,7 +52,7 @@ def sign_tx(
|
|||||||
client: "TrezorClient",
|
client: "TrezorClient",
|
||||||
signer_path: str,
|
signer_path: str,
|
||||||
serialized_tx: str,
|
serialized_tx: str,
|
||||||
) -> messages.SolanaPublicKey:
|
) -> messages.SolanaSignedTx:
|
||||||
"""Sign Solana transaction."""
|
"""Sign Solana transaction."""
|
||||||
signer_path_n = tools.parse_path(signer_path)
|
signer_path_n = tools.parse_path(signer_path)
|
||||||
client.init_device()
|
client.init_device()
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
from typing import (
|
from typing import TYPE_CHECKING, List
|
||||||
TYPE_CHECKING,
|
|
||||||
List,
|
|
||||||
)
|
|
||||||
|
|
||||||
from . import messages
|
from . import messages
|
||||||
from .tools import expect
|
from .tools import expect
|
||||||
@ -16,11 +13,8 @@ def get_public_key(
|
|||||||
client: "TrezorClient",
|
client: "TrezorClient",
|
||||||
address_n: List[int],
|
address_n: List[int],
|
||||||
) -> "MessageType":
|
) -> "MessageType":
|
||||||
return client.call(
|
return client.call(messages.SolanaGetPublicKey(address_n=address_n))
|
||||||
messages.SolanaGetPublicKey(
|
|
||||||
address_n=address_n
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
@expect(messages.SolanaAddress)
|
@expect(messages.SolanaAddress)
|
||||||
def get_address(
|
def get_address(
|
||||||
@ -35,6 +29,7 @@ def get_address(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@expect(messages.SolanaSignedTx)
|
@expect(messages.SolanaSignedTx)
|
||||||
def sign_tx(
|
def sign_tx(
|
||||||
client: "TrezorClient",
|
client: "TrezorClient",
|
||||||
|
Loading…
Reference in New Issue
Block a user