2023-12-02 12:28:42 +00:00
|
|
|
from typing import TYPE_CHECKING, List, Optional
|
2023-10-18 09:40:19 +00:00
|
|
|
|
|
|
|
from . import messages
|
|
|
|
from .tools import expect
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
from .protobuf import MessageType
|
2024-12-02 14:44:10 +00:00
|
|
|
from .transport.session import Session
|
2023-10-18 09:40:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
@expect(messages.SolanaPublicKey)
|
|
|
|
def get_public_key(
|
2024-12-02 14:44:10 +00:00
|
|
|
session: "Session",
|
2023-10-18 09:40:19 +00:00
|
|
|
address_n: List[int],
|
|
|
|
show_display: bool,
|
|
|
|
) -> "MessageType":
|
2024-12-02 14:44:10 +00:00
|
|
|
return session.call(
|
2023-10-18 09:40:19 +00:00
|
|
|
messages.SolanaGetPublicKey(address_n=address_n, show_display=show_display)
|
|
|
|
)
|
2023-10-18 09:43:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
@expect(messages.SolanaAddress)
|
|
|
|
def get_address(
|
2024-12-02 14:44:10 +00:00
|
|
|
session: "Session",
|
2023-10-18 09:43:41 +00:00
|
|
|
address_n: List[int],
|
|
|
|
show_display: bool,
|
|
|
|
chunkify: bool = False,
|
|
|
|
) -> "MessageType":
|
2024-12-02 14:44:10 +00:00
|
|
|
return session.call(
|
2023-10-18 09:43:41 +00:00
|
|
|
messages.SolanaGetAddress(
|
|
|
|
address_n=address_n,
|
|
|
|
show_display=show_display,
|
|
|
|
chunkify=chunkify,
|
|
|
|
)
|
|
|
|
)
|
2023-10-18 09:48:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
@expect(messages.SolanaTxSignature)
|
|
|
|
def sign_tx(
|
2024-12-02 14:44:10 +00:00
|
|
|
session: "Session",
|
2023-10-18 09:48:32 +00:00
|
|
|
address_n: List[int],
|
|
|
|
serialized_tx: bytes,
|
2023-12-02 12:28:42 +00:00
|
|
|
additional_info: Optional[messages.SolanaTxAdditionalInfo],
|
2023-10-18 09:48:32 +00:00
|
|
|
) -> "MessageType":
|
2024-12-02 14:44:10 +00:00
|
|
|
return session.call(
|
2023-10-18 09:48:32 +00:00
|
|
|
messages.SolanaSignTx(
|
|
|
|
address_n=address_n,
|
|
|
|
serialized_tx=serialized_tx,
|
2023-12-02 12:28:42 +00:00
|
|
|
additional_info=additional_info,
|
2023-10-18 09:48:32 +00:00
|
|
|
)
|
|
|
|
)
|