mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 17:00:59 +00:00
common: introduce Features.features enum
This commit is contained in:
parent
101ec1d161
commit
cc184a0a30
@ -58,6 +58,23 @@ message Features {
|
||||
optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup)
|
||||
optional bool no_backup = 28; // report no backup (equals to Storage.no_backup)
|
||||
optional bool recovery_mode = 29; // is recovery mode in progress
|
||||
repeated Feature features = 30; // list of supported features
|
||||
enum Feature {
|
||||
Feature_Bitcoin = 1;
|
||||
Feature_Bitcoin_like = 2; // Altcoins based on the Bitcoin source code
|
||||
Feature_Binance = 3;
|
||||
Feature_Cardano = 4;
|
||||
Feature_Crypto = 5; // generic crypto operations for GPG, SSH, etc.
|
||||
Feature_EOS = 6;
|
||||
Feature_Ethereum = 7;
|
||||
Feature_Lisk = 8;
|
||||
Feature_Monero = 9;
|
||||
Feature_NEM = 10;
|
||||
Feature_Ripple = 11;
|
||||
Feature_Stellar = 12;
|
||||
Feature_Tezos = 13;
|
||||
Feature_U2F = 14;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
16
core/src/trezor/messages/Feature.py
Normal file
16
core/src/trezor/messages/Feature.py
Normal file
@ -0,0 +1,16 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
Bitcoin = 1
|
||||
Bitcoin_like = 2
|
||||
Binance = 3
|
||||
Cardano = 4
|
||||
Crypto = 5
|
||||
EOS = 6
|
||||
Ethereum = 7
|
||||
Lisk = 8
|
||||
Monero = 9
|
||||
NEM = 10
|
||||
Ripple = 11
|
||||
Stellar = 12
|
||||
Tezos = 13
|
||||
U2F = 14
|
@ -6,8 +6,10 @@ if __debug__:
|
||||
try:
|
||||
from typing import Dict, List, Optional
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
EnumTypeFeature = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
|
||||
except ImportError:
|
||||
Dict, List, Optional = None, None, None # type: ignore
|
||||
EnumTypeFeature = None # type: ignore
|
||||
|
||||
|
||||
class Features(p.MessageType):
|
||||
@ -43,6 +45,7 @@ class Features(p.MessageType):
|
||||
unfinished_backup: bool = None,
|
||||
no_backup: bool = None,
|
||||
recovery_mode: bool = None,
|
||||
features: List[EnumTypeFeature] = None,
|
||||
) -> None:
|
||||
self.vendor = vendor
|
||||
self.major_version = major_version
|
||||
@ -72,6 +75,7 @@ class Features(p.MessageType):
|
||||
self.unfinished_backup = unfinished_backup
|
||||
self.no_backup = no_backup
|
||||
self.recovery_mode = recovery_mode
|
||||
self.features = features if features is not None else []
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
@ -104,4 +108,5 @@ class Features(p.MessageType):
|
||||
27: ('unfinished_backup', p.BoolType, 0),
|
||||
28: ('no_backup', p.BoolType, 0),
|
||||
29: ('recovery_mode', p.BoolType, 0),
|
||||
30: ('features', p.EnumType("Feature", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)), p.FLAG_REPEATED),
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ Features.bootloader_hash max_size:32
|
||||
Features.model max_size:17
|
||||
Features.fw_vendor max_size:256
|
||||
Features.fw_vendor_keys max_size:32
|
||||
Features.features max_count:32
|
||||
|
||||
ApplySettings.language max_size:17
|
||||
ApplySettings.label max_size:33
|
||||
|
16
python/src/trezorlib/messages/Feature.py
Normal file
16
python/src/trezorlib/messages/Feature.py
Normal file
@ -0,0 +1,16 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
Bitcoin = 1
|
||||
Bitcoin_like = 2
|
||||
Binance = 3
|
||||
Cardano = 4
|
||||
Crypto = 5
|
||||
EOS = 6
|
||||
Ethereum = 7
|
||||
Lisk = 8
|
||||
Monero = 9
|
||||
NEM = 10
|
||||
Ripple = 11
|
||||
Stellar = 12
|
||||
Tezos = 13
|
||||
U2F = 14
|
@ -6,8 +6,10 @@ if __debug__:
|
||||
try:
|
||||
from typing import Dict, List, Optional
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
EnumTypeFeature = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
|
||||
except ImportError:
|
||||
Dict, List, Optional = None, None, None # type: ignore
|
||||
EnumTypeFeature = None # type: ignore
|
||||
|
||||
|
||||
class Features(p.MessageType):
|
||||
@ -43,6 +45,7 @@ class Features(p.MessageType):
|
||||
unfinished_backup: bool = None,
|
||||
no_backup: bool = None,
|
||||
recovery_mode: bool = None,
|
||||
features: List[EnumTypeFeature] = None,
|
||||
) -> None:
|
||||
self.vendor = vendor
|
||||
self.major_version = major_version
|
||||
@ -72,6 +75,7 @@ class Features(p.MessageType):
|
||||
self.unfinished_backup = unfinished_backup
|
||||
self.no_backup = no_backup
|
||||
self.recovery_mode = recovery_mode
|
||||
self.features = features if features is not None else []
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
@ -104,4 +108,5 @@ class Features(p.MessageType):
|
||||
27: ('unfinished_backup', p.BoolType, 0),
|
||||
28: ('no_backup', p.BoolType, 0),
|
||||
29: ('recovery_mode', p.BoolType, 0),
|
||||
30: ('features', p.EnumType("Feature", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)), p.FLAG_REPEATED),
|
||||
}
|
||||
|
@ -255,6 +255,7 @@ from . import BinanceOrderType
|
||||
from . import BinanceTimeInForce
|
||||
from . import ButtonRequestType
|
||||
from . import FailureType
|
||||
from . import Feature
|
||||
from . import InputScriptType
|
||||
from . import LiskTransactionType
|
||||
from . import MessageType
|
||||
|
Loading…
Reference in New Issue
Block a user