diff --git a/core/src/trezor/enums/__init__.py b/core/src/trezor/enums/__init__.py index d1ad8b59a..2c47c98e9 100644 --- a/core/src/trezor/enums/__init__.py +++ b/core/src/trezor/enums/__init__.py @@ -3,6 +3,23 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: from enum import IntEnum + class BinanceOrderType(IntEnum): + OT_UNKNOWN = 0 + MARKET = 1 + LIMIT = 2 + OT_RESERVED = 3 + + class BinanceOrderSide(IntEnum): + SIDE_UNKNOWN = 0 + BUY = 1 + SELL = 2 + + class BinanceTimeInForce(IntEnum): + TIF_UNKNOWN = 0 + GTE = 1 + TIF_RESERVED = 2 + IOC = 3 + class MessageType(IntEnum): Initialize = 0 Ping = 1 @@ -229,23 +246,6 @@ if TYPE_CHECKING: WebAuthnAddResidentCredential = 802 WebAuthnRemoveResidentCredential = 803 - class BinanceOrderType(IntEnum): - OT_UNKNOWN = 0 - MARKET = 1 - LIMIT = 2 - OT_RESERVED = 3 - - class BinanceOrderSide(IntEnum): - SIDE_UNKNOWN = 0 - BUY = 1 - SELL = 2 - - class BinanceTimeInForce(IntEnum): - TIF_UNKNOWN = 0 - GTE = 1 - TIF_RESERVED = 2 - IOC = 3 - class FailureType(IntEnum): UnexpectedMessage = 1 ButtonExpected = 2 diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index b97d256cf..9005f70ca 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -3134,6 +3134,116 @@ if TYPE_CHECKING: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EosActionUnknown"]: return isinstance(msg, cls) + class EthereumSignTypedData(protobuf.MessageType): + address_n: "list[int]" + primary_type: "str" + metamask_v4_compat: "bool" + + def __init__( + self, + *, + primary_type: "str", + address_n: "list[int] | None" = None, + metamask_v4_compat: "bool | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumSignTypedData"]: + return isinstance(msg, cls) + + class EthereumTypedDataStructRequest(protobuf.MessageType): + name: "str" + + def __init__( + self, + *, + name: "str", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataStructRequest"]: + return isinstance(msg, cls) + + class EthereumTypedDataStructAck(protobuf.MessageType): + members: "list[EthereumStructMember]" + + def __init__( + self, + *, + members: "list[EthereumStructMember] | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataStructAck"]: + return isinstance(msg, cls) + + class EthereumTypedDataValueRequest(protobuf.MessageType): + member_path: "list[int]" + + def __init__( + self, + *, + member_path: "list[int] | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataValueRequest"]: + return isinstance(msg, cls) + + class EthereumTypedDataValueAck(protobuf.MessageType): + value: "bytes" + + def __init__( + self, + *, + value: "bytes", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataValueAck"]: + return isinstance(msg, cls) + + class EthereumStructMember(protobuf.MessageType): + type: "EthereumFieldType" + name: "str" + + def __init__( + self, + *, + type: "EthereumFieldType", + name: "str", + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumStructMember"]: + return isinstance(msg, cls) + + class EthereumFieldType(protobuf.MessageType): + data_type: "EthereumDataType" + size: "int | None" + entry_type: "EthereumFieldType | None" + struct_name: "str | None" + + def __init__( + self, + *, + data_type: "EthereumDataType", + size: "int | None" = None, + entry_type: "EthereumFieldType | None" = None, + struct_name: "str | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumFieldType"]: + return isinstance(msg, cls) + class EthereumGetPublicKey(protobuf.MessageType): address_n: "list[int]" show_display: "bool | None" @@ -3396,116 +3506,6 @@ if TYPE_CHECKING: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumAccessList"]: return isinstance(msg, cls) - class EthereumSignTypedData(protobuf.MessageType): - address_n: "list[int]" - primary_type: "str" - metamask_v4_compat: "bool" - - def __init__( - self, - *, - primary_type: "str", - address_n: "list[int] | None" = None, - metamask_v4_compat: "bool | None" = None, - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumSignTypedData"]: - return isinstance(msg, cls) - - class EthereumTypedDataStructRequest(protobuf.MessageType): - name: "str" - - def __init__( - self, - *, - name: "str", - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataStructRequest"]: - return isinstance(msg, cls) - - class EthereumTypedDataStructAck(protobuf.MessageType): - members: "list[EthereumStructMember]" - - def __init__( - self, - *, - members: "list[EthereumStructMember] | None" = None, - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataStructAck"]: - return isinstance(msg, cls) - - class EthereumTypedDataValueRequest(protobuf.MessageType): - member_path: "list[int]" - - def __init__( - self, - *, - member_path: "list[int] | None" = None, - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataValueRequest"]: - return isinstance(msg, cls) - - class EthereumTypedDataValueAck(protobuf.MessageType): - value: "bytes" - - def __init__( - self, - *, - value: "bytes", - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumTypedDataValueAck"]: - return isinstance(msg, cls) - - class EthereumStructMember(protobuf.MessageType): - type: "EthereumFieldType" - name: "str" - - def __init__( - self, - *, - type: "EthereumFieldType", - name: "str", - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumStructMember"]: - return isinstance(msg, cls) - - class EthereumFieldType(protobuf.MessageType): - data_type: "EthereumDataType" - size: "int | None" - entry_type: "EthereumFieldType | None" - struct_name: "str | None" - - def __init__( - self, - *, - data_type: "EthereumDataType", - size: "int | None" = None, - entry_type: "EthereumFieldType | None" = None, - struct_name: "str | None" = None, - ) -> None: - pass - - @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumFieldType"]: - return isinstance(msg, cls) - class MoneroTransactionSourceEntry(protobuf.MessageType): outputs: "list[MoneroOutputEntry]" real_output: "int | None" diff --git a/tools/build_protobuf b/tools/build_protobuf index f081889ae..a4417b5dd 100755 --- a/tools/build_protobuf +++ b/tools/build_protobuf @@ -4,51 +4,12 @@ cd $(dirname $0)/.. PROTOB=common/protob -CORE_PROTOBUF_SOURCES="\ - $PROTOB/messages.proto \ - $PROTOB/messages-binance.proto \ - $PROTOB/messages-bitcoin.proto \ - $PROTOB/messages-cardano.proto \ - $PROTOB/messages-common.proto \ - $PROTOB/messages-crypto.proto \ - $PROTOB/messages-debug.proto \ - $PROTOB/messages-eos.proto \ - $PROTOB/messages-ethereum.proto \ - $PROTOB/messages-ethereum-eip712.proto \ - $PROTOB/messages-management.proto \ - $PROTOB/messages-monero.proto \ - $PROTOB/messages-nem.proto \ - $PROTOB/messages-ripple.proto \ - $PROTOB/messages-stellar.proto \ - $PROTOB/messages-tezos.proto \ - $PROTOB/messages-webauthn.proto \ -" +# Bootloader messages cannot end up in core +CORE_PROTOBUF_SOURCES=$(ls $PROTOB/*.proto | grep -v "bootloader") +# Taking all files for python PYTHON_PROTOBUF_SOURCES=$PROTOB/*.proto -CORE_MESSAGES_IGNORE="\ - CosiCommit \ - CosiCommitment \ - CosiSign \ - CosiSignature \ - DebugLinkFlashErase \ - DebugLinkLog \ - DebugLinkMemory \ - DebugLinkMemoryRead \ - DebugLinkMemoryWrite \ - DebugLinkStop \ - NEMDecryptMessage \ - NEMDecryptedMessage \ - PinMatrixAck \ - PinMatrixRequest \ - PinMatrixRequestType \ - WordAck \ - WordRequest \ - WordRequestType \ -" - -PYTHON_MESSAGES_IGNORE="" - RETURN=0 do_rebuild() {