1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 07:18:09 +00:00

chore(tools): simplify build_protobuf file sources creation

This commit is contained in:
grdddj 2022-03-01 17:08:26 +01:00 committed by matejcik
parent 5632567c06
commit b9858f00c5
3 changed files with 130 additions and 169 deletions

View File

@ -3,6 +3,23 @@ from typing import TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
from enum import IntEnum 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): class MessageType(IntEnum):
Initialize = 0 Initialize = 0
Ping = 1 Ping = 1
@ -229,23 +246,6 @@ if TYPE_CHECKING:
WebAuthnAddResidentCredential = 802 WebAuthnAddResidentCredential = 802
WebAuthnRemoveResidentCredential = 803 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): class FailureType(IntEnum):
UnexpectedMessage = 1 UnexpectedMessage = 1
ButtonExpected = 2 ButtonExpected = 2

View File

@ -3134,6 +3134,116 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EosActionUnknown"]: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EosActionUnknown"]:
return isinstance(msg, cls) 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): class EthereumGetPublicKey(protobuf.MessageType):
address_n: "list[int]" address_n: "list[int]"
show_display: "bool | None" show_display: "bool | None"
@ -3396,116 +3506,6 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumAccessList"]: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["EthereumAccessList"]:
return isinstance(msg, cls) 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): class MoneroTransactionSourceEntry(protobuf.MessageType):
outputs: "list[MoneroOutputEntry]" outputs: "list[MoneroOutputEntry]"
real_output: "int | None" real_output: "int | None"

View File

@ -4,51 +4,12 @@ cd $(dirname $0)/..
PROTOB=common/protob PROTOB=common/protob
CORE_PROTOBUF_SOURCES="\ # Bootloader messages cannot end up in core
$PROTOB/messages.proto \ CORE_PROTOBUF_SOURCES=$(ls $PROTOB/*.proto | grep -v "bootloader")
$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 \
"
# Taking all files for python
PYTHON_PROTOBUF_SOURCES=$PROTOB/*.proto 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 RETURN=0
do_rebuild() { do_rebuild() {