1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-21 23:18:13 +00:00

fix(common): fix one value enums in pb2py

This commit is contained in:
gabrielkerekes 2021-04-07 05:59:08 +02:00 committed by matejcik
parent e82aacbc7c
commit 2c503b16f5
67 changed files with 149 additions and 79 deletions

View File

@ -88,7 +88,7 @@ class ProtoField:
elif field.type == field.TYPE_ENUM:
value_dict = descriptor.enum_types[type_name]
valuestr = ", ".join(str(v) for v in value_dict.values())
proto_type = 'p.EnumType("{}", ({}))'.format(type_name, valuestr)
proto_type = 'p.EnumType("{}", ({},))'.format(type_name, valuestr)
py_type = "EnumType" + type_name
else:
try:

View File

@ -47,6 +47,6 @@ class ApplySettings(p.MessageType):
6: ('auto_lock_delay_ms', p.UVarintType, None),
7: ('display_rotation', p.UVarintType, None),
8: ('passphrase_always_on_device', p.BoolType, None),
9: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2)), None),
9: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2,)), None),
10: ('experimental_features', p.BoolType, None),
}

View File

@ -43,6 +43,6 @@ class AuthorizeCoinJoin(p.MessageType):
3: ('fee_per_anonymity', p.UVarintType, None),
4: ('address_n', p.UVarintType, p.FLAG_REPEATED),
5: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3)), 0), # default=BITCOIN
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3,)), 0), # default=BITCOIN
}

View File

@ -41,11 +41,11 @@ class BinanceOrderMsg(p.MessageType):
def get_fields(cls) -> Dict:
return {
1: ('id', p.UnicodeType, None),
2: ('ordertype', p.EnumType("BinanceOrderType", (0, 1, 2, 3)), None),
2: ('ordertype', p.EnumType("BinanceOrderType", (0, 1, 2, 3,)), None),
3: ('price', p.SVarintType, None),
4: ('quantity', p.SVarintType, None),
5: ('sender', p.UnicodeType, None),
6: ('side', p.EnumType("BinanceOrderSide", (0, 1, 2)), None),
6: ('side', p.EnumType("BinanceOrderSide", (0, 1, 2,)), None),
7: ('symbol', p.UnicodeType, None),
8: ('timeinforce', p.EnumType("BinanceTimeInForce", (0, 1, 2, 3)), None),
8: ('timeinforce', p.EnumType("BinanceTimeInForce", (0, 1, 2, 3,)), None),
}

View File

@ -24,5 +24,5 @@ class ButtonRequest(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('code', p.EnumType("ButtonRequestType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)), None),
1: ('code', p.EnumType("ButtonRequestType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,)), None),
}

View File

@ -33,7 +33,7 @@ class CardanoAddressParametersType(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('address_type', p.EnumType("CardanoAddressType", (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15)), p.FLAG_REQUIRED),
1: ('address_type', p.EnumType("CardanoAddressType", (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15,)), p.FLAG_REQUIRED),
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
3: ('address_n_staking', p.UVarintType, p.FLAG_REPEATED),
4: ('staking_key_hash', p.BytesType, None),

View File

@ -31,7 +31,7 @@ class CardanoPoolRelayParametersType(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoPoolRelayType", (0, 1, 2)), p.FLAG_REQUIRED),
1: ('type', p.EnumType("CardanoPoolRelayType", (0, 1, 2,)), p.FLAG_REQUIRED),
2: ('ipv4_address', p.BytesType, None),
3: ('ipv6_address', p.BytesType, None),
4: ('host_name', p.UnicodeType, None),

View File

@ -0,0 +1,35 @@
# Automatically generated by pb2py
# fmt: off
import protobuf as p
from .CardanoTxMetadataType import CardanoTxMetadataType
if __debug__:
try:
from typing import Dict, List, Optional # noqa: F401
from typing_extensions import Literal # noqa: F401
EnumTypeCardanoAuxiliaryDataType = Literal[0, 1]
except ImportError:
pass
class CardanoTxAuxiliaryDataType(p.MessageType):
def __init__(
self,
*,
type: EnumTypeCardanoAuxiliaryDataType,
blob: Optional[bytes] = None,
metadata: Optional[CardanoTxMetadataType] = None,
) -> None:
self.type = type
self.blob = blob
self.metadata = metadata
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoAuxiliaryDataType", (0, 1,)), p.FLAG_REQUIRED),
2: ('blob', p.BytesType, None),
3: ('metadata', CardanoTxMetadataType, None),
}

View File

@ -31,7 +31,7 @@ class CardanoTxCertificateType(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoCertificateType", (0, 1, 2, 3)), p.FLAG_REQUIRED),
1: ('type', p.EnumType("CardanoCertificateType", (0, 1, 2, 3,)), p.FLAG_REQUIRED),
2: ('path', p.UVarintType, p.FLAG_REPEATED),
3: ('pool', p.BytesType, None),
4: ('pool_parameters', CardanoPoolParametersType, None),

View File

@ -37,7 +37,7 @@ class DebugLinkDecision(p.MessageType):
def get_fields(cls) -> Dict:
return {
1: ('yes_no', p.BoolType, None),
2: ('swipe', p.EnumType("DebugSwipeDirection", (0, 1, 2, 3)), None),
2: ('swipe', p.EnumType("DebugSwipeDirection", (0, 1, 2, 3,)), None),
3: ('input', p.UnicodeType, None),
4: ('x', p.UVarintType, None),
5: ('y', p.UVarintType, None),

View File

@ -26,6 +26,6 @@ class Failure(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 99)), None),
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 99,)), None),
2: ('message', p.UnicodeType, None),
}

View File

@ -127,14 +127,14 @@ class Features(p.MessageType):
27: ('unfinished_backup', p.BoolType, None),
28: ('no_backup', p.BoolType, None),
29: ('recovery_mode', p.BoolType, None),
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)), p.FLAG_REPEATED),
31: ('backup_type', p.EnumType("BackupType", (0, 1, 2)), None),
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,)), p.FLAG_REPEATED),
31: ('backup_type', p.EnumType("BackupType", (0, 1, 2,)), None),
32: ('sd_card_present', p.BoolType, None),
33: ('sd_protection', p.BoolType, None),
34: ('wipe_code_protection', p.BoolType, None),
35: ('session_id', p.BytesType, None),
36: ('passphrase_always_on_device', p.BoolType, None),
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2)), None),
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2,)), None),
38: ('auto_lock_delay_ms', p.UVarintType, None),
39: ('display_rotation', p.UVarintType, None),
40: ('experimental_features', p.BoolType, None),

View File

@ -40,6 +40,6 @@ class GetAddress(p.MessageType):
2: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
3: ('show_display', p.BoolType, None),
4: ('multisig', MultisigRedeemScriptType, None),
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}

View File

@ -35,5 +35,5 @@ class GetOwnershipId(p.MessageType):
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
3: ('multisig', MultisigRedeemScriptType, None),
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
}

View File

@ -40,7 +40,7 @@ class GetOwnershipProof(p.MessageType):
return {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
3: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 3), # default=SPENDWITNESS
3: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 3), # default=SPENDWITNESS
4: ('multisig', MultisigRedeemScriptType, None),
5: ('user_confirmation', p.BoolType, False), # default=false
6: ('ownership_ids', p.BytesType, p.FLAG_REPEATED),

View File

@ -38,6 +38,6 @@ class GetPublicKey(p.MessageType):
2: ('ecdsa_curve_name', p.UnicodeType, None),
3: ('show_display', p.BoolType, None),
4: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}

View File

@ -41,7 +41,7 @@ class LiskTransactionCommon(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("LiskTransactionType", (0, 1, 2, 3, 4, 5, 6, 7)), None),
1: ('type', p.EnumType("LiskTransactionType", (0, 1, 2, 3, 4, 5, 6, 7,)), None),
2: ('amount', p.UVarintType, None),
3: ('fee', p.UVarintType, None),
4: ('recipient_id', p.UnicodeType, None),

View File

@ -25,6 +25,6 @@ class NEMCosignatoryModification(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("NEMModificationType", (1, 2)), None),
1: ('type', p.EnumType("NEMModificationType", (1, 2,)), None),
2: ('public_key', p.BytesType, None),
}

View File

@ -25,6 +25,6 @@ class NEMImportanceTransfer(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('mode', p.EnumType("NEMImportanceTransferMode", (1, 2)), None),
1: ('mode', p.EnumType("NEMImportanceTransferMode", (1, 2,)), None),
2: ('public_key', p.BytesType, None),
}

View File

@ -56,7 +56,7 @@ class NEMMosaicDefinition(p.MessageType):
3: ('namespace', p.UnicodeType, None),
4: ('mosaic', p.UnicodeType, None),
5: ('divisibility', p.UVarintType, None),
6: ('levy', p.EnumType("NEMMosaicLevy", (1, 2)), None),
6: ('levy', p.EnumType("NEMMosaicLevy", (1, 2,)), None),
7: ('fee', p.UVarintType, None),
8: ('levy_address', p.UnicodeType, None),
9: ('levy_namespace', p.UnicodeType, None),

View File

@ -31,6 +31,6 @@ class NEMMosaicSupplyChange(p.MessageType):
return {
1: ('namespace', p.UnicodeType, None),
2: ('mosaic', p.UnicodeType, None),
3: ('type', p.EnumType("NEMSupplyChangeType", (1, 2)), None),
3: ('type', p.EnumType("NEMSupplyChangeType", (1, 2,)), None),
4: ('delta', p.UVarintType, None),
}

View File

@ -46,7 +46,7 @@ class RecoveryDevice(p.MessageType):
4: ('language', p.UnicodeType, None),
5: ('label', p.UnicodeType, None),
6: ('enforce_wordlist', p.BoolType, None),
8: ('type', p.EnumType("RecoveryDeviceType", (0, 1)), None),
8: ('type', p.EnumType("RecoveryDeviceType", (0, 1,)), None),
9: ('u2f_counter', p.UVarintType, None),
10: ('dry_run', p.BoolType, None),
}

View File

@ -51,5 +51,5 @@ class ResetDevice(p.MessageType):
7: ('u2f_counter', p.UVarintType, None),
8: ('skip_backup', p.BoolType, None),
9: ('no_backup', p.BoolType, None),
10: ('backup_type', p.EnumType("BackupType", (0, 1, 2)), 0), # default=Bip39
10: ('backup_type', p.EnumType("BackupType", (0, 1, 2,)), 0), # default=Bip39
}

View File

@ -24,5 +24,5 @@ class SdProtect(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('operation', p.EnumType("SdProtectOperationType", (0, 1, 2)), None),
1: ('operation', p.EnumType("SdProtectOperationType", (0, 1, 2,)), None),
}

View File

@ -33,5 +33,5 @@ class SignMessage(p.MessageType):
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('message', p.BytesType, p.FLAG_REQUIRED),
3: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
}

View File

@ -53,6 +53,6 @@ class SignTx(p.MessageType):
8: ('version_group_id', p.UVarintType, None),
9: ('timestamp', p.UVarintType, None),
10: ('branch_id', p.UVarintType, None),
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3)), 0), # default=BITCOIN
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3,)), 0), # default=BITCOIN
12: ('decred_staking_ticket', p.BoolType, False), # default=false
}

View File

@ -32,5 +32,5 @@ class TezosBallotOp(p.MessageType):
1: ('source', p.BytesType, None),
2: ('period', p.UVarintType, None),
3: ('proposal', p.BytesType, None),
4: ('ballot', p.EnumType("TezosBallotType", (0, 1, 2)), None),
4: ('ballot', p.EnumType("TezosBallotType", (0, 1, 2,)), None),
}

View File

@ -25,6 +25,6 @@ class TezosContractID(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('tag', p.EnumType("TezosContractType", (0, 1)), p.FLAG_REQUIRED),
1: ('tag', p.EnumType("TezosContractType", (0, 1,)), p.FLAG_REQUIRED),
2: ('hash', p.BytesType, p.FLAG_REQUIRED),
}

View File

@ -59,7 +59,7 @@ class TxInput(p.MessageType):
3: ('prev_index', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_sig', p.BytesType, None),
5: ('sequence', p.UVarintType, 4294967295), # default=4294967295
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
7: ('multisig', MultisigRedeemScriptType, None),
8: ('amount', p.UVarintType, p.FLAG_REQUIRED),
9: ('decred_tree', p.UVarintType, None),
@ -68,5 +68,5 @@ class TxInput(p.MessageType):
15: ('commitment_data', p.BytesType, None),
16: ('orig_hash', p.BytesType, None),
17: ('orig_index', p.UVarintType, None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1)), None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1,)), None),
}

View File

@ -59,7 +59,7 @@ class TxInputType(p.MessageType):
3: ('prev_index', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_sig', p.BytesType, None),
5: ('sequence', p.UVarintType, 4294967295), # default=4294967295
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
7: ('multisig', MultisigRedeemScriptType, None),
8: ('amount', p.UVarintType, None),
9: ('decred_tree', p.UVarintType, None),
@ -68,5 +68,5 @@ class TxInputType(p.MessageType):
15: ('commitment_data', p.BytesType, None),
16: ('orig_hash', p.BytesType, None),
17: ('orig_index', p.UVarintType, None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1)), None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1,)), None),
}

View File

@ -42,7 +42,7 @@ class TxOutput(p.MessageType):
1: ('address', p.UnicodeType, None),
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
3: ('amount', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5,)), 0), # default=PAYTOADDRESS
5: ('multisig', MultisigRedeemScriptType, None),
6: ('op_return_data', p.BytesType, None),
10: ('orig_hash', p.BytesType, None),

View File

@ -42,7 +42,7 @@ class TxOutputType(p.MessageType):
1: ('address', p.UnicodeType, None),
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
3: ('amount', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5,)), 0), # default=PAYTOADDRESS
5: ('multisig', MultisigRedeemScriptType, None),
6: ('op_return_data', p.BytesType, None),
10: ('orig_hash', p.BytesType, None),

View File

@ -31,7 +31,7 @@ class TxRequest(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('request_type', p.EnumType("RequestType", (0, 1, 2, 3, 4, 5, 6)), None),
1: ('request_type', p.EnumType("RequestType", (0, 1, 2, 3, 4, 5, 6,)), None),
2: ('details', TxRequestDetailsType, None),
3: ('serialized', TxRequestSerializedType, None),
}

View File

@ -47,6 +47,6 @@ class ApplySettings(p.MessageType):
6: ('auto_lock_delay_ms', p.UVarintType, None),
7: ('display_rotation', p.UVarintType, None),
8: ('passphrase_always_on_device', p.BoolType, None),
9: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2)), None),
9: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2,)), None),
10: ('experimental_features', p.BoolType, None),
}

View File

@ -43,6 +43,6 @@ class AuthorizeCoinJoin(p.MessageType):
3: ('fee_per_anonymity', p.UVarintType, None),
4: ('address_n', p.UVarintType, p.FLAG_REPEATED),
5: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3)), 0), # default=BITCOIN
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3,)), 0), # default=BITCOIN
}

View File

@ -41,11 +41,11 @@ class BinanceOrderMsg(p.MessageType):
def get_fields(cls) -> Dict:
return {
1: ('id', p.UnicodeType, None),
2: ('ordertype', p.EnumType("BinanceOrderType", (0, 1, 2, 3)), None),
2: ('ordertype', p.EnumType("BinanceOrderType", (0, 1, 2, 3,)), None),
3: ('price', p.SVarintType, None),
4: ('quantity', p.SVarintType, None),
5: ('sender', p.UnicodeType, None),
6: ('side', p.EnumType("BinanceOrderSide", (0, 1, 2)), None),
6: ('side', p.EnumType("BinanceOrderSide", (0, 1, 2,)), None),
7: ('symbol', p.UnicodeType, None),
8: ('timeinforce', p.EnumType("BinanceTimeInForce", (0, 1, 2, 3)), None),
8: ('timeinforce', p.EnumType("BinanceTimeInForce", (0, 1, 2, 3,)), None),
}

View File

@ -24,5 +24,5 @@ class ButtonRequest(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('code', p.EnumType("ButtonRequestType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)), None),
1: ('code', p.EnumType("ButtonRequestType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,)), None),
}

View File

@ -33,7 +33,7 @@ class CardanoAddressParametersType(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('address_type', p.EnumType("CardanoAddressType", (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15)), p.FLAG_REQUIRED),
1: ('address_type', p.EnumType("CardanoAddressType", (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15,)), p.FLAG_REQUIRED),
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
3: ('address_n_staking', p.UVarintType, p.FLAG_REPEATED),
4: ('staking_key_hash', p.BytesType, None),

View File

@ -31,7 +31,7 @@ class CardanoPoolRelayParametersType(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoPoolRelayType", (0, 1, 2)), p.FLAG_REQUIRED),
1: ('type', p.EnumType("CardanoPoolRelayType", (0, 1, 2,)), p.FLAG_REQUIRED),
2: ('ipv4_address', p.BytesType, None),
3: ('ipv6_address', p.BytesType, None),
4: ('host_name', p.UnicodeType, None),

View File

@ -0,0 +1,35 @@
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
from .CardanoTxMetadataType import CardanoTxMetadataType
if __debug__:
try:
from typing import Dict, List, Optional # noqa: F401
from typing_extensions import Literal # noqa: F401
EnumTypeCardanoAuxiliaryDataType = Literal[0, 1]
except ImportError:
pass
class CardanoTxAuxiliaryDataType(p.MessageType):
def __init__(
self,
*,
type: EnumTypeCardanoAuxiliaryDataType,
blob: Optional[bytes] = None,
metadata: Optional[CardanoTxMetadataType] = None,
) -> None:
self.type = type
self.blob = blob
self.metadata = metadata
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoAuxiliaryDataType", (0, 1,)), p.FLAG_REQUIRED),
2: ('blob', p.BytesType, None),
3: ('metadata', CardanoTxMetadataType, None),
}

View File

@ -31,7 +31,7 @@ class CardanoTxCertificateType(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoCertificateType", (0, 1, 2, 3)), p.FLAG_REQUIRED),
1: ('type', p.EnumType("CardanoCertificateType", (0, 1, 2, 3,)), p.FLAG_REQUIRED),
2: ('path', p.UVarintType, p.FLAG_REPEATED),
3: ('pool', p.BytesType, None),
4: ('pool_parameters', CardanoPoolParametersType, None),

View File

@ -37,7 +37,7 @@ class DebugLinkDecision(p.MessageType):
def get_fields(cls) -> Dict:
return {
1: ('yes_no', p.BoolType, None),
2: ('swipe', p.EnumType("DebugSwipeDirection", (0, 1, 2, 3)), None),
2: ('swipe', p.EnumType("DebugSwipeDirection", (0, 1, 2, 3,)), None),
3: ('input', p.UnicodeType, None),
4: ('x', p.UVarintType, None),
5: ('y', p.UVarintType, None),

View File

@ -26,6 +26,6 @@ class Failure(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 99)), None),
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 99,)), None),
2: ('message', p.UnicodeType, None),
}

View File

@ -127,14 +127,14 @@ class Features(p.MessageType):
27: ('unfinished_backup', p.BoolType, None),
28: ('no_backup', p.BoolType, None),
29: ('recovery_mode', p.BoolType, None),
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)), p.FLAG_REPEATED),
31: ('backup_type', p.EnumType("BackupType", (0, 1, 2)), None),
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,)), p.FLAG_REPEATED),
31: ('backup_type', p.EnumType("BackupType", (0, 1, 2,)), None),
32: ('sd_card_present', p.BoolType, None),
33: ('sd_protection', p.BoolType, None),
34: ('wipe_code_protection', p.BoolType, None),
35: ('session_id', p.BytesType, None),
36: ('passphrase_always_on_device', p.BoolType, None),
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2)), None),
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1, 2,)), None),
38: ('auto_lock_delay_ms', p.UVarintType, None),
39: ('display_rotation', p.UVarintType, None),
40: ('experimental_features', p.BoolType, None),

View File

@ -40,6 +40,6 @@ class GetAddress(p.MessageType):
2: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
3: ('show_display', p.BoolType, None),
4: ('multisig', MultisigRedeemScriptType, None),
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}

View File

@ -35,5 +35,5 @@ class GetOwnershipId(p.MessageType):
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
3: ('multisig', MultisigRedeemScriptType, None),
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
}

View File

@ -40,7 +40,7 @@ class GetOwnershipProof(p.MessageType):
return {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
3: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 3), # default=SPENDWITNESS
3: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 3), # default=SPENDWITNESS
4: ('multisig', MultisigRedeemScriptType, None),
5: ('user_confirmation', p.BoolType, False), # default=false
6: ('ownership_ids', p.BytesType, p.FLAG_REPEATED),

View File

@ -38,6 +38,6 @@ class GetPublicKey(p.MessageType):
2: ('ecdsa_curve_name', p.UnicodeType, None),
3: ('show_display', p.BoolType, None),
4: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}

View File

@ -41,7 +41,7 @@ class LiskTransactionCommon(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("LiskTransactionType", (0, 1, 2, 3, 4, 5, 6, 7)), None),
1: ('type', p.EnumType("LiskTransactionType", (0, 1, 2, 3, 4, 5, 6, 7,)), None),
2: ('amount', p.UVarintType, None),
3: ('fee', p.UVarintType, None),
4: ('recipient_id', p.UnicodeType, None),

View File

@ -25,6 +25,6 @@ class NEMCosignatoryModification(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("NEMModificationType", (1, 2)), None),
1: ('type', p.EnumType("NEMModificationType", (1, 2,)), None),
2: ('public_key', p.BytesType, None),
}

View File

@ -25,6 +25,6 @@ class NEMImportanceTransfer(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('mode', p.EnumType("NEMImportanceTransferMode", (1, 2)), None),
1: ('mode', p.EnumType("NEMImportanceTransferMode", (1, 2,)), None),
2: ('public_key', p.BytesType, None),
}

View File

@ -56,7 +56,7 @@ class NEMMosaicDefinition(p.MessageType):
3: ('namespace', p.UnicodeType, None),
4: ('mosaic', p.UnicodeType, None),
5: ('divisibility', p.UVarintType, None),
6: ('levy', p.EnumType("NEMMosaicLevy", (1, 2)), None),
6: ('levy', p.EnumType("NEMMosaicLevy", (1, 2,)), None),
7: ('fee', p.UVarintType, None),
8: ('levy_address', p.UnicodeType, None),
9: ('levy_namespace', p.UnicodeType, None),

View File

@ -31,6 +31,6 @@ class NEMMosaicSupplyChange(p.MessageType):
return {
1: ('namespace', p.UnicodeType, None),
2: ('mosaic', p.UnicodeType, None),
3: ('type', p.EnumType("NEMSupplyChangeType", (1, 2)), None),
3: ('type', p.EnumType("NEMSupplyChangeType", (1, 2,)), None),
4: ('delta', p.UVarintType, None),
}

View File

@ -24,5 +24,5 @@ class PinMatrixRequest(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("PinMatrixRequestType", (1, 2, 3, 4, 5)), None),
1: ('type', p.EnumType("PinMatrixRequestType", (1, 2, 3, 4, 5,)), None),
}

View File

@ -46,7 +46,7 @@ class RecoveryDevice(p.MessageType):
4: ('language', p.UnicodeType, None),
5: ('label', p.UnicodeType, None),
6: ('enforce_wordlist', p.BoolType, None),
8: ('type', p.EnumType("RecoveryDeviceType", (0, 1)), None),
8: ('type', p.EnumType("RecoveryDeviceType", (0, 1,)), None),
9: ('u2f_counter', p.UVarintType, None),
10: ('dry_run', p.BoolType, None),
}

View File

@ -51,5 +51,5 @@ class ResetDevice(p.MessageType):
7: ('u2f_counter', p.UVarintType, None),
8: ('skip_backup', p.BoolType, None),
9: ('no_backup', p.BoolType, None),
10: ('backup_type', p.EnumType("BackupType", (0, 1, 2)), 0), # default=Bip39
10: ('backup_type', p.EnumType("BackupType", (0, 1, 2,)), 0), # default=Bip39
}

View File

@ -24,5 +24,5 @@ class SdProtect(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('operation', p.EnumType("SdProtectOperationType", (0, 1, 2)), None),
1: ('operation', p.EnumType("SdProtectOperationType", (0, 1, 2,)), None),
}

View File

@ -33,5 +33,5 @@ class SignMessage(p.MessageType):
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('message', p.BytesType, p.FLAG_REQUIRED),
3: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
}

View File

@ -56,6 +56,6 @@ class SignTx(p.MessageType):
8: ('version_group_id', p.UVarintType, None),
9: ('timestamp', p.UVarintType, None),
10: ('branch_id', p.UVarintType, None),
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3)), 0), # default=BITCOIN
11: ('amount_unit', p.EnumType("AmountUnit", (0, 1, 2, 3,)), 0), # default=BITCOIN
12: ('decred_staking_ticket', p.BoolType, False), # default=false
}

View File

@ -32,5 +32,5 @@ class TezosBallotOp(p.MessageType):
1: ('source', p.BytesType, None),
2: ('period', p.UVarintType, None),
3: ('proposal', p.BytesType, None),
4: ('ballot', p.EnumType("TezosBallotType", (0, 1, 2)), None),
4: ('ballot', p.EnumType("TezosBallotType", (0, 1, 2,)), None),
}

View File

@ -25,6 +25,6 @@ class TezosContractID(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('tag', p.EnumType("TezosContractType", (0, 1)), p.FLAG_REQUIRED),
1: ('tag', p.EnumType("TezosContractType", (0, 1,)), p.FLAG_REQUIRED),
2: ('hash', p.BytesType, p.FLAG_REQUIRED),
}

View File

@ -59,7 +59,7 @@ class TxInput(p.MessageType):
3: ('prev_index', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_sig', p.BytesType, None),
5: ('sequence', p.UVarintType, 4294967295), # default=4294967295
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
7: ('multisig', MultisigRedeemScriptType, None),
8: ('amount', p.UVarintType, p.FLAG_REQUIRED),
9: ('decred_tree', p.UVarintType, None),
@ -68,5 +68,5 @@ class TxInput(p.MessageType):
15: ('commitment_data', p.BytesType, None),
16: ('orig_hash', p.BytesType, None),
17: ('orig_index', p.UVarintType, None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1)), None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1,)), None),
}

View File

@ -59,7 +59,7 @@ class TxInputType(p.MessageType):
3: ('prev_index', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_sig', p.BytesType, None),
5: ('sequence', p.UVarintType, 4294967295), # default=4294967295
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4,)), 0), # default=SPENDADDRESS
7: ('multisig', MultisigRedeemScriptType, None),
8: ('amount', p.UVarintType, None),
9: ('decred_tree', p.UVarintType, None),
@ -68,5 +68,5 @@ class TxInputType(p.MessageType):
15: ('commitment_data', p.BytesType, None),
16: ('orig_hash', p.BytesType, None),
17: ('orig_index', p.UVarintType, None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1)), None),
18: ('decred_staking_spend', p.EnumType("DecredStakingSpendType", (0, 1,)), None),
}

View File

@ -42,7 +42,7 @@ class TxOutput(p.MessageType):
1: ('address', p.UnicodeType, None),
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
3: ('amount', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5,)), 0), # default=PAYTOADDRESS
5: ('multisig', MultisigRedeemScriptType, None),
6: ('op_return_data', p.BytesType, None),
10: ('orig_hash', p.BytesType, None),

View File

@ -42,7 +42,7 @@ class TxOutputType(p.MessageType):
1: ('address', p.UnicodeType, None),
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
3: ('amount', p.UVarintType, p.FLAG_REQUIRED),
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS
4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5,)), 0), # default=PAYTOADDRESS
5: ('multisig', MultisigRedeemScriptType, None),
6: ('op_return_data', p.BytesType, None),
10: ('orig_hash', p.BytesType, None),

View File

@ -31,7 +31,7 @@ class TxRequest(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('request_type', p.EnumType("RequestType", (0, 1, 2, 3, 4, 5, 6)), None),
1: ('request_type', p.EnumType("RequestType", (0, 1, 2, 3, 4, 5, 6,)), None),
2: ('details', TxRequestDetailsType, None),
3: ('serialized', TxRequestSerializedType, None),
}

View File

@ -24,5 +24,5 @@ class WordRequest(p.MessageType):
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("WordRequestType", (0, 1, 2)), None),
1: ('type', p.EnumType("WordRequestType", (0, 1, 2,)), None),
}