mirror of
https://github.com/trezor/trezor-firmware.git
synced 2026-03-21 22:57:27 +01:00
feat(solana): add get_address
This commit is contained in:
@@ -29,3 +29,19 @@ def get_public_key(
|
||||
"""Get Solana public key."""
|
||||
address_n = tools.parse_path(address)
|
||||
return solana.get_public_key(client, address_n, show_display)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-n", "--address", default=DEFAULT_PATH, help=PATH_HELP)
|
||||
@click.option("-d", "--show-display", is_flag=True)
|
||||
@click.option("-C", "--chunkify", is_flag=True)
|
||||
@with_client
|
||||
def get_address(
|
||||
client: "TrezorClient",
|
||||
address: str,
|
||||
show_display: bool,
|
||||
chunkify: bool,
|
||||
) -> messages.SolanaAddress:
|
||||
"""Get Solana address."""
|
||||
address_n = tools.parse_path(address)
|
||||
return solana.get_address(client, address_n, show_display, chunkify)
|
||||
|
||||
@@ -264,6 +264,8 @@ class MessageType(IntEnum):
|
||||
WebAuthnRemoveResidentCredential = 803
|
||||
SolanaGetPublicKey = 900
|
||||
SolanaPublicKey = 901
|
||||
SolanaGetAddress = 902
|
||||
SolanaAddress = 903
|
||||
|
||||
|
||||
class FailureType(IntEnum):
|
||||
@@ -6678,6 +6680,40 @@ class SolanaPublicKey(protobuf.MessageType):
|
||||
self.public_key = public_key
|
||||
|
||||
|
||||
class SolanaGetAddress(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 902
|
||||
FIELDS = {
|
||||
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
|
||||
2: protobuf.Field("show_display", "bool", repeated=False, required=False, default=None),
|
||||
3: protobuf.Field("chunkify", "bool", repeated=False, required=False, default=None),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
address_n: Optional[Sequence["int"]] = None,
|
||||
show_display: Optional["bool"] = None,
|
||||
chunkify: Optional["bool"] = None,
|
||||
) -> None:
|
||||
self.address_n: Sequence["int"] = address_n if address_n is not None else []
|
||||
self.show_display = show_display
|
||||
self.chunkify = chunkify
|
||||
|
||||
|
||||
class SolanaAddress(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 903
|
||||
FIELDS = {
|
||||
1: protobuf.Field("address", "string", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
address: "str",
|
||||
) -> None:
|
||||
self.address = address
|
||||
|
||||
|
||||
class StellarAsset(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = None
|
||||
FIELDS = {
|
||||
|
||||
@@ -17,3 +17,19 @@ def get_public_key(
|
||||
return client.call(
|
||||
messages.SolanaGetPublicKey(address_n=address_n, show_display=show_display)
|
||||
)
|
||||
|
||||
|
||||
@expect(messages.SolanaAddress)
|
||||
def get_address(
|
||||
client: "TrezorClient",
|
||||
address_n: List[int],
|
||||
show_display: bool,
|
||||
chunkify: bool = False,
|
||||
) -> "MessageType":
|
||||
return client.call(
|
||||
messages.SolanaGetAddress(
|
||||
address_n=address_n,
|
||||
show_display=show_display,
|
||||
chunkify=chunkify,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user