diff --git a/src/trezor/messages/Address.py b/src/trezor/messages/Address.py index c780dc320a..4296c51de4 100644 --- a/src/trezor/messages/Address.py +++ b/src/trezor/messages/Address.py @@ -3,15 +3,13 @@ import protobuf as p class Address(p.MessageType): + MESSAGE_WIRE_TYPE = 30 FIELDS = { 1: ('address', p.UnicodeType, 0), # required } - MESSAGE_WIRE_TYPE = 30 def __init__( self, - address: str = None, - **kwargs, - ): + address: str = None + ) -> None: self.address = address - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ApplyFlags.py b/src/trezor/messages/ApplyFlags.py index 9fd1151d8a..32217a28f0 100644 --- a/src/trezor/messages/ApplyFlags.py +++ b/src/trezor/messages/ApplyFlags.py @@ -3,15 +3,13 @@ import protobuf as p class ApplyFlags(p.MessageType): + MESSAGE_WIRE_TYPE = 28 FIELDS = { 1: ('flags', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 28 def __init__( self, - flags: int = None, - **kwargs, - ): + flags: int = None + ) -> None: self.flags = flags - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ApplySettings.py b/src/trezor/messages/ApplySettings.py index 6f7d34c1b9..3432a3f71c 100644 --- a/src/trezor/messages/ApplySettings.py +++ b/src/trezor/messages/ApplySettings.py @@ -3,6 +3,7 @@ import protobuf as p class ApplySettings(p.MessageType): + MESSAGE_WIRE_TYPE = 25 FIELDS = { 1: ('language', p.UnicodeType, 0), 2: ('label', p.UnicodeType, 0), @@ -11,7 +12,6 @@ class ApplySettings(p.MessageType): 5: ('passphrase_source', p.UVarintType, 0), 6: ('auto_lock_delay_ms', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 25 def __init__( self, @@ -20,13 +20,11 @@ class ApplySettings(p.MessageType): use_passphrase: bool = None, homescreen: bytes = None, passphrase_source: int = None, - auto_lock_delay_ms: int = None, - **kwargs, - ): + auto_lock_delay_ms: int = None + ) -> None: self.language = language self.label = label self.use_passphrase = use_passphrase self.homescreen = homescreen self.passphrase_source = passphrase_source self.auto_lock_delay_ms = auto_lock_delay_ms - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/BackupDevice.py b/src/trezor/messages/BackupDevice.py index 9b17da6ace..f44788ff8d 100644 --- a/src/trezor/messages/BackupDevice.py +++ b/src/trezor/messages/BackupDevice.py @@ -4,9 +4,3 @@ import protobuf as p class BackupDevice(p.MessageType): MESSAGE_WIRE_TYPE = 34 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ButtonAck.py b/src/trezor/messages/ButtonAck.py index 018274913f..08b1691836 100644 --- a/src/trezor/messages/ButtonAck.py +++ b/src/trezor/messages/ButtonAck.py @@ -4,9 +4,3 @@ import protobuf as p class ButtonAck(p.MessageType): MESSAGE_WIRE_TYPE = 27 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ButtonRequest.py b/src/trezor/messages/ButtonRequest.py index fed1c92110..60d96c824a 100644 --- a/src/trezor/messages/ButtonRequest.py +++ b/src/trezor/messages/ButtonRequest.py @@ -3,18 +3,16 @@ import protobuf as p class ButtonRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 26 FIELDS = { 1: ('code', p.UVarintType, 0), 2: ('data', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 26 def __init__( self, code: int = None, - data: str = None, - **kwargs, - ): + data: str = None + ) -> None: self.code = code self.data = data - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ButtonRequestType.py b/src/trezor/messages/ButtonRequestType.py index 786167e527..bfe32c7a44 100644 --- a/src/trezor/messages/ButtonRequestType.py +++ b/src/trezor/messages/ButtonRequestType.py @@ -1,17 +1,15 @@ # Automatically generated by pb2py -from micropython import const - -Other = const(1) -FeeOverThreshold = const(2) -ConfirmOutput = const(3) -ResetDevice = const(4) -ConfirmWord = const(5) -WipeDevice = const(6) -ProtectCall = const(7) -SignTx = const(8) -FirmwareCheck = const(9) -Address = const(10) -PublicKey = const(11) -MnemonicWordCount = const(12) -MnemonicInput = const(13) -PassphraseType = const(14) +Other = 1 +FeeOverThreshold = 2 +ConfirmOutput = 3 +ResetDevice = 4 +ConfirmWord = 5 +WipeDevice = 6 +ProtectCall = 7 +SignTx = 8 +FirmwareCheck = 9 +Address = 10 +PublicKey = 11 +MnemonicWordCount = 12 +MnemonicInput = 13 +PassphraseType = 14 diff --git a/src/trezor/messages/Cancel.py b/src/trezor/messages/Cancel.py index 151af97ce8..4f8a68df71 100644 --- a/src/trezor/messages/Cancel.py +++ b/src/trezor/messages/Cancel.py @@ -4,9 +4,3 @@ import protobuf as p class Cancel(p.MessageType): MESSAGE_WIRE_TYPE = 20 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ChangePin.py b/src/trezor/messages/ChangePin.py index 4289c8010d..27f975a49a 100644 --- a/src/trezor/messages/ChangePin.py +++ b/src/trezor/messages/ChangePin.py @@ -3,15 +3,13 @@ import protobuf as p class ChangePin(p.MessageType): + MESSAGE_WIRE_TYPE = 4 FIELDS = { 1: ('remove', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 4 def __init__( self, - remove: bool = None, - **kwargs, - ): + remove: bool = None + ) -> None: self.remove = remove - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/CipherKeyValue.py b/src/trezor/messages/CipherKeyValue.py index ee471f1d7d..32c8e814b6 100644 --- a/src/trezor/messages/CipherKeyValue.py +++ b/src/trezor/messages/CipherKeyValue.py @@ -1,8 +1,14 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class CipherKeyValue(p.MessageType): + MESSAGE_WIRE_TYPE = 23 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('key', p.UnicodeType, 0), @@ -12,24 +18,21 @@ class CipherKeyValue(p.MessageType): 6: ('ask_on_decrypt', p.BoolType, 0), 7: ('iv', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 23 def __init__( self, - address_n: list = None, + address_n: List[int] = None, key: str = None, value: bytes = None, encrypt: bool = None, ask_on_encrypt: bool = None, ask_on_decrypt: bool = None, - iv: bytes = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + iv: bytes = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.key = key self.value = value self.encrypt = encrypt self.ask_on_encrypt = ask_on_encrypt self.ask_on_decrypt = ask_on_decrypt self.iv = iv - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/CipheredKeyValue.py b/src/trezor/messages/CipheredKeyValue.py index 7fe8dc9d4f..d091981b64 100644 --- a/src/trezor/messages/CipheredKeyValue.py +++ b/src/trezor/messages/CipheredKeyValue.py @@ -3,15 +3,13 @@ import protobuf as p class CipheredKeyValue(p.MessageType): + MESSAGE_WIRE_TYPE = 48 FIELDS = { 1: ('value', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 48 def __init__( self, - value: bytes = None, - **kwargs, - ): + value: bytes = None + ) -> None: self.value = value - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ClearSession.py b/src/trezor/messages/ClearSession.py index 9ab99e9ebe..808d5b76ee 100644 --- a/src/trezor/messages/ClearSession.py +++ b/src/trezor/messages/ClearSession.py @@ -4,9 +4,3 @@ import protobuf as p class ClearSession(p.MessageType): MESSAGE_WIRE_TYPE = 24 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/CosiCommit.py b/src/trezor/messages/CosiCommit.py index 83c42720d6..dd85dc8ace 100644 --- a/src/trezor/messages/CosiCommit.py +++ b/src/trezor/messages/CosiCommit.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class CosiCommit(p.MessageType): + MESSAGE_WIRE_TYPE = 71 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('data', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 71 def __init__( self, - address_n: list = None, - data: bytes = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + address_n: List[int] = None, + data: bytes = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.data = data - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/CosiCommitment.py b/src/trezor/messages/CosiCommitment.py index 468ac88408..d83cbd52c4 100644 --- a/src/trezor/messages/CosiCommitment.py +++ b/src/trezor/messages/CosiCommitment.py @@ -3,18 +3,16 @@ import protobuf as p class CosiCommitment(p.MessageType): + MESSAGE_WIRE_TYPE = 72 FIELDS = { 1: ('commitment', p.BytesType, 0), 2: ('pubkey', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 72 def __init__( self, commitment: bytes = None, - pubkey: bytes = None, - **kwargs, - ): + pubkey: bytes = None + ) -> None: self.commitment = commitment self.pubkey = pubkey - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/CosiSign.py b/src/trezor/messages/CosiSign.py index 681ba896ee..6dc0183035 100644 --- a/src/trezor/messages/CosiSign.py +++ b/src/trezor/messages/CosiSign.py @@ -1,26 +1,29 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class CosiSign(p.MessageType): + MESSAGE_WIRE_TYPE = 73 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('data', p.BytesType, 0), 3: ('global_commitment', p.BytesType, 0), 4: ('global_pubkey', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 73 def __init__( self, - address_n: list = None, + address_n: List[int] = None, data: bytes = None, global_commitment: bytes = None, - global_pubkey: bytes = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + global_pubkey: bytes = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.data = data self.global_commitment = global_commitment self.global_pubkey = global_pubkey - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/CosiSignature.py b/src/trezor/messages/CosiSignature.py index 19bf191928..69ec65e6d5 100644 --- a/src/trezor/messages/CosiSignature.py +++ b/src/trezor/messages/CosiSignature.py @@ -3,15 +3,13 @@ import protobuf as p class CosiSignature(p.MessageType): + MESSAGE_WIRE_TYPE = 74 FIELDS = { 1: ('signature', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 74 def __init__( self, - signature: bytes = None, - **kwargs, - ): + signature: bytes = None + ) -> None: self.signature = signature - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkDecision.py b/src/trezor/messages/DebugLinkDecision.py index e0facd3700..bcc8f247e3 100644 --- a/src/trezor/messages/DebugLinkDecision.py +++ b/src/trezor/messages/DebugLinkDecision.py @@ -3,21 +3,19 @@ import protobuf as p class DebugLinkDecision(p.MessageType): + MESSAGE_WIRE_TYPE = 100 FIELDS = { 1: ('yes_no', p.BoolType, 0), 2: ('up_down', p.BoolType, 0), 3: ('input', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 100 def __init__( self, yes_no: bool = None, up_down: bool = None, - input: str = None, - **kwargs, - ): + input: str = None + ) -> None: self.yes_no = yes_no self.up_down = up_down self.input = input - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkFlashErase.py b/src/trezor/messages/DebugLinkFlashErase.py index 45d4ce0146..74f36a8059 100644 --- a/src/trezor/messages/DebugLinkFlashErase.py +++ b/src/trezor/messages/DebugLinkFlashErase.py @@ -3,15 +3,13 @@ import protobuf as p class DebugLinkFlashErase(p.MessageType): + MESSAGE_WIRE_TYPE = 113 FIELDS = { 1: ('sector', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 113 def __init__( self, - sector: int = None, - **kwargs, - ): + sector: int = None + ) -> None: self.sector = sector - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkGetState.py b/src/trezor/messages/DebugLinkGetState.py index 7332103306..35cbbf9afe 100644 --- a/src/trezor/messages/DebugLinkGetState.py +++ b/src/trezor/messages/DebugLinkGetState.py @@ -4,9 +4,3 @@ import protobuf as p class DebugLinkGetState(p.MessageType): MESSAGE_WIRE_TYPE = 101 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkLog.py b/src/trezor/messages/DebugLinkLog.py index 61d8ff3b82..953267d2ba 100644 --- a/src/trezor/messages/DebugLinkLog.py +++ b/src/trezor/messages/DebugLinkLog.py @@ -3,21 +3,19 @@ import protobuf as p class DebugLinkLog(p.MessageType): + MESSAGE_WIRE_TYPE = 104 FIELDS = { 1: ('level', p.UVarintType, 0), 2: ('bucket', p.UnicodeType, 0), 3: ('text', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 104 def __init__( self, level: int = None, bucket: str = None, - text: str = None, - **kwargs, - ): + text: str = None + ) -> None: self.level = level self.bucket = bucket self.text = text - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkMemory.py b/src/trezor/messages/DebugLinkMemory.py index 6cdbd3fc44..59880190fb 100644 --- a/src/trezor/messages/DebugLinkMemory.py +++ b/src/trezor/messages/DebugLinkMemory.py @@ -3,15 +3,13 @@ import protobuf as p class DebugLinkMemory(p.MessageType): + MESSAGE_WIRE_TYPE = 111 FIELDS = { 1: ('memory', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 111 def __init__( self, - memory: bytes = None, - **kwargs, - ): + memory: bytes = None + ) -> None: self.memory = memory - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkMemoryRead.py b/src/trezor/messages/DebugLinkMemoryRead.py index 9adc1cdf3e..22b07a4fe9 100644 --- a/src/trezor/messages/DebugLinkMemoryRead.py +++ b/src/trezor/messages/DebugLinkMemoryRead.py @@ -3,18 +3,16 @@ import protobuf as p class DebugLinkMemoryRead(p.MessageType): + MESSAGE_WIRE_TYPE = 110 FIELDS = { 1: ('address', p.UVarintType, 0), 2: ('length', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 110 def __init__( self, address: int = None, - length: int = None, - **kwargs, - ): + length: int = None + ) -> None: self.address = address self.length = length - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkMemoryWrite.py b/src/trezor/messages/DebugLinkMemoryWrite.py index a6a83bc78f..9e1228aca3 100644 --- a/src/trezor/messages/DebugLinkMemoryWrite.py +++ b/src/trezor/messages/DebugLinkMemoryWrite.py @@ -3,21 +3,19 @@ import protobuf as p class DebugLinkMemoryWrite(p.MessageType): + MESSAGE_WIRE_TYPE = 112 FIELDS = { 1: ('address', p.UVarintType, 0), 2: ('memory', p.BytesType, 0), 3: ('flash', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 112 def __init__( self, address: int = None, memory: bytes = None, - flash: bool = None, - **kwargs, - ): + flash: bool = None + ) -> None: self.address = address self.memory = memory self.flash = flash - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkState.py b/src/trezor/messages/DebugLinkState.py index c8f5d92e55..53168b3e7c 100644 --- a/src/trezor/messages/DebugLinkState.py +++ b/src/trezor/messages/DebugLinkState.py @@ -4,6 +4,7 @@ from .HDNodeType import HDNodeType class DebugLinkState(p.MessageType): + MESSAGE_WIRE_TYPE = 102 FIELDS = { 1: ('layout', p.BytesType, 0), 2: ('pin', p.UnicodeType, 0), @@ -17,7 +18,6 @@ class DebugLinkState(p.MessageType): 10: ('recovery_word_pos', p.UVarintType, 0), 11: ('reset_word_pos', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 102 def __init__( self, @@ -31,9 +31,8 @@ class DebugLinkState(p.MessageType): reset_entropy: bytes = None, recovery_fake_word: str = None, recovery_word_pos: int = None, - reset_word_pos: int = None, - **kwargs, - ): + reset_word_pos: int = None + ) -> None: self.layout = layout self.pin = pin self.matrix = matrix @@ -45,4 +44,3 @@ class DebugLinkState(p.MessageType): self.recovery_fake_word = recovery_fake_word self.recovery_word_pos = recovery_word_pos self.reset_word_pos = reset_word_pos - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DebugLinkStop.py b/src/trezor/messages/DebugLinkStop.py index c643fba0d6..5025da0b96 100644 --- a/src/trezor/messages/DebugLinkStop.py +++ b/src/trezor/messages/DebugLinkStop.py @@ -4,9 +4,3 @@ import protobuf as p class DebugLinkStop(p.MessageType): MESSAGE_WIRE_TYPE = 103 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DecryptMessage.py b/src/trezor/messages/DecryptMessage.py index b995e5b044..f4fb6402a1 100644 --- a/src/trezor/messages/DecryptMessage.py +++ b/src/trezor/messages/DecryptMessage.py @@ -1,26 +1,29 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class DecryptMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 51 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('nonce', p.BytesType, 0), 3: ('message', p.BytesType, 0), 4: ('hmac', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 51 def __init__( self, - address_n: list = None, + address_n: List[int] = None, nonce: bytes = None, message: bytes = None, - hmac: bytes = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + hmac: bytes = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.nonce = nonce self.message = message self.hmac = hmac - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/DecryptedMessage.py b/src/trezor/messages/DecryptedMessage.py index 1a4a6039d6..53612b23ac 100644 --- a/src/trezor/messages/DecryptedMessage.py +++ b/src/trezor/messages/DecryptedMessage.py @@ -3,18 +3,16 @@ import protobuf as p class DecryptedMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 52 FIELDS = { 1: ('message', p.BytesType, 0), 2: ('address', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 52 def __init__( self, message: bytes = None, - address: str = None, - **kwargs, - ): + address: str = None + ) -> None: self.message = message self.address = address - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/ECDHSessionKey.py b/src/trezor/messages/ECDHSessionKey.py index 6c16d7b1a3..3369dd366d 100644 --- a/src/trezor/messages/ECDHSessionKey.py +++ b/src/trezor/messages/ECDHSessionKey.py @@ -3,15 +3,13 @@ import protobuf as p class ECDHSessionKey(p.MessageType): + MESSAGE_WIRE_TYPE = 62 FIELDS = { 1: ('session_key', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 62 def __init__( self, - session_key: bytes = None, - **kwargs, - ): + session_key: bytes = None + ) -> None: self.session_key = session_key - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EncryptMessage.py b/src/trezor/messages/EncryptMessage.py index 4f07edb759..f47bb7a862 100644 --- a/src/trezor/messages/EncryptMessage.py +++ b/src/trezor/messages/EncryptMessage.py @@ -1,8 +1,14 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class EncryptMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 49 FIELDS = { 1: ('pubkey', p.BytesType, 0), 2: ('message', p.BytesType, 0), @@ -10,20 +16,17 @@ class EncryptMessage(p.MessageType): 4: ('address_n', p.UVarintType, p.FLAG_REPEATED), 5: ('coin_name', p.UnicodeType, 0), # default='Bitcoin' } - MESSAGE_WIRE_TYPE = 49 def __init__( self, pubkey: bytes = None, message: bytes = None, display_only: bool = None, - address_n: list = None, - coin_name: str = None, - **kwargs, - ): + address_n: List[int] = None, + coin_name: str = None + ) -> None: self.pubkey = pubkey self.message = message self.display_only = display_only - self.address_n = [] if address_n is None else address_n + self.address_n = address_n if address_n is not None else [] self.coin_name = coin_name - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EncryptedMessage.py b/src/trezor/messages/EncryptedMessage.py index 1126176b82..e7ba4e59cd 100644 --- a/src/trezor/messages/EncryptedMessage.py +++ b/src/trezor/messages/EncryptedMessage.py @@ -3,21 +3,19 @@ import protobuf as p class EncryptedMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 50 FIELDS = { 1: ('nonce', p.BytesType, 0), 2: ('message', p.BytesType, 0), 3: ('hmac', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 50 def __init__( self, nonce: bytes = None, message: bytes = None, - hmac: bytes = None, - **kwargs, - ): + hmac: bytes = None + ) -> None: self.nonce = nonce self.message = message self.hmac = hmac - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/Entropy.py b/src/trezor/messages/Entropy.py index 801ba0bdf3..dfcb22859b 100644 --- a/src/trezor/messages/Entropy.py +++ b/src/trezor/messages/Entropy.py @@ -3,15 +3,13 @@ import protobuf as p class Entropy(p.MessageType): + MESSAGE_WIRE_TYPE = 10 FIELDS = { 1: ('entropy', p.BytesType, 0), # required } - MESSAGE_WIRE_TYPE = 10 def __init__( self, - entropy: bytes = None, - **kwargs, - ): + entropy: bytes = None + ) -> None: self.entropy = entropy - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EntropyAck.py b/src/trezor/messages/EntropyAck.py index bcfe63b1ff..1032635e9f 100644 --- a/src/trezor/messages/EntropyAck.py +++ b/src/trezor/messages/EntropyAck.py @@ -3,15 +3,13 @@ import protobuf as p class EntropyAck(p.MessageType): + MESSAGE_WIRE_TYPE = 36 FIELDS = { 1: ('entropy', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 36 def __init__( self, - entropy: bytes = None, - **kwargs, - ): + entropy: bytes = None + ) -> None: self.entropy = entropy - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EntropyRequest.py b/src/trezor/messages/EntropyRequest.py index aefdf109fe..fa732dacc6 100644 --- a/src/trezor/messages/EntropyRequest.py +++ b/src/trezor/messages/EntropyRequest.py @@ -4,9 +4,3 @@ import protobuf as p class EntropyRequest(p.MessageType): MESSAGE_WIRE_TYPE = 35 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EstimateTxSize.py b/src/trezor/messages/EstimateTxSize.py index db0bf8c4db..6f5548698f 100644 --- a/src/trezor/messages/EstimateTxSize.py +++ b/src/trezor/messages/EstimateTxSize.py @@ -3,21 +3,19 @@ import protobuf as p class EstimateTxSize(p.MessageType): + MESSAGE_WIRE_TYPE = 43 FIELDS = { 1: ('outputs_count', p.UVarintType, 0), # required 2: ('inputs_count', p.UVarintType, 0), # required 3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin' } - MESSAGE_WIRE_TYPE = 43 def __init__( self, outputs_count: int = None, inputs_count: int = None, - coin_name: str = None, - **kwargs, - ): + coin_name: str = None + ) -> None: self.outputs_count = outputs_count self.inputs_count = inputs_count self.coin_name = coin_name - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumAddress.py b/src/trezor/messages/EthereumAddress.py index e48518f356..908c9516c5 100644 --- a/src/trezor/messages/EthereumAddress.py +++ b/src/trezor/messages/EthereumAddress.py @@ -3,15 +3,13 @@ import protobuf as p class EthereumAddress(p.MessageType): + MESSAGE_WIRE_TYPE = 57 FIELDS = { 1: ('address', p.BytesType, 0), # required } - MESSAGE_WIRE_TYPE = 57 def __init__( self, - address: bytes = None, - **kwargs, - ): + address: bytes = None + ) -> None: self.address = address - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumGetAddress.py b/src/trezor/messages/EthereumGetAddress.py index a98a8e9f19..6d05f502ac 100644 --- a/src/trezor/messages/EthereumGetAddress.py +++ b/src/trezor/messages/EthereumGetAddress.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class EthereumGetAddress(p.MessageType): + MESSAGE_WIRE_TYPE = 56 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('show_display', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 56 def __init__( self, - address_n: list = None, - show_display: bool = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + address_n: List[int] = None, + show_display: bool = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.show_display = show_display - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumMessageSignature.py b/src/trezor/messages/EthereumMessageSignature.py index 49f454a2a3..4e84668c2a 100644 --- a/src/trezor/messages/EthereumMessageSignature.py +++ b/src/trezor/messages/EthereumMessageSignature.py @@ -3,18 +3,16 @@ import protobuf as p class EthereumMessageSignature(p.MessageType): + MESSAGE_WIRE_TYPE = 66 FIELDS = { 1: ('address', p.BytesType, 0), 2: ('signature', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 66 def __init__( self, address: bytes = None, - signature: bytes = None, - **kwargs, - ): + signature: bytes = None + ) -> None: self.address = address self.signature = signature - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumSignMessage.py b/src/trezor/messages/EthereumSignMessage.py index d741bf9828..18ff53d789 100644 --- a/src/trezor/messages/EthereumSignMessage.py +++ b/src/trezor/messages/EthereumSignMessage.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class EthereumSignMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 64 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('message', p.BytesType, 0), # required } - MESSAGE_WIRE_TYPE = 64 def __init__( self, - address_n: list = None, - message: bytes = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + address_n: List[int] = None, + message: bytes = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.message = message - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumSignTx.py b/src/trezor/messages/EthereumSignTx.py index c3e1d444c1..5b1f0883d6 100644 --- a/src/trezor/messages/EthereumSignTx.py +++ b/src/trezor/messages/EthereumSignTx.py @@ -1,8 +1,14 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class EthereumSignTx(p.MessageType): + MESSAGE_WIRE_TYPE = 58 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('nonce', p.BytesType, 0), @@ -15,11 +21,10 @@ class EthereumSignTx(p.MessageType): 9: ('chain_id', p.UVarintType, 0), 10: ('tx_type', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 58 def __init__( self, - address_n: list = None, + address_n: List[int] = None, nonce: bytes = None, gas_price: bytes = None, gas_limit: bytes = None, @@ -28,10 +33,9 @@ class EthereumSignTx(p.MessageType): data_initial_chunk: bytes = None, data_length: int = None, chain_id: int = None, - tx_type: int = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + tx_type: int = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.nonce = nonce self.gas_price = gas_price self.gas_limit = gas_limit @@ -41,4 +45,3 @@ class EthereumSignTx(p.MessageType): self.data_length = data_length self.chain_id = chain_id self.tx_type = tx_type - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumTxAck.py b/src/trezor/messages/EthereumTxAck.py index c874093adc..68ed7102d3 100644 --- a/src/trezor/messages/EthereumTxAck.py +++ b/src/trezor/messages/EthereumTxAck.py @@ -3,15 +3,13 @@ import protobuf as p class EthereumTxAck(p.MessageType): + MESSAGE_WIRE_TYPE = 60 FIELDS = { 1: ('data_chunk', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 60 def __init__( self, - data_chunk: bytes = None, - **kwargs, - ): + data_chunk: bytes = None + ) -> None: self.data_chunk = data_chunk - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumTxRequest.py b/src/trezor/messages/EthereumTxRequest.py index 840613ed38..f85e93c40b 100644 --- a/src/trezor/messages/EthereumTxRequest.py +++ b/src/trezor/messages/EthereumTxRequest.py @@ -3,24 +3,22 @@ import protobuf as p class EthereumTxRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 59 FIELDS = { 1: ('data_length', p.UVarintType, 0), 2: ('signature_v', p.UVarintType, 0), 3: ('signature_r', p.BytesType, 0), 4: ('signature_s', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 59 def __init__( self, data_length: int = None, signature_v: int = None, signature_r: bytes = None, - signature_s: bytes = None, - **kwargs, - ): + signature_s: bytes = None + ) -> None: self.data_length = data_length self.signature_v = signature_v self.signature_r = signature_r self.signature_s = signature_s - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/EthereumVerifyMessage.py b/src/trezor/messages/EthereumVerifyMessage.py index 692f40faad..9eefe2f1b4 100644 --- a/src/trezor/messages/EthereumVerifyMessage.py +++ b/src/trezor/messages/EthereumVerifyMessage.py @@ -3,21 +3,19 @@ import protobuf as p class EthereumVerifyMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 65 FIELDS = { 1: ('address', p.BytesType, 0), 2: ('signature', p.BytesType, 0), 3: ('message', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 65 def __init__( self, address: bytes = None, signature: bytes = None, - message: bytes = None, - **kwargs, - ): + message: bytes = None + ) -> None: self.address = address self.signature = signature self.message = message - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/Failure.py b/src/trezor/messages/Failure.py index f0e91c6740..1bd87eb2b5 100644 --- a/src/trezor/messages/Failure.py +++ b/src/trezor/messages/Failure.py @@ -3,18 +3,16 @@ import protobuf as p class Failure(p.MessageType): + MESSAGE_WIRE_TYPE = 3 FIELDS = { 1: ('code', p.UVarintType, 0), 2: ('message', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 3 def __init__( self, code: int = None, - message: str = None, - **kwargs, - ): + message: str = None + ) -> None: self.code = code self.message = message - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/FailureType.py b/src/trezor/messages/FailureType.py index 8d075b41cd..0fe942a294 100644 --- a/src/trezor/messages/FailureType.py +++ b/src/trezor/messages/FailureType.py @@ -1,16 +1,14 @@ # Automatically generated by pb2py -from micropython import const - -UnexpectedMessage = const(1) -ButtonExpected = const(2) -DataError = const(3) -ActionCancelled = const(4) -PinExpected = const(5) -PinCancelled = const(6) -PinInvalid = const(7) -InvalidSignature = const(8) -ProcessError = const(9) -NotEnoughFunds = const(10) -NotInitialized = const(11) -PinMismatch = const(12) -FirmwareError = const(99) +UnexpectedMessage = 1 +ButtonExpected = 2 +DataError = 3 +ActionCancelled = 4 +PinExpected = 5 +PinCancelled = 6 +PinInvalid = 7 +InvalidSignature = 8 +ProcessError = 9 +NotEnoughFunds = 10 +NotInitialized = 11 +PinMismatch = 12 +FirmwareError = 99 diff --git a/src/trezor/messages/Features.py b/src/trezor/messages/Features.py index 6675b59850..41f48cadc4 100644 --- a/src/trezor/messages/Features.py +++ b/src/trezor/messages/Features.py @@ -3,6 +3,7 @@ import protobuf as p class Features(p.MessageType): + MESSAGE_WIRE_TYPE = 17 FIELDS = { 1: ('vendor', p.UnicodeType, 0), 2: ('major_version', p.UVarintType, 0), @@ -31,7 +32,6 @@ class Features(p.MessageType): 26: ('fw_vendor_keys', p.BytesType, 0), 27: ('unfinished_backup', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 17 def __init__( self, @@ -60,9 +60,8 @@ class Features(p.MessageType): fw_patch: int = None, fw_vendor: str = None, fw_vendor_keys: bytes = None, - unfinished_backup: bool = None, - **kwargs, - ): + unfinished_backup: bool = None + ) -> None: self.vendor = vendor self.major_version = major_version self.minor_version = minor_version @@ -89,4 +88,3 @@ class Features(p.MessageType): self.fw_vendor = fw_vendor self.fw_vendor_keys = fw_vendor_keys self.unfinished_backup = unfinished_backup - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/FirmwareErase.py b/src/trezor/messages/FirmwareErase.py index 06ac715722..b90ba01631 100644 --- a/src/trezor/messages/FirmwareErase.py +++ b/src/trezor/messages/FirmwareErase.py @@ -3,15 +3,13 @@ import protobuf as p class FirmwareErase(p.MessageType): + MESSAGE_WIRE_TYPE = 6 FIELDS = { 1: ('length', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 6 def __init__( self, - length: int = None, - **kwargs, - ): + length: int = None + ) -> None: self.length = length - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/FirmwareRequest.py b/src/trezor/messages/FirmwareRequest.py index 77dca3dfc3..33749a49e8 100644 --- a/src/trezor/messages/FirmwareRequest.py +++ b/src/trezor/messages/FirmwareRequest.py @@ -3,18 +3,16 @@ import protobuf as p class FirmwareRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 8 FIELDS = { 1: ('offset', p.UVarintType, 0), 2: ('length', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 8 def __init__( self, offset: int = None, - length: int = None, - **kwargs, - ): + length: int = None + ) -> None: self.offset = offset self.length = length - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/FirmwareUpload.py b/src/trezor/messages/FirmwareUpload.py index 2d66ea5165..f9987677dd 100644 --- a/src/trezor/messages/FirmwareUpload.py +++ b/src/trezor/messages/FirmwareUpload.py @@ -3,18 +3,16 @@ import protobuf as p class FirmwareUpload(p.MessageType): + MESSAGE_WIRE_TYPE = 7 FIELDS = { 1: ('payload', p.BytesType, 0), # required 2: ('hash', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 7 def __init__( self, payload: bytes = None, - hash: bytes = None, - **kwargs, - ): + hash: bytes = None + ) -> None: self.payload = payload self.hash = hash - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/GetAddress.py b/src/trezor/messages/GetAddress.py index 9870a391ba..059899c8f1 100644 --- a/src/trezor/messages/GetAddress.py +++ b/src/trezor/messages/GetAddress.py @@ -1,9 +1,15 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .MultisigRedeemScriptType import MultisigRedeemScriptType class GetAddress(p.MessageType): + MESSAGE_WIRE_TYPE = 29 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('coin_name', p.UnicodeType, 0), # default='Bitcoin' @@ -11,20 +17,17 @@ class GetAddress(p.MessageType): 4: ('multisig', MultisigRedeemScriptType, 0), 5: ('script_type', p.UVarintType, 0), # default=0 } - MESSAGE_WIRE_TYPE = 29 def __init__( self, - address_n: list = None, + address_n: List[int] = None, coin_name: str = None, show_display: bool = None, multisig: MultisigRedeemScriptType = None, - script_type: int = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + script_type: int = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.coin_name = coin_name self.show_display = show_display self.multisig = multisig self.script_type = script_type - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/GetECDHSessionKey.py b/src/trezor/messages/GetECDHSessionKey.py index 23ac6cc916..7decad6b2d 100644 --- a/src/trezor/messages/GetECDHSessionKey.py +++ b/src/trezor/messages/GetECDHSessionKey.py @@ -4,21 +4,19 @@ from .IdentityType import IdentityType class GetECDHSessionKey(p.MessageType): + MESSAGE_WIRE_TYPE = 61 FIELDS = { 1: ('identity', IdentityType, 0), 2: ('peer_public_key', p.BytesType, 0), 3: ('ecdsa_curve_name', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 61 def __init__( self, identity: IdentityType = None, peer_public_key: bytes = None, - ecdsa_curve_name: str = None, - **kwargs, - ): + ecdsa_curve_name: str = None + ) -> None: self.identity = identity self.peer_public_key = peer_public_key self.ecdsa_curve_name = ecdsa_curve_name - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/GetEntropy.py b/src/trezor/messages/GetEntropy.py index 824499588e..eb416aabe2 100644 --- a/src/trezor/messages/GetEntropy.py +++ b/src/trezor/messages/GetEntropy.py @@ -3,15 +3,13 @@ import protobuf as p class GetEntropy(p.MessageType): + MESSAGE_WIRE_TYPE = 9 FIELDS = { 1: ('size', p.UVarintType, 0), # required } - MESSAGE_WIRE_TYPE = 9 def __init__( self, - size: int = None, - **kwargs, - ): + size: int = None + ) -> None: self.size = size - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/GetFeatures.py b/src/trezor/messages/GetFeatures.py index 44358c2561..85862a6217 100644 --- a/src/trezor/messages/GetFeatures.py +++ b/src/trezor/messages/GetFeatures.py @@ -4,9 +4,3 @@ import protobuf as p class GetFeatures(p.MessageType): MESSAGE_WIRE_TYPE = 55 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/GetPublicKey.py b/src/trezor/messages/GetPublicKey.py index 7d2f8fad6a..e8d56d1462 100644 --- a/src/trezor/messages/GetPublicKey.py +++ b/src/trezor/messages/GetPublicKey.py @@ -1,26 +1,29 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class GetPublicKey(p.MessageType): + MESSAGE_WIRE_TYPE = 11 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('ecdsa_curve_name', p.UnicodeType, 0), 3: ('show_display', p.BoolType, 0), 4: ('coin_name', p.UnicodeType, 0), # default='Bitcoin' } - MESSAGE_WIRE_TYPE = 11 def __init__( self, - address_n: list = None, + address_n: List[int] = None, ecdsa_curve_name: str = None, show_display: bool = None, - coin_name: str = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + coin_name: str = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.ecdsa_curve_name = ecdsa_curve_name self.show_display = show_display self.coin_name = coin_name - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/HDNodePathType.py b/src/trezor/messages/HDNodePathType.py index 41055d8355..0cf6756565 100644 --- a/src/trezor/messages/HDNodePathType.py +++ b/src/trezor/messages/HDNodePathType.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .HDNodeType import HDNodeType @@ -12,9 +17,7 @@ class HDNodePathType(p.MessageType): def __init__( self, node: HDNodeType = None, - address_n: list = None, - **kwargs, - ): + address_n: List[int] = None + ) -> None: self.node = node - self.address_n = [] if address_n is None else address_n - p.MessageType.__init__(self, **kwargs) + self.address_n = address_n if address_n is not None else [] diff --git a/src/trezor/messages/HDNodeType.py b/src/trezor/messages/HDNodeType.py index 7786d94f57..2b021e0932 100644 --- a/src/trezor/messages/HDNodeType.py +++ b/src/trezor/messages/HDNodeType.py @@ -19,13 +19,11 @@ class HDNodeType(p.MessageType): child_num: int = None, chain_code: bytes = None, private_key: bytes = None, - public_key: bytes = None, - **kwargs, - ): + public_key: bytes = None + ) -> None: self.depth = depth self.fingerprint = fingerprint self.child_num = child_num self.chain_code = chain_code self.private_key = private_key self.public_key = public_key - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/IdentityType.py b/src/trezor/messages/IdentityType.py index 6aa532a0ea..acf215d6b7 100644 --- a/src/trezor/messages/IdentityType.py +++ b/src/trezor/messages/IdentityType.py @@ -19,13 +19,11 @@ class IdentityType(p.MessageType): host: str = None, port: str = None, path: str = None, - index: int = None, - **kwargs, - ): + index: int = None + ) -> None: self.proto = proto self.user = user self.host = host self.port = port self.path = path self.index = index - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/Initialize.py b/src/trezor/messages/Initialize.py index ea31f61101..8ca438ae74 100644 --- a/src/trezor/messages/Initialize.py +++ b/src/trezor/messages/Initialize.py @@ -3,18 +3,16 @@ import protobuf as p class Initialize(p.MessageType): + MESSAGE_WIRE_TYPE = 0 FIELDS = { 1: ('state', p.BytesType, 0), 2: ('skip_passphrase', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 0 def __init__( self, state: bytes = None, - skip_passphrase: bool = None, - **kwargs, - ): + skip_passphrase: bool = None + ) -> None: self.state = state self.skip_passphrase = skip_passphrase - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/InputScriptType.py b/src/trezor/messages/InputScriptType.py index 954b7aae27..960be1e4ca 100644 --- a/src/trezor/messages/InputScriptType.py +++ b/src/trezor/messages/InputScriptType.py @@ -1,8 +1,6 @@ # Automatically generated by pb2py -from micropython import const - -SPENDADDRESS = const(0) -SPENDMULTISIG = const(1) -EXTERNAL = const(2) -SPENDWITNESS = const(3) -SPENDP2SHWITNESS = const(4) +SPENDADDRESS = 0 +SPENDMULTISIG = 1 +EXTERNAL = 2 +SPENDWITNESS = 3 +SPENDP2SHWITNESS = 4 diff --git a/src/trezor/messages/LiskAddress.py b/src/trezor/messages/LiskAddress.py index 22f694e3f9..bbe74e5dbc 100644 --- a/src/trezor/messages/LiskAddress.py +++ b/src/trezor/messages/LiskAddress.py @@ -3,15 +3,13 @@ import protobuf as p class LiskAddress(p.MessageType): + MESSAGE_WIRE_TYPE = 115 FIELDS = { 1: ('address', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 115 def __init__( self, - address: str = None, - **kwargs, - ): + address: str = None + ) -> None: self.address = address - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskDelegateType.py b/src/trezor/messages/LiskDelegateType.py index 92351f93b5..74bf3cbb51 100644 --- a/src/trezor/messages/LiskDelegateType.py +++ b/src/trezor/messages/LiskDelegateType.py @@ -9,8 +9,6 @@ class LiskDelegateType(p.MessageType): def __init__( self, - username: str = None, - **kwargs, - ): + username: str = None + ) -> None: self.username = username - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskGetAddress.py b/src/trezor/messages/LiskGetAddress.py index 99af409c01..a85d893225 100644 --- a/src/trezor/messages/LiskGetAddress.py +++ b/src/trezor/messages/LiskGetAddress.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class LiskGetAddress(p.MessageType): + MESSAGE_WIRE_TYPE = 114 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('show_display', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 114 def __init__( self, - address_n: list = None, - show_display: bool = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + address_n: List[int] = None, + show_display: bool = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.show_display = show_display - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskGetPublicKey.py b/src/trezor/messages/LiskGetPublicKey.py index 8b22b87697..c98e732545 100644 --- a/src/trezor/messages/LiskGetPublicKey.py +++ b/src/trezor/messages/LiskGetPublicKey.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class LiskGetPublicKey(p.MessageType): + MESSAGE_WIRE_TYPE = 121 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('show_display', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 121 def __init__( self, - address_n: list = None, - show_display: bool = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + address_n: List[int] = None, + show_display: bool = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.show_display = show_display - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskMultisignatureType.py b/src/trezor/messages/LiskMultisignatureType.py index f863e62812..eee8bb9ed7 100644 --- a/src/trezor/messages/LiskMultisignatureType.py +++ b/src/trezor/messages/LiskMultisignatureType.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class LiskMultisignatureType(p.MessageType): @@ -13,10 +18,8 @@ class LiskMultisignatureType(p.MessageType): self, min: int = None, life_time: int = None, - keys_group: list = None, - **kwargs, - ): + keys_group: List[str] = None + ) -> None: self.min = min self.life_time = life_time - self.keys_group = [] if keys_group is None else keys_group - p.MessageType.__init__(self, **kwargs) + self.keys_group = keys_group if keys_group is not None else [] diff --git a/src/trezor/messages/LiskPublicKey.py b/src/trezor/messages/LiskPublicKey.py index f33968ac31..0ee9f06d35 100644 --- a/src/trezor/messages/LiskPublicKey.py +++ b/src/trezor/messages/LiskPublicKey.py @@ -3,15 +3,13 @@ import protobuf as p class LiskPublicKey(p.MessageType): + MESSAGE_WIRE_TYPE = 122 FIELDS = { 1: ('public_key', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 122 def __init__( self, - public_key: bytes = None, - **kwargs, - ): + public_key: bytes = None + ) -> None: self.public_key = public_key - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskSignTx.py b/src/trezor/messages/LiskSignTx.py index 5370d2e926..0548baf253 100644 --- a/src/trezor/messages/LiskSignTx.py +++ b/src/trezor/messages/LiskSignTx.py @@ -1,21 +1,24 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .LiskTransactionCommon import LiskTransactionCommon class LiskSignTx(p.MessageType): + MESSAGE_WIRE_TYPE = 116 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('transaction', LiskTransactionCommon, 0), } - MESSAGE_WIRE_TYPE = 116 def __init__( self, - address_n: list = None, - transaction: LiskTransactionCommon = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + address_n: List[int] = None, + transaction: LiskTransactionCommon = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.transaction = transaction - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskSignatureType.py b/src/trezor/messages/LiskSignatureType.py index 8811b55808..ffe43aa76f 100644 --- a/src/trezor/messages/LiskSignatureType.py +++ b/src/trezor/messages/LiskSignatureType.py @@ -9,8 +9,6 @@ class LiskSignatureType(p.MessageType): def __init__( self, - public_key: bytes = None, - **kwargs, - ): + public_key: bytes = None + ) -> None: self.public_key = public_key - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskSignedTx.py b/src/trezor/messages/LiskSignedTx.py index ffb4c98806..b06a1b85a3 100644 --- a/src/trezor/messages/LiskSignedTx.py +++ b/src/trezor/messages/LiskSignedTx.py @@ -3,15 +3,13 @@ import protobuf as p class LiskSignedTx(p.MessageType): + MESSAGE_WIRE_TYPE = 117 FIELDS = { 1: ('signature', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 117 def __init__( self, - signature: bytes = None, - **kwargs, - ): + signature: bytes = None + ) -> None: self.signature = signature - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskTransactionAsset.py b/src/trezor/messages/LiskTransactionAsset.py index 3c485a2216..33c400bea0 100644 --- a/src/trezor/messages/LiskTransactionAsset.py +++ b/src/trezor/messages/LiskTransactionAsset.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .LiskDelegateType import LiskDelegateType from .LiskMultisignatureType import LiskMultisignatureType from .LiskSignatureType import LiskSignatureType @@ -18,14 +23,12 @@ class LiskTransactionAsset(p.MessageType): self, signature: LiskSignatureType = None, delegate: LiskDelegateType = None, - votes: list = None, + votes: List[str] = None, multisignature: LiskMultisignatureType = None, - data: str = None, - **kwargs, - ): + data: str = None + ) -> None: self.signature = signature self.delegate = delegate - self.votes = [] if votes is None else votes + self.votes = votes if votes is not None else [] self.multisignature = multisignature self.data = data - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskTransactionCommon.py b/src/trezor/messages/LiskTransactionCommon.py index 935266a89b..13ecbee1d5 100644 --- a/src/trezor/messages/LiskTransactionCommon.py +++ b/src/trezor/messages/LiskTransactionCommon.py @@ -26,9 +26,8 @@ class LiskTransactionCommon(p.MessageType): requester_public_key: bytes = None, signature: bytes = None, timestamp: int = None, - asset: LiskTransactionAsset = None, - **kwargs, - ): + asset: LiskTransactionAsset = None + ) -> None: self.type = type self.amount = amount self.fee = fee @@ -38,4 +37,3 @@ class LiskTransactionCommon(p.MessageType): self.signature = signature self.timestamp = timestamp self.asset = asset - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/LiskTransactionType.py b/src/trezor/messages/LiskTransactionType.py index 9de0b22f81..b4e55b08db 100644 --- a/src/trezor/messages/LiskTransactionType.py +++ b/src/trezor/messages/LiskTransactionType.py @@ -1,11 +1,9 @@ # Automatically generated by pb2py -from micropython import const - -Transfer = const(0) -RegisterSecondPassphrase = const(1) -RegisterDelegate = const(2) -CastVotes = const(3) -RegisterMultisignatureAccount = const(4) -CreateDapp = const(5) -TransferIntoDapp = const(6) -TransferOutOfDapp = const(7) +Transfer = 0 +RegisterSecondPassphrase = 1 +RegisterDelegate = 2 +CastVotes = 3 +RegisterMultisignatureAccount = 4 +CreateDapp = 5 +TransferIntoDapp = 6 +TransferOutOfDapp = 7 diff --git a/src/trezor/messages/LoadDevice.py b/src/trezor/messages/LoadDevice.py index d97a1722b4..db2bde13d9 100644 --- a/src/trezor/messages/LoadDevice.py +++ b/src/trezor/messages/LoadDevice.py @@ -4,6 +4,7 @@ from .HDNodeType import HDNodeType class LoadDevice(p.MessageType): + MESSAGE_WIRE_TYPE = 13 FIELDS = { 1: ('mnemonic', p.UnicodeType, 0), 2: ('node', HDNodeType, 0), @@ -14,7 +15,6 @@ class LoadDevice(p.MessageType): 7: ('skip_checksum', p.BoolType, 0), 8: ('u2f_counter', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 13 def __init__( self, @@ -25,9 +25,8 @@ class LoadDevice(p.MessageType): language: str = None, label: str = None, skip_checksum: bool = None, - u2f_counter: int = None, - **kwargs, - ): + u2f_counter: int = None + ) -> None: self.mnemonic = mnemonic self.node = node self.pin = pin @@ -36,4 +35,3 @@ class LoadDevice(p.MessageType): self.label = label self.skip_checksum = skip_checksum self.u2f_counter = u2f_counter - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/MessageSignature.py b/src/trezor/messages/MessageSignature.py index d5a62a2885..abed12bae2 100644 --- a/src/trezor/messages/MessageSignature.py +++ b/src/trezor/messages/MessageSignature.py @@ -3,18 +3,16 @@ import protobuf as p class MessageSignature(p.MessageType): + MESSAGE_WIRE_TYPE = 40 FIELDS = { 1: ('address', p.UnicodeType, 0), 2: ('signature', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 40 def __init__( self, address: str = None, - signature: bytes = None, - **kwargs, - ): + signature: bytes = None + ) -> None: self.address = address self.signature = signature - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/MessageType.py b/src/trezor/messages/MessageType.py index fa8f120765..66b2787581 100644 --- a/src/trezor/messages/MessageType.py +++ b/src/trezor/messages/MessageType.py @@ -1,110 +1,108 @@ # Automatically generated by pb2py -from micropython import const - -Initialize = const(0) -Ping = const(1) -Success = const(2) -Failure = const(3) -ChangePin = const(4) -WipeDevice = const(5) -FirmwareErase = const(6) -FirmwareUpload = const(7) -FirmwareRequest = const(8) -GetEntropy = const(9) -Entropy = const(10) -GetPublicKey = const(11) -PublicKey = const(12) -LoadDevice = const(13) -ResetDevice = const(14) -SignTx = const(15) -SimpleSignTx = const(16) -Features = const(17) -PinMatrixRequest = const(18) -PinMatrixAck = const(19) -Cancel = const(20) -TxRequest = const(21) -TxAck = const(22) -CipherKeyValue = const(23) -ClearSession = const(24) -ApplySettings = const(25) -ButtonRequest = const(26) -ButtonAck = const(27) -ApplyFlags = const(28) -GetAddress = const(29) -Address = const(30) -SelfTest = const(32) -BackupDevice = const(34) -EntropyRequest = const(35) -EntropyAck = const(36) -SignMessage = const(38) -VerifyMessage = const(39) -MessageSignature = const(40) -PassphraseRequest = const(41) -PassphraseAck = const(42) -PassphraseStateRequest = const(77) -PassphraseStateAck = const(78) -EstimateTxSize = const(43) -TxSize = const(44) -RecoveryDevice = const(45) -WordRequest = const(46) -WordAck = const(47) -CipheredKeyValue = const(48) -EncryptMessage = const(49) -EncryptedMessage = const(50) -DecryptMessage = const(51) -DecryptedMessage = const(52) -SignIdentity = const(53) -SignedIdentity = const(54) -GetFeatures = const(55) -EthereumGetAddress = const(56) -EthereumAddress = const(57) -EthereumSignTx = const(58) -EthereumTxRequest = const(59) -EthereumTxAck = const(60) -GetECDHSessionKey = const(61) -ECDHSessionKey = const(62) -SetU2FCounter = const(63) -EthereumSignMessage = const(64) -EthereumVerifyMessage = const(65) -EthereumMessageSignature = const(66) -NEMGetAddress = const(67) -NEMAddress = const(68) -NEMSignTx = const(69) -NEMSignedTx = const(70) -CosiCommit = const(71) -CosiCommitment = const(72) -CosiSign = const(73) -CosiSignature = const(74) -NEMDecryptMessage = const(75) -NEMDecryptedMessage = const(76) -DebugLinkDecision = const(100) -DebugLinkGetState = const(101) -DebugLinkState = const(102) -DebugLinkStop = const(103) -DebugLinkLog = const(104) -DebugLinkMemoryRead = const(110) -DebugLinkMemory = const(111) -DebugLinkMemoryWrite = const(112) -DebugLinkFlashErase = const(113) -LiskGetAddress = const(114) -LiskAddress = const(115) -LiskSignTx = const(116) -LiskSignedTx = const(117) -LiskGetPublicKey = const(121) -LiskPublicKey = const(122) -StellarGetPublicKey = const(200) -StellarPublicKey = const(201) -StellarSignTx = const(202) -StellarTxOpRequest = const(203) -StellarCreateAccountOp = const(210) -StellarPaymentOp = const(211) -StellarPathPaymentOp = const(212) -StellarManageOfferOp = const(213) -StellarCreatePassiveOfferOp = const(214) -StellarSetOptionsOp = const(215) -StellarChangeTrustOp = const(216) -StellarAllowTrustOp = const(217) -StellarAccountMergeOp = const(218) -StellarManageDataOp = const(220) -StellarBumpSequenceOp = const(221) -StellarSignedTx = const(230) +Initialize = 0 +Ping = 1 +Success = 2 +Failure = 3 +ChangePin = 4 +WipeDevice = 5 +FirmwareErase = 6 +FirmwareUpload = 7 +FirmwareRequest = 8 +GetEntropy = 9 +Entropy = 10 +GetPublicKey = 11 +PublicKey = 12 +LoadDevice = 13 +ResetDevice = 14 +SignTx = 15 +SimpleSignTx = 16 +Features = 17 +PinMatrixRequest = 18 +PinMatrixAck = 19 +Cancel = 20 +TxRequest = 21 +TxAck = 22 +CipherKeyValue = 23 +ClearSession = 24 +ApplySettings = 25 +ButtonRequest = 26 +ButtonAck = 27 +ApplyFlags = 28 +GetAddress = 29 +Address = 30 +SelfTest = 32 +BackupDevice = 34 +EntropyRequest = 35 +EntropyAck = 36 +SignMessage = 38 +VerifyMessage = 39 +MessageSignature = 40 +PassphraseRequest = 41 +PassphraseAck = 42 +PassphraseStateRequest = 77 +PassphraseStateAck = 78 +EstimateTxSize = 43 +TxSize = 44 +RecoveryDevice = 45 +WordRequest = 46 +WordAck = 47 +CipheredKeyValue = 48 +EncryptMessage = 49 +EncryptedMessage = 50 +DecryptMessage = 51 +DecryptedMessage = 52 +SignIdentity = 53 +SignedIdentity = 54 +GetFeatures = 55 +EthereumGetAddress = 56 +EthereumAddress = 57 +EthereumSignTx = 58 +EthereumTxRequest = 59 +EthereumTxAck = 60 +GetECDHSessionKey = 61 +ECDHSessionKey = 62 +SetU2FCounter = 63 +EthereumSignMessage = 64 +EthereumVerifyMessage = 65 +EthereumMessageSignature = 66 +NEMGetAddress = 67 +NEMAddress = 68 +NEMSignTx = 69 +NEMSignedTx = 70 +CosiCommit = 71 +CosiCommitment = 72 +CosiSign = 73 +CosiSignature = 74 +NEMDecryptMessage = 75 +NEMDecryptedMessage = 76 +DebugLinkDecision = 100 +DebugLinkGetState = 101 +DebugLinkState = 102 +DebugLinkStop = 103 +DebugLinkLog = 104 +DebugLinkMemoryRead = 110 +DebugLinkMemory = 111 +DebugLinkMemoryWrite = 112 +DebugLinkFlashErase = 113 +LiskGetAddress = 114 +LiskAddress = 115 +LiskSignTx = 116 +LiskSignedTx = 117 +LiskGetPublicKey = 121 +LiskPublicKey = 122 +StellarGetPublicKey = 200 +StellarPublicKey = 201 +StellarSignTx = 202 +StellarTxOpRequest = 203 +StellarCreateAccountOp = 210 +StellarPaymentOp = 211 +StellarPathPaymentOp = 212 +StellarManageOfferOp = 213 +StellarCreatePassiveOfferOp = 214 +StellarSetOptionsOp = 215 +StellarChangeTrustOp = 216 +StellarAllowTrustOp = 217 +StellarAccountMergeOp = 218 +StellarManageDataOp = 220 +StellarBumpSequenceOp = 221 +StellarSignedTx = 230 diff --git a/src/trezor/messages/MultisigRedeemScriptType.py b/src/trezor/messages/MultisigRedeemScriptType.py index 5ffd534ef3..7e7f4ec6e3 100644 --- a/src/trezor/messages/MultisigRedeemScriptType.py +++ b/src/trezor/messages/MultisigRedeemScriptType.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .HDNodePathType import HDNodePathType @@ -12,12 +17,10 @@ class MultisigRedeemScriptType(p.MessageType): def __init__( self, - pubkeys: list = None, - signatures: list = None, - m: int = None, - **kwargs, - ): - self.pubkeys = [] if pubkeys is None else pubkeys - self.signatures = [] if signatures is None else signatures + pubkeys: List[HDNodePathType] = None, + signatures: List[bytes] = None, + m: int = None + ) -> None: + self.pubkeys = pubkeys if pubkeys is not None else [] + self.signatures = signatures if signatures is not None else [] self.m = m - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMAddress.py b/src/trezor/messages/NEMAddress.py index 79a81004b3..44f73b5430 100644 --- a/src/trezor/messages/NEMAddress.py +++ b/src/trezor/messages/NEMAddress.py @@ -3,15 +3,13 @@ import protobuf as p class NEMAddress(p.MessageType): + MESSAGE_WIRE_TYPE = 68 FIELDS = { 1: ('address', p.UnicodeType, 0), # required } - MESSAGE_WIRE_TYPE = 68 def __init__( self, - address: str = None, - **kwargs, - ): + address: str = None + ) -> None: self.address = address - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMAggregateModification.py b/src/trezor/messages/NEMAggregateModification.py index b2ad1d0e9c..fb353c50cf 100644 --- a/src/trezor/messages/NEMAggregateModification.py +++ b/src/trezor/messages/NEMAggregateModification.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .NEMCosignatoryModification import NEMCosignatoryModification class NEMAggregateModification(p.MessageType): FIELDS = { 1: ('modifications', NEMCosignatoryModification, p.FLAG_REPEATED), - 2: ('relative_change', p.Sint32Type, 0), + 2: ('relative_change', p.SVarintType, 0), } def __init__( self, - modifications: list = None, - relative_change: int = None, - **kwargs, - ): - self.modifications = [] if modifications is None else modifications + modifications: List[NEMCosignatoryModification] = None, + relative_change: int = None + ) -> None: + self.modifications = modifications if modifications is not None else [] self.relative_change = relative_change - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMCosignatoryModification.py b/src/trezor/messages/NEMCosignatoryModification.py index 3c2f18b73e..56ddf0cac8 100644 --- a/src/trezor/messages/NEMCosignatoryModification.py +++ b/src/trezor/messages/NEMCosignatoryModification.py @@ -11,9 +11,7 @@ class NEMCosignatoryModification(p.MessageType): def __init__( self, type: int = None, - public_key: bytes = None, - **kwargs, - ): + public_key: bytes = None + ) -> None: self.type = type self.public_key = public_key - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMDecryptMessage.py b/src/trezor/messages/NEMDecryptMessage.py index e19cb2bfc6..94e507fbbe 100644 --- a/src/trezor/messages/NEMDecryptMessage.py +++ b/src/trezor/messages/NEMDecryptMessage.py @@ -1,26 +1,29 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class NEMDecryptMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 75 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('network', p.UVarintType, 0), 3: ('public_key', p.BytesType, 0), 4: ('payload', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 75 def __init__( self, - address_n: list = None, + address_n: List[int] = None, network: int = None, public_key: bytes = None, - payload: bytes = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + payload: bytes = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.network = network self.public_key = public_key self.payload = payload - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMDecryptedMessage.py b/src/trezor/messages/NEMDecryptedMessage.py index 02cccb71f6..143c192c89 100644 --- a/src/trezor/messages/NEMDecryptedMessage.py +++ b/src/trezor/messages/NEMDecryptedMessage.py @@ -3,15 +3,13 @@ import protobuf as p class NEMDecryptedMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 76 FIELDS = { 1: ('payload', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 76 def __init__( self, - payload: bytes = None, - **kwargs, - ): + payload: bytes = None + ) -> None: self.payload = payload - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMGetAddress.py b/src/trezor/messages/NEMGetAddress.py index bd39bc063f..2aaf0a0ce4 100644 --- a/src/trezor/messages/NEMGetAddress.py +++ b/src/trezor/messages/NEMGetAddress.py @@ -1,23 +1,26 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class NEMGetAddress(p.MessageType): + MESSAGE_WIRE_TYPE = 67 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('network', p.UVarintType, 0), 3: ('show_display', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 67 def __init__( self, - address_n: list = None, + address_n: List[int] = None, network: int = None, - show_display: bool = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + show_display: bool = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.network = network self.show_display = show_display - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMImportanceTransfer.py b/src/trezor/messages/NEMImportanceTransfer.py index 31d92e9925..209bfef3f1 100644 --- a/src/trezor/messages/NEMImportanceTransfer.py +++ b/src/trezor/messages/NEMImportanceTransfer.py @@ -11,9 +11,7 @@ class NEMImportanceTransfer(p.MessageType): def __init__( self, mode: int = None, - public_key: bytes = None, - **kwargs, - ): + public_key: bytes = None + ) -> None: self.mode = mode self.public_key = public_key - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMImportanceTransferMode.py b/src/trezor/messages/NEMImportanceTransferMode.py index 871a94bfb0..e75f62fe74 100644 --- a/src/trezor/messages/NEMImportanceTransferMode.py +++ b/src/trezor/messages/NEMImportanceTransferMode.py @@ -1,5 +1,3 @@ # Automatically generated by pb2py -from micropython import const - -ImportanceTransfer_Activate = const(1) -ImportanceTransfer_Deactivate = const(2) +ImportanceTransfer_Activate = 1 +ImportanceTransfer_Deactivate = 2 diff --git a/src/trezor/messages/NEMModificationType.py b/src/trezor/messages/NEMModificationType.py index 2ea0555af0..c812172bcc 100644 --- a/src/trezor/messages/NEMModificationType.py +++ b/src/trezor/messages/NEMModificationType.py @@ -1,5 +1,3 @@ # Automatically generated by pb2py -from micropython import const - -CosignatoryModification_Add = const(1) -CosignatoryModification_Delete = const(2) +CosignatoryModification_Add = 1 +CosignatoryModification_Delete = 2 diff --git a/src/trezor/messages/NEMMosaic.py b/src/trezor/messages/NEMMosaic.py index 5e793d9dfd..fcca79aa51 100644 --- a/src/trezor/messages/NEMMosaic.py +++ b/src/trezor/messages/NEMMosaic.py @@ -13,10 +13,8 @@ class NEMMosaic(p.MessageType): self, namespace: str = None, mosaic: str = None, - quantity: int = None, - **kwargs, - ): + quantity: int = None + ) -> None: self.namespace = namespace self.mosaic = mosaic self.quantity = quantity - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMMosaicCreation.py b/src/trezor/messages/NEMMosaicCreation.py index 79e4cecaae..737e010364 100644 --- a/src/trezor/messages/NEMMosaicCreation.py +++ b/src/trezor/messages/NEMMosaicCreation.py @@ -14,10 +14,8 @@ class NEMMosaicCreation(p.MessageType): self, definition: NEMMosaicDefinition = None, sink: str = None, - fee: int = None, - **kwargs, - ): + fee: int = None + ) -> None: self.definition = definition self.sink = sink self.fee = fee - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMMosaicDefinition.py b/src/trezor/messages/NEMMosaicDefinition.py index 1fdb9c60a7..02d631d0cd 100644 --- a/src/trezor/messages/NEMMosaicDefinition.py +++ b/src/trezor/messages/NEMMosaicDefinition.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class NEMMosaicDefinition(p.MessageType): @@ -37,9 +42,8 @@ class NEMMosaicDefinition(p.MessageType): mutable_supply: bool = None, transferable: bool = None, description: str = None, - networks: list = None, - **kwargs, - ): + networks: List[int] = None + ) -> None: self.name = name self.ticker = ticker self.namespace = namespace @@ -54,5 +58,4 @@ class NEMMosaicDefinition(p.MessageType): self.mutable_supply = mutable_supply self.transferable = transferable self.description = description - self.networks = [] if networks is None else networks - p.MessageType.__init__(self, **kwargs) + self.networks = networks if networks is not None else [] diff --git a/src/trezor/messages/NEMMosaicLevy.py b/src/trezor/messages/NEMMosaicLevy.py index 0d4e00c708..56ef22c6fe 100644 --- a/src/trezor/messages/NEMMosaicLevy.py +++ b/src/trezor/messages/NEMMosaicLevy.py @@ -1,5 +1,3 @@ # Automatically generated by pb2py -from micropython import const - -MosaicLevy_Absolute = const(1) -MosaicLevy_Percentile = const(2) +MosaicLevy_Absolute = 1 +MosaicLevy_Percentile = 2 diff --git a/src/trezor/messages/NEMMosaicSupplyChange.py b/src/trezor/messages/NEMMosaicSupplyChange.py index e228161173..2699ec0a6f 100644 --- a/src/trezor/messages/NEMMosaicSupplyChange.py +++ b/src/trezor/messages/NEMMosaicSupplyChange.py @@ -15,11 +15,9 @@ class NEMMosaicSupplyChange(p.MessageType): namespace: str = None, mosaic: str = None, type: int = None, - delta: int = None, - **kwargs, - ): + delta: int = None + ) -> None: self.namespace = namespace self.mosaic = mosaic self.type = type self.delta = delta - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMProvisionNamespace.py b/src/trezor/messages/NEMProvisionNamespace.py index d18bb60b30..77bd0c5bec 100644 --- a/src/trezor/messages/NEMProvisionNamespace.py +++ b/src/trezor/messages/NEMProvisionNamespace.py @@ -15,11 +15,9 @@ class NEMProvisionNamespace(p.MessageType): namespace: str = None, parent: str = None, sink: str = None, - fee: int = None, - **kwargs, - ): + fee: int = None + ) -> None: self.namespace = namespace self.parent = parent self.sink = sink self.fee = fee - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMSignTx.py b/src/trezor/messages/NEMSignTx.py index 23e833e186..5fe71097f8 100644 --- a/src/trezor/messages/NEMSignTx.py +++ b/src/trezor/messages/NEMSignTx.py @@ -10,6 +10,7 @@ from .NEMTransfer import NEMTransfer class NEMSignTx(p.MessageType): + MESSAGE_WIRE_TYPE = 69 FIELDS = { 1: ('transaction', NEMTransactionCommon, 0), 2: ('multisig', NEMTransactionCommon, 0), @@ -21,7 +22,6 @@ class NEMSignTx(p.MessageType): 8: ('aggregate_modification', NEMAggregateModification, 0), 9: ('importance_transfer', NEMImportanceTransfer, 0), } - MESSAGE_WIRE_TYPE = 69 def __init__( self, @@ -33,9 +33,8 @@ class NEMSignTx(p.MessageType): mosaic_creation: NEMMosaicCreation = None, supply_change: NEMMosaicSupplyChange = None, aggregate_modification: NEMAggregateModification = None, - importance_transfer: NEMImportanceTransfer = None, - **kwargs, - ): + importance_transfer: NEMImportanceTransfer = None + ) -> None: self.transaction = transaction self.multisig = multisig self.transfer = transfer @@ -45,4 +44,3 @@ class NEMSignTx(p.MessageType): self.supply_change = supply_change self.aggregate_modification = aggregate_modification self.importance_transfer = importance_transfer - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMSignedTx.py b/src/trezor/messages/NEMSignedTx.py index 489b4657b6..e39375192f 100644 --- a/src/trezor/messages/NEMSignedTx.py +++ b/src/trezor/messages/NEMSignedTx.py @@ -3,18 +3,16 @@ import protobuf as p class NEMSignedTx(p.MessageType): + MESSAGE_WIRE_TYPE = 70 FIELDS = { 1: ('data', p.BytesType, 0), 2: ('signature', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 70 def __init__( self, data: bytes = None, - signature: bytes = None, - **kwargs, - ): + signature: bytes = None + ) -> None: self.data = data self.signature = signature - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMSupplyChangeType.py b/src/trezor/messages/NEMSupplyChangeType.py index 211755f2c2..0633b8f9af 100644 --- a/src/trezor/messages/NEMSupplyChangeType.py +++ b/src/trezor/messages/NEMSupplyChangeType.py @@ -1,5 +1,3 @@ # Automatically generated by pb2py -from micropython import const - -SupplyChange_Increase = const(1) -SupplyChange_Decrease = const(2) +SupplyChange_Increase = 1 +SupplyChange_Decrease = 2 diff --git a/src/trezor/messages/NEMTransactionCommon.py b/src/trezor/messages/NEMTransactionCommon.py index 5357dbbd59..c3d80564ed 100644 --- a/src/trezor/messages/NEMTransactionCommon.py +++ b/src/trezor/messages/NEMTransactionCommon.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class NEMTransactionCommon(p.MessageType): @@ -14,18 +19,16 @@ class NEMTransactionCommon(p.MessageType): def __init__( self, - address_n: list = None, + address_n: List[int] = None, network: int = None, timestamp: int = None, fee: int = None, deadline: int = None, - signer: bytes = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + signer: bytes = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.network = network self.timestamp = timestamp self.fee = fee self.deadline = deadline self.signer = signer - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMTransfer.py b/src/trezor/messages/NEMTransfer.py index 533191658c..f4224cc5ac 100644 --- a/src/trezor/messages/NEMTransfer.py +++ b/src/trezor/messages/NEMTransfer.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .NEMMosaic import NEMMosaic @@ -18,12 +23,10 @@ class NEMTransfer(p.MessageType): amount: int = None, payload: bytes = None, public_key: bytes = None, - mosaics: list = None, - **kwargs, - ): + mosaics: List[NEMMosaic] = None + ) -> None: self.recipient = recipient self.amount = amount self.payload = payload self.public_key = public_key - self.mosaics = [] if mosaics is None else mosaics - p.MessageType.__init__(self, **kwargs) + self.mosaics = mosaics if mosaics is not None else [] diff --git a/src/trezor/messages/OutputScriptType.py b/src/trezor/messages/OutputScriptType.py index 5b0f1d2839..96e22e3124 100644 --- a/src/trezor/messages/OutputScriptType.py +++ b/src/trezor/messages/OutputScriptType.py @@ -1,9 +1,7 @@ # Automatically generated by pb2py -from micropython import const - -PAYTOADDRESS = const(0) -PAYTOSCRIPTHASH = const(1) -PAYTOMULTISIG = const(2) -PAYTOOPRETURN = const(3) -PAYTOWITNESS = const(4) -PAYTOP2SHWITNESS = const(5) +PAYTOADDRESS = 0 +PAYTOSCRIPTHASH = 1 +PAYTOMULTISIG = 2 +PAYTOOPRETURN = 3 +PAYTOWITNESS = 4 +PAYTOP2SHWITNESS = 5 diff --git a/src/trezor/messages/PassphraseAck.py b/src/trezor/messages/PassphraseAck.py index 433ea95984..e137be25cf 100644 --- a/src/trezor/messages/PassphraseAck.py +++ b/src/trezor/messages/PassphraseAck.py @@ -3,18 +3,16 @@ import protobuf as p class PassphraseAck(p.MessageType): + MESSAGE_WIRE_TYPE = 42 FIELDS = { 1: ('passphrase', p.UnicodeType, 0), 2: ('state', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 42 def __init__( self, passphrase: str = None, - state: bytes = None, - **kwargs, - ): + state: bytes = None + ) -> None: self.passphrase = passphrase self.state = state - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PassphraseRequest.py b/src/trezor/messages/PassphraseRequest.py index 18823de783..cd75059104 100644 --- a/src/trezor/messages/PassphraseRequest.py +++ b/src/trezor/messages/PassphraseRequest.py @@ -3,15 +3,13 @@ import protobuf as p class PassphraseRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 41 FIELDS = { 1: ('on_device', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 41 def __init__( self, - on_device: bool = None, - **kwargs, - ): + on_device: bool = None + ) -> None: self.on_device = on_device - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PassphraseSourceType.py b/src/trezor/messages/PassphraseSourceType.py index 7baafe57a7..d8c5d41d40 100644 --- a/src/trezor/messages/PassphraseSourceType.py +++ b/src/trezor/messages/PassphraseSourceType.py @@ -1,6 +1,4 @@ # Automatically generated by pb2py -from micropython import const - -ASK = const(0) -DEVICE = const(1) -HOST = const(2) +ASK = 0 +DEVICE = 1 +HOST = 2 diff --git a/src/trezor/messages/PassphraseStateAck.py b/src/trezor/messages/PassphraseStateAck.py index 5f48710a05..d2dda06881 100644 --- a/src/trezor/messages/PassphraseStateAck.py +++ b/src/trezor/messages/PassphraseStateAck.py @@ -4,9 +4,3 @@ import protobuf as p class PassphraseStateAck(p.MessageType): MESSAGE_WIRE_TYPE = 78 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PassphraseStateRequest.py b/src/trezor/messages/PassphraseStateRequest.py index 0bc84ae487..2b2c76ad62 100644 --- a/src/trezor/messages/PassphraseStateRequest.py +++ b/src/trezor/messages/PassphraseStateRequest.py @@ -3,15 +3,13 @@ import protobuf as p class PassphraseStateRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 77 FIELDS = { 1: ('state', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 77 def __init__( self, - state: bytes = None, - **kwargs, - ): + state: bytes = None + ) -> None: self.state = state - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PinMatrixAck.py b/src/trezor/messages/PinMatrixAck.py index 29043c53a3..28127eb201 100644 --- a/src/trezor/messages/PinMatrixAck.py +++ b/src/trezor/messages/PinMatrixAck.py @@ -3,15 +3,13 @@ import protobuf as p class PinMatrixAck(p.MessageType): + MESSAGE_WIRE_TYPE = 19 FIELDS = { 1: ('pin', p.UnicodeType, 0), # required } - MESSAGE_WIRE_TYPE = 19 def __init__( self, - pin: str = None, - **kwargs, - ): + pin: str = None + ) -> None: self.pin = pin - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PinMatrixRequest.py b/src/trezor/messages/PinMatrixRequest.py index 4775cb87f9..67999649f8 100644 --- a/src/trezor/messages/PinMatrixRequest.py +++ b/src/trezor/messages/PinMatrixRequest.py @@ -3,15 +3,13 @@ import protobuf as p class PinMatrixRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 18 FIELDS = { 1: ('type', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 18 def __init__( self, - type: int = None, - **kwargs, - ): + type: int = None + ) -> None: self.type = type - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PinMatrixRequestType.py b/src/trezor/messages/PinMatrixRequestType.py index 9380b49b00..c1ff19ee18 100644 --- a/src/trezor/messages/PinMatrixRequestType.py +++ b/src/trezor/messages/PinMatrixRequestType.py @@ -1,6 +1,4 @@ # Automatically generated by pb2py -from micropython import const - -Current = const(1) -NewFirst = const(2) -NewSecond = const(3) +Current = 1 +NewFirst = 2 +NewSecond = 3 diff --git a/src/trezor/messages/Ping.py b/src/trezor/messages/Ping.py index 51a594a1ea..3896997fe2 100644 --- a/src/trezor/messages/Ping.py +++ b/src/trezor/messages/Ping.py @@ -3,24 +3,22 @@ import protobuf as p class Ping(p.MessageType): + MESSAGE_WIRE_TYPE = 1 FIELDS = { 1: ('message', p.UnicodeType, 0), 2: ('button_protection', p.BoolType, 0), 3: ('pin_protection', p.BoolType, 0), 4: ('passphrase_protection', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 1 def __init__( self, message: str = None, button_protection: bool = None, pin_protection: bool = None, - passphrase_protection: bool = None, - **kwargs, - ): + passphrase_protection: bool = None + ) -> None: self.message = message self.button_protection = button_protection self.pin_protection = pin_protection self.passphrase_protection = passphrase_protection - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PublicKey.py b/src/trezor/messages/PublicKey.py index 19842f22a2..7c545161e1 100644 --- a/src/trezor/messages/PublicKey.py +++ b/src/trezor/messages/PublicKey.py @@ -4,18 +4,16 @@ from .HDNodeType import HDNodeType class PublicKey(p.MessageType): + MESSAGE_WIRE_TYPE = 12 FIELDS = { 1: ('node', HDNodeType, 0), # required 2: ('xpub', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 12 def __init__( self, node: HDNodeType = None, - xpub: str = None, - **kwargs, - ): + xpub: str = None + ) -> None: self.node = node self.xpub = xpub - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/RecoveryDevice.py b/src/trezor/messages/RecoveryDevice.py index 2dfb4dd512..ded489ee79 100644 --- a/src/trezor/messages/RecoveryDevice.py +++ b/src/trezor/messages/RecoveryDevice.py @@ -3,6 +3,7 @@ import protobuf as p class RecoveryDevice(p.MessageType): + MESSAGE_WIRE_TYPE = 45 FIELDS = { 1: ('word_count', p.UVarintType, 0), 2: ('passphrase_protection', p.BoolType, 0), @@ -14,7 +15,6 @@ class RecoveryDevice(p.MessageType): 9: ('u2f_counter', p.UVarintType, 0), 10: ('dry_run', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 45 def __init__( self, @@ -26,9 +26,8 @@ class RecoveryDevice(p.MessageType): enforce_wordlist: bool = None, type: int = None, u2f_counter: int = None, - dry_run: bool = None, - **kwargs, - ): + dry_run: bool = None + ) -> None: self.word_count = word_count self.passphrase_protection = passphrase_protection self.pin_protection = pin_protection @@ -38,4 +37,3 @@ class RecoveryDevice(p.MessageType): self.type = type self.u2f_counter = u2f_counter self.dry_run = dry_run - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/RecoveryDeviceType.py b/src/trezor/messages/RecoveryDeviceType.py index 0416a4d014..21f48a9b4a 100644 --- a/src/trezor/messages/RecoveryDeviceType.py +++ b/src/trezor/messages/RecoveryDeviceType.py @@ -1,5 +1,3 @@ # Automatically generated by pb2py -from micropython import const - -ScrambledWords = const(0) -Matrix = const(1) +ScrambledWords = 0 +Matrix = 1 diff --git a/src/trezor/messages/RequestType.py b/src/trezor/messages/RequestType.py index 4ce14db44d..0a43a82cba 100644 --- a/src/trezor/messages/RequestType.py +++ b/src/trezor/messages/RequestType.py @@ -1,8 +1,6 @@ # Automatically generated by pb2py -from micropython import const - -TXINPUT = const(0) -TXOUTPUT = const(1) -TXMETA = const(2) -TXFINISHED = const(3) -TXEXTRADATA = const(4) +TXINPUT = 0 +TXOUTPUT = 1 +TXMETA = 2 +TXFINISHED = 3 +TXEXTRADATA = 4 diff --git a/src/trezor/messages/ResetDevice.py b/src/trezor/messages/ResetDevice.py index e5c8cf7db0..357c9c851f 100644 --- a/src/trezor/messages/ResetDevice.py +++ b/src/trezor/messages/ResetDevice.py @@ -3,6 +3,7 @@ import protobuf as p class ResetDevice(p.MessageType): + MESSAGE_WIRE_TYPE = 14 FIELDS = { 1: ('display_random', p.BoolType, 0), 2: ('strength', p.UVarintType, 0), # default=256 @@ -13,7 +14,6 @@ class ResetDevice(p.MessageType): 7: ('u2f_counter', p.UVarintType, 0), 8: ('skip_backup', p.BoolType, 0), } - MESSAGE_WIRE_TYPE = 14 def __init__( self, @@ -24,9 +24,8 @@ class ResetDevice(p.MessageType): language: str = None, label: str = None, u2f_counter: int = None, - skip_backup: bool = None, - **kwargs, - ): + skip_backup: bool = None + ) -> None: self.display_random = display_random self.strength = strength self.passphrase_protection = passphrase_protection @@ -35,4 +34,3 @@ class ResetDevice(p.MessageType): self.label = label self.u2f_counter = u2f_counter self.skip_backup = skip_backup - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SelfTest.py b/src/trezor/messages/SelfTest.py index cc9d67f1a3..c5ad9d8bbd 100644 --- a/src/trezor/messages/SelfTest.py +++ b/src/trezor/messages/SelfTest.py @@ -3,15 +3,13 @@ import protobuf as p class SelfTest(p.MessageType): + MESSAGE_WIRE_TYPE = 32 FIELDS = { 1: ('payload', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 32 def __init__( self, - payload: bytes = None, - **kwargs, - ): + payload: bytes = None + ) -> None: self.payload = payload - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SetU2FCounter.py b/src/trezor/messages/SetU2FCounter.py index 26a5c97d87..4c0932809b 100644 --- a/src/trezor/messages/SetU2FCounter.py +++ b/src/trezor/messages/SetU2FCounter.py @@ -3,15 +3,13 @@ import protobuf as p class SetU2FCounter(p.MessageType): + MESSAGE_WIRE_TYPE = 63 FIELDS = { 1: ('u2f_counter', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 63 def __init__( self, - u2f_counter: int = None, - **kwargs, - ): + u2f_counter: int = None + ) -> None: self.u2f_counter = u2f_counter - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SignIdentity.py b/src/trezor/messages/SignIdentity.py index 46b9be5750..21716339c3 100644 --- a/src/trezor/messages/SignIdentity.py +++ b/src/trezor/messages/SignIdentity.py @@ -4,24 +4,22 @@ from .IdentityType import IdentityType class SignIdentity(p.MessageType): + MESSAGE_WIRE_TYPE = 53 FIELDS = { 1: ('identity', IdentityType, 0), 2: ('challenge_hidden', p.BytesType, 0), 3: ('challenge_visual', p.UnicodeType, 0), 4: ('ecdsa_curve_name', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 53 def __init__( self, identity: IdentityType = None, challenge_hidden: bytes = None, challenge_visual: str = None, - ecdsa_curve_name: str = None, - **kwargs, - ): + ecdsa_curve_name: str = None + ) -> None: self.identity = identity self.challenge_hidden = challenge_hidden self.challenge_visual = challenge_visual self.ecdsa_curve_name = ecdsa_curve_name - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SignMessage.py b/src/trezor/messages/SignMessage.py index 3f26142493..d312ee4f5e 100644 --- a/src/trezor/messages/SignMessage.py +++ b/src/trezor/messages/SignMessage.py @@ -1,26 +1,29 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class SignMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 38 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 2: ('message', p.BytesType, 0), # required 3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin' 4: ('script_type', p.UVarintType, 0), # default=0 } - MESSAGE_WIRE_TYPE = 38 def __init__( self, - address_n: list = None, + address_n: List[int] = None, message: bytes = None, coin_name: str = None, - script_type: int = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + script_type: int = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.message = message self.coin_name = coin_name self.script_type = script_type - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SignTx.py b/src/trezor/messages/SignTx.py index fc2425b302..6c91c19a12 100644 --- a/src/trezor/messages/SignTx.py +++ b/src/trezor/messages/SignTx.py @@ -3,6 +3,7 @@ import protobuf as p class SignTx(p.MessageType): + MESSAGE_WIRE_TYPE = 15 FIELDS = { 1: ('outputs_count', p.UVarintType, 0), # required 2: ('inputs_count', p.UVarintType, 0), # required @@ -11,7 +12,6 @@ class SignTx(p.MessageType): 5: ('lock_time', p.UVarintType, 0), # default=0 6: ('decred_expiry', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 15 def __init__( self, @@ -20,13 +20,11 @@ class SignTx(p.MessageType): coin_name: str = None, version: int = None, lock_time: int = None, - decred_expiry: int = None, - **kwargs, - ): + decred_expiry: int = None + ) -> None: self.outputs_count = outputs_count self.inputs_count = inputs_count self.coin_name = coin_name self.version = version self.lock_time = lock_time self.decred_expiry = decred_expiry - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SignedIdentity.py b/src/trezor/messages/SignedIdentity.py index effc4d4490..06433ad86c 100644 --- a/src/trezor/messages/SignedIdentity.py +++ b/src/trezor/messages/SignedIdentity.py @@ -3,21 +3,19 @@ import protobuf as p class SignedIdentity(p.MessageType): + MESSAGE_WIRE_TYPE = 54 FIELDS = { 1: ('address', p.UnicodeType, 0), 2: ('public_key', p.BytesType, 0), 3: ('signature', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 54 def __init__( self, address: str = None, public_key: bytes = None, - signature: bytes = None, - **kwargs, - ): + signature: bytes = None + ) -> None: self.address = address self.public_key = public_key self.signature = signature - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SimpleSignTx.py b/src/trezor/messages/SimpleSignTx.py index 27f0d7a02b..7f2a27a6a1 100644 --- a/src/trezor/messages/SimpleSignTx.py +++ b/src/trezor/messages/SimpleSignTx.py @@ -1,11 +1,17 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .TransactionType import TransactionType from .TxInputType import TxInputType from .TxOutputType import TxOutputType class SimpleSignTx(p.MessageType): + MESSAGE_WIRE_TYPE = 16 FIELDS = { 1: ('inputs', TxInputType, p.FLAG_REPEATED), 2: ('outputs', TxOutputType, p.FLAG_REPEATED), @@ -14,22 +20,19 @@ class SimpleSignTx(p.MessageType): 5: ('version', p.UVarintType, 0), # default=1 6: ('lock_time', p.UVarintType, 0), # default=0 } - MESSAGE_WIRE_TYPE = 16 def __init__( self, - inputs: list = None, - outputs: list = None, - transactions: list = None, + inputs: List[TxInputType] = None, + outputs: List[TxOutputType] = None, + transactions: List[TransactionType] = None, coin_name: str = None, version: int = None, - lock_time: int = None, - **kwargs, - ): - self.inputs = [] if inputs is None else inputs - self.outputs = [] if outputs is None else outputs - self.transactions = [] if transactions is None else transactions + lock_time: int = None + ) -> None: + self.inputs = inputs if inputs is not None else [] + self.outputs = outputs if outputs is not None else [] + self.transactions = transactions if transactions is not None else [] self.coin_name = coin_name self.version = version self.lock_time = lock_time - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarAccountMergeOp.py b/src/trezor/messages/StellarAccountMergeOp.py index e1b16820a4..474a96e878 100644 --- a/src/trezor/messages/StellarAccountMergeOp.py +++ b/src/trezor/messages/StellarAccountMergeOp.py @@ -3,18 +3,16 @@ import protobuf as p class StellarAccountMergeOp(p.MessageType): + MESSAGE_WIRE_TYPE = 218 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('destination_account', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 218 def __init__( self, source_account: bytes = None, - destination_account: bytes = None, - **kwargs, - ): + destination_account: bytes = None + ) -> None: self.source_account = source_account self.destination_account = destination_account - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarAllowTrustOp.py b/src/trezor/messages/StellarAllowTrustOp.py index 0dcba61981..a7fe5c7c11 100644 --- a/src/trezor/messages/StellarAllowTrustOp.py +++ b/src/trezor/messages/StellarAllowTrustOp.py @@ -3,6 +3,7 @@ import protobuf as p class StellarAllowTrustOp(p.MessageType): + MESSAGE_WIRE_TYPE = 217 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('trusted_account', p.BytesType, 0), @@ -10,7 +11,6 @@ class StellarAllowTrustOp(p.MessageType): 4: ('asset_code', p.UnicodeType, 0), 5: ('is_authorized', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 217 def __init__( self, @@ -18,12 +18,10 @@ class StellarAllowTrustOp(p.MessageType): trusted_account: bytes = None, asset_type: int = None, asset_code: str = None, - is_authorized: int = None, - **kwargs, - ): + is_authorized: int = None + ) -> None: self.source_account = source_account self.trusted_account = trusted_account self.asset_type = asset_type self.asset_code = asset_code self.is_authorized = is_authorized - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarAssetType.py b/src/trezor/messages/StellarAssetType.py index a52c7e3069..f32da707db 100644 --- a/src/trezor/messages/StellarAssetType.py +++ b/src/trezor/messages/StellarAssetType.py @@ -13,10 +13,8 @@ class StellarAssetType(p.MessageType): self, type: int = None, code: str = None, - issuer: bytes = None, - **kwargs, - ): + issuer: bytes = None + ) -> None: self.type = type self.code = code self.issuer = issuer - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarBumpSequenceOp.py b/src/trezor/messages/StellarBumpSequenceOp.py index ab6f6e18c5..c805abc2de 100644 --- a/src/trezor/messages/StellarBumpSequenceOp.py +++ b/src/trezor/messages/StellarBumpSequenceOp.py @@ -3,18 +3,16 @@ import protobuf as p class StellarBumpSequenceOp(p.MessageType): + MESSAGE_WIRE_TYPE = 221 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('bump_to', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 221 def __init__( self, source_account: bytes = None, - bump_to: int = None, - **kwargs, - ): + bump_to: int = None + ) -> None: self.source_account = source_account self.bump_to = bump_to - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarChangeTrustOp.py b/src/trezor/messages/StellarChangeTrustOp.py index dbb38cff82..3b94f4fe6a 100644 --- a/src/trezor/messages/StellarChangeTrustOp.py +++ b/src/trezor/messages/StellarChangeTrustOp.py @@ -4,21 +4,19 @@ from .StellarAssetType import StellarAssetType class StellarChangeTrustOp(p.MessageType): + MESSAGE_WIRE_TYPE = 216 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('asset', StellarAssetType, 0), 3: ('limit', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 216 def __init__( self, source_account: bytes = None, asset: StellarAssetType = None, - limit: int = None, - **kwargs, - ): + limit: int = None + ) -> None: self.source_account = source_account self.asset = asset self.limit = limit - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarCreateAccountOp.py b/src/trezor/messages/StellarCreateAccountOp.py index 0ff7dd72cf..72e7f92584 100644 --- a/src/trezor/messages/StellarCreateAccountOp.py +++ b/src/trezor/messages/StellarCreateAccountOp.py @@ -3,21 +3,19 @@ import protobuf as p class StellarCreateAccountOp(p.MessageType): + MESSAGE_WIRE_TYPE = 210 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('new_account', p.BytesType, 0), - 3: ('starting_balance', p.Sint64Type, 0), + 3: ('starting_balance', p.SVarintType, 0), } - MESSAGE_WIRE_TYPE = 210 def __init__( self, source_account: bytes = None, new_account: bytes = None, - starting_balance: int = None, - **kwargs, - ): + starting_balance: int = None + ) -> None: self.source_account = source_account self.new_account = new_account self.starting_balance = starting_balance - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarCreatePassiveOfferOp.py b/src/trezor/messages/StellarCreatePassiveOfferOp.py index 38cfeec497..28acd9e907 100644 --- a/src/trezor/messages/StellarCreatePassiveOfferOp.py +++ b/src/trezor/messages/StellarCreatePassiveOfferOp.py @@ -4,15 +4,15 @@ from .StellarAssetType import StellarAssetType class StellarCreatePassiveOfferOp(p.MessageType): + MESSAGE_WIRE_TYPE = 214 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('selling_asset', StellarAssetType, 0), 3: ('buying_asset', StellarAssetType, 0), - 4: ('amount', p.Sint64Type, 0), + 4: ('amount', p.SVarintType, 0), 5: ('price_n', p.UVarintType, 0), 6: ('price_d', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 214 def __init__( self, @@ -21,13 +21,11 @@ class StellarCreatePassiveOfferOp(p.MessageType): buying_asset: StellarAssetType = None, amount: int = None, price_n: int = None, - price_d: int = None, - **kwargs, - ): + price_d: int = None + ) -> None: self.source_account = source_account self.selling_asset = selling_asset self.buying_asset = buying_asset self.amount = amount self.price_n = price_n self.price_d = price_d - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarGetPublicKey.py b/src/trezor/messages/StellarGetPublicKey.py index ddce95e539..46a7842888 100644 --- a/src/trezor/messages/StellarGetPublicKey.py +++ b/src/trezor/messages/StellarGetPublicKey.py @@ -1,17 +1,20 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class StellarGetPublicKey(p.MessageType): + MESSAGE_WIRE_TYPE = 200 FIELDS = { 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), } - MESSAGE_WIRE_TYPE = 200 def __init__( self, - address_n: list = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n - p.MessageType.__init__(self, **kwargs) + address_n: List[int] = None + ) -> None: + self.address_n = address_n if address_n is not None else [] diff --git a/src/trezor/messages/StellarManageDataOp.py b/src/trezor/messages/StellarManageDataOp.py index 1871c84fac..c20c5aab81 100644 --- a/src/trezor/messages/StellarManageDataOp.py +++ b/src/trezor/messages/StellarManageDataOp.py @@ -3,21 +3,19 @@ import protobuf as p class StellarManageDataOp(p.MessageType): + MESSAGE_WIRE_TYPE = 220 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('key', p.UnicodeType, 0), 3: ('value', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 220 def __init__( self, source_account: bytes = None, key: str = None, - value: bytes = None, - **kwargs, - ): + value: bytes = None + ) -> None: self.source_account = source_account self.key = key self.value = value - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarManageOfferOp.py b/src/trezor/messages/StellarManageOfferOp.py index 9daac495e4..c99617866e 100644 --- a/src/trezor/messages/StellarManageOfferOp.py +++ b/src/trezor/messages/StellarManageOfferOp.py @@ -4,16 +4,16 @@ from .StellarAssetType import StellarAssetType class StellarManageOfferOp(p.MessageType): + MESSAGE_WIRE_TYPE = 213 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('selling_asset', StellarAssetType, 0), 3: ('buying_asset', StellarAssetType, 0), - 4: ('amount', p.Sint64Type, 0), + 4: ('amount', p.SVarintType, 0), 5: ('price_n', p.UVarintType, 0), 6: ('price_d', p.UVarintType, 0), 7: ('offer_id', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 213 def __init__( self, @@ -23,9 +23,8 @@ class StellarManageOfferOp(p.MessageType): amount: int = None, price_n: int = None, price_d: int = None, - offer_id: int = None, - **kwargs, - ): + offer_id: int = None + ) -> None: self.source_account = source_account self.selling_asset = selling_asset self.buying_asset = buying_asset @@ -33,4 +32,3 @@ class StellarManageOfferOp(p.MessageType): self.price_n = price_n self.price_d = price_d self.offer_id = offer_id - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarPathPaymentOp.py b/src/trezor/messages/StellarPathPaymentOp.py index 4e09f0dd00..228dede1a0 100644 --- a/src/trezor/messages/StellarPathPaymentOp.py +++ b/src/trezor/messages/StellarPathPaymentOp.py @@ -1,19 +1,24 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .StellarAssetType import StellarAssetType class StellarPathPaymentOp(p.MessageType): + MESSAGE_WIRE_TYPE = 212 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('send_asset', StellarAssetType, 0), - 3: ('send_max', p.Sint64Type, 0), + 3: ('send_max', p.SVarintType, 0), 4: ('destination_account', p.BytesType, 0), 5: ('destination_asset', StellarAssetType, 0), - 6: ('destination_amount', p.Sint64Type, 0), + 6: ('destination_amount', p.SVarintType, 0), 7: ('paths', StellarAssetType, p.FLAG_REPEATED), } - MESSAGE_WIRE_TYPE = 212 def __init__( self, @@ -23,14 +28,12 @@ class StellarPathPaymentOp(p.MessageType): destination_account: bytes = None, destination_asset: StellarAssetType = None, destination_amount: int = None, - paths: list = None, - **kwargs, - ): + paths: List[StellarAssetType] = None + ) -> None: self.source_account = source_account self.send_asset = send_asset self.send_max = send_max self.destination_account = destination_account self.destination_asset = destination_asset self.destination_amount = destination_amount - self.paths = [] if paths is None else paths - p.MessageType.__init__(self, **kwargs) + self.paths = paths if paths is not None else [] diff --git a/src/trezor/messages/StellarPaymentOp.py b/src/trezor/messages/StellarPaymentOp.py index ee621aeac1..3a66f8479f 100644 --- a/src/trezor/messages/StellarPaymentOp.py +++ b/src/trezor/messages/StellarPaymentOp.py @@ -4,24 +4,22 @@ from .StellarAssetType import StellarAssetType class StellarPaymentOp(p.MessageType): + MESSAGE_WIRE_TYPE = 211 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('destination_account', p.BytesType, 0), 3: ('asset', StellarAssetType, 0), - 4: ('amount', p.Sint64Type, 0), + 4: ('amount', p.SVarintType, 0), } - MESSAGE_WIRE_TYPE = 211 def __init__( self, source_account: bytes = None, destination_account: bytes = None, asset: StellarAssetType = None, - amount: int = None, - **kwargs, - ): + amount: int = None + ) -> None: self.source_account = source_account self.destination_account = destination_account self.asset = asset self.amount = amount - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarPublicKey.py b/src/trezor/messages/StellarPublicKey.py index c09c55fb7c..6607876025 100644 --- a/src/trezor/messages/StellarPublicKey.py +++ b/src/trezor/messages/StellarPublicKey.py @@ -3,15 +3,13 @@ import protobuf as p class StellarPublicKey(p.MessageType): + MESSAGE_WIRE_TYPE = 201 FIELDS = { 1: ('public_key', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 201 def __init__( self, - public_key: bytes = None, - **kwargs, - ): + public_key: bytes = None + ) -> None: self.public_key = public_key - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarSetOptionsOp.py b/src/trezor/messages/StellarSetOptionsOp.py index 9e7bd11cb5..19362c623a 100644 --- a/src/trezor/messages/StellarSetOptionsOp.py +++ b/src/trezor/messages/StellarSetOptionsOp.py @@ -3,6 +3,7 @@ import protobuf as p class StellarSetOptionsOp(p.MessageType): + MESSAGE_WIRE_TYPE = 215 FIELDS = { 1: ('source_account', p.BytesType, 0), 2: ('inflation_destination_account', p.BytesType, 0), @@ -17,7 +18,6 @@ class StellarSetOptionsOp(p.MessageType): 11: ('signer_key', p.BytesType, 0), 12: ('signer_weight', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 215 def __init__( self, @@ -32,9 +32,8 @@ class StellarSetOptionsOp(p.MessageType): home_domain: str = None, signer_type: int = None, signer_key: bytes = None, - signer_weight: int = None, - **kwargs, - ): + signer_weight: int = None + ) -> None: self.source_account = source_account self.inflation_destination_account = inflation_destination_account self.clear_flags = clear_flags @@ -47,4 +46,3 @@ class StellarSetOptionsOp(p.MessageType): self.signer_type = signer_type self.signer_key = signer_key self.signer_weight = signer_weight - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarSignTx.py b/src/trezor/messages/StellarSignTx.py index 5e99f1fae2..d75971294c 100644 --- a/src/trezor/messages/StellarSignTx.py +++ b/src/trezor/messages/StellarSignTx.py @@ -1,8 +1,14 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None class StellarSignTx(p.MessageType): + MESSAGE_WIRE_TYPE = 202 FIELDS = { 1: ('protocol_version', p.UVarintType, 0), 2: ('address_n', p.UVarintType, p.FLAG_REPEATED), @@ -18,12 +24,11 @@ class StellarSignTx(p.MessageType): 13: ('memo_hash', p.BytesType, 0), 14: ('num_operations', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 202 def __init__( self, protocol_version: int = None, - address_n: list = None, + address_n: List[int] = None, network_passphrase: str = None, source_account: bytes = None, fee: int = None, @@ -34,11 +39,10 @@ class StellarSignTx(p.MessageType): memo_text: str = None, memo_id: int = None, memo_hash: bytes = None, - num_operations: int = None, - **kwargs, - ): + num_operations: int = None + ) -> None: self.protocol_version = protocol_version - self.address_n = [] if address_n is None else address_n + self.address_n = address_n if address_n is not None else [] self.network_passphrase = network_passphrase self.source_account = source_account self.fee = fee @@ -50,4 +54,3 @@ class StellarSignTx(p.MessageType): self.memo_id = memo_id self.memo_hash = memo_hash self.num_operations = num_operations - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarSignedTx.py b/src/trezor/messages/StellarSignedTx.py index 8815c969f4..4e02b1a3a2 100644 --- a/src/trezor/messages/StellarSignedTx.py +++ b/src/trezor/messages/StellarSignedTx.py @@ -3,18 +3,16 @@ import protobuf as p class StellarSignedTx(p.MessageType): + MESSAGE_WIRE_TYPE = 230 FIELDS = { 1: ('public_key', p.BytesType, 0), 2: ('signature', p.BytesType, 0), } - MESSAGE_WIRE_TYPE = 230 def __init__( self, public_key: bytes = None, - signature: bytes = None, - **kwargs, - ): + signature: bytes = None + ) -> None: self.public_key = public_key self.signature = signature - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/StellarTxOpRequest.py b/src/trezor/messages/StellarTxOpRequest.py index 01aed2959d..0a7e18a5b4 100644 --- a/src/trezor/messages/StellarTxOpRequest.py +++ b/src/trezor/messages/StellarTxOpRequest.py @@ -4,9 +4,3 @@ import protobuf as p class StellarTxOpRequest(p.MessageType): MESSAGE_WIRE_TYPE = 203 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/Success.py b/src/trezor/messages/Success.py index b81b1f6da0..ed78875326 100644 --- a/src/trezor/messages/Success.py +++ b/src/trezor/messages/Success.py @@ -3,15 +3,13 @@ import protobuf as p class Success(p.MessageType): + MESSAGE_WIRE_TYPE = 2 FIELDS = { 1: ('message', p.UnicodeType, 0), } - MESSAGE_WIRE_TYPE = 2 def __init__( self, - message: str = None, - **kwargs, - ): + message: str = None + ) -> None: self.message = message - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TransactionType.py b/src/trezor/messages/TransactionType.py index 6ffd4f2bbf..ef1abeca7a 100644 --- a/src/trezor/messages/TransactionType.py +++ b/src/trezor/messages/TransactionType.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .TxInputType import TxInputType from .TxOutputBinType import TxOutputBinType from .TxOutputType import TxOutputType @@ -10,8 +15,8 @@ class TransactionType(p.MessageType): 1: ('version', p.UVarintType, 0), 2: ('inputs', TxInputType, p.FLAG_REPEATED), 3: ('bin_outputs', TxOutputBinType, p.FLAG_REPEATED), - 4: ('lock_time', p.UVarintType, 0), 5: ('outputs', TxOutputType, p.FLAG_REPEATED), + 4: ('lock_time', p.UVarintType, 0), 6: ('inputs_cnt', p.UVarintType, 0), 7: ('outputs_cnt', p.UVarintType, 0), 8: ('extra_data', p.BytesType, 0), @@ -23,27 +28,25 @@ class TransactionType(p.MessageType): def __init__( self, version: int = None, - inputs: list = None, - bin_outputs: list = None, + inputs: List[TxInputType] = None, + bin_outputs: List[TxOutputBinType] = None, + outputs: List[TxOutputType] = None, lock_time: int = None, - outputs: list = None, inputs_cnt: int = None, outputs_cnt: int = None, extra_data: bytes = None, extra_data_len: int = None, decred_expiry: int = None, - overwintered: bool = None, - **kwargs, - ): + overwintered: bool = None + ) -> None: self.version = version - self.inputs = [] if inputs is None else inputs - self.bin_outputs = [] if bin_outputs is None else bin_outputs + self.inputs = inputs if inputs is not None else [] + self.bin_outputs = bin_outputs if bin_outputs is not None else [] + self.outputs = outputs if outputs is not None else [] self.lock_time = lock_time - self.outputs = [] if outputs is None else outputs self.inputs_cnt = inputs_cnt self.outputs_cnt = outputs_cnt self.extra_data = extra_data self.extra_data_len = extra_data_len self.decred_expiry = decred_expiry self.overwintered = overwintered - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxAck.py b/src/trezor/messages/TxAck.py index 3ea27bf9e6..94e74e0016 100644 --- a/src/trezor/messages/TxAck.py +++ b/src/trezor/messages/TxAck.py @@ -4,15 +4,13 @@ from .TransactionType import TransactionType class TxAck(p.MessageType): + MESSAGE_WIRE_TYPE = 22 FIELDS = { 1: ('tx', TransactionType, 0), } - MESSAGE_WIRE_TYPE = 22 def __init__( self, - tx: TransactionType = None, - **kwargs, - ): + tx: TransactionType = None + ) -> None: self.tx = tx - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxInputType.py b/src/trezor/messages/TxInputType.py index 53304d0ac9..b97a15a160 100644 --- a/src/trezor/messages/TxInputType.py +++ b/src/trezor/messages/TxInputType.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .MultisigRedeemScriptType import MultisigRedeemScriptType @@ -19,7 +24,7 @@ class TxInputType(p.MessageType): def __init__( self, - address_n: list = None, + address_n: List[int] = None, prev_hash: bytes = None, prev_index: int = None, script_sig: bytes = None, @@ -28,10 +33,9 @@ class TxInputType(p.MessageType): multisig: MultisigRedeemScriptType = None, amount: int = None, decred_tree: int = None, - decred_script_version: int = None, - **kwargs, - ): - self.address_n = [] if address_n is None else address_n + decred_script_version: int = None + ) -> None: + self.address_n = address_n if address_n is not None else [] self.prev_hash = prev_hash self.prev_index = prev_index self.script_sig = script_sig @@ -41,4 +45,3 @@ class TxInputType(p.MessageType): self.amount = amount self.decred_tree = decred_tree self.decred_script_version = decred_script_version - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxOutputBinType.py b/src/trezor/messages/TxOutputBinType.py index 427fbdd7f8..3e91562998 100644 --- a/src/trezor/messages/TxOutputBinType.py +++ b/src/trezor/messages/TxOutputBinType.py @@ -13,10 +13,8 @@ class TxOutputBinType(p.MessageType): self, amount: int = None, script_pubkey: bytes = None, - decred_script_version: int = None, - **kwargs, - ): + decred_script_version: int = None + ) -> None: self.amount = amount self.script_pubkey = script_pubkey self.decred_script_version = decred_script_version - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxOutputType.py b/src/trezor/messages/TxOutputType.py index 716920fa94..3735d5dad6 100644 --- a/src/trezor/messages/TxOutputType.py +++ b/src/trezor/messages/TxOutputType.py @@ -1,5 +1,10 @@ # Automatically generated by pb2py import protobuf as p +if __debug__: + try: + from typing import List + except ImportError: + List = None from .MultisigRedeemScriptType import MultisigRedeemScriptType @@ -17,19 +22,17 @@ class TxOutputType(p.MessageType): def __init__( self, address: str = None, - address_n: list = None, + address_n: List[int] = None, amount: int = None, script_type: int = None, multisig: MultisigRedeemScriptType = None, op_return_data: bytes = None, - decred_script_version: int = None, - **kwargs, - ): + decred_script_version: int = None + ) -> None: self.address = address - self.address_n = [] if address_n is None else address_n + self.address_n = address_n if address_n is not None else [] self.amount = amount self.script_type = script_type self.multisig = multisig self.op_return_data = op_return_data self.decred_script_version = decred_script_version - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxRequest.py b/src/trezor/messages/TxRequest.py index 8409d1bf15..73217ba539 100644 --- a/src/trezor/messages/TxRequest.py +++ b/src/trezor/messages/TxRequest.py @@ -5,21 +5,19 @@ from .TxRequestSerializedType import TxRequestSerializedType class TxRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 21 FIELDS = { 1: ('request_type', p.UVarintType, 0), 2: ('details', TxRequestDetailsType, 0), 3: ('serialized', TxRequestSerializedType, 0), } - MESSAGE_WIRE_TYPE = 21 def __init__( self, request_type: int = None, details: TxRequestDetailsType = None, - serialized: TxRequestSerializedType = None, - **kwargs, - ): + serialized: TxRequestSerializedType = None + ) -> None: self.request_type = request_type self.details = details self.serialized = serialized - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxRequestDetailsType.py b/src/trezor/messages/TxRequestDetailsType.py index 1755dff311..c38129e1f1 100644 --- a/src/trezor/messages/TxRequestDetailsType.py +++ b/src/trezor/messages/TxRequestDetailsType.py @@ -15,11 +15,9 @@ class TxRequestDetailsType(p.MessageType): request_index: int = None, tx_hash: bytes = None, extra_data_len: int = None, - extra_data_offset: int = None, - **kwargs, - ): + extra_data_offset: int = None + ) -> None: self.request_index = request_index self.tx_hash = tx_hash self.extra_data_len = extra_data_len self.extra_data_offset = extra_data_offset - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxRequestSerializedType.py b/src/trezor/messages/TxRequestSerializedType.py index 61bf936a1a..64be1099be 100644 --- a/src/trezor/messages/TxRequestSerializedType.py +++ b/src/trezor/messages/TxRequestSerializedType.py @@ -13,10 +13,8 @@ class TxRequestSerializedType(p.MessageType): self, signature_index: int = None, signature: bytes = None, - serialized_tx: bytes = None, - **kwargs, - ): + serialized_tx: bytes = None + ) -> None: self.signature_index = signature_index self.signature = signature self.serialized_tx = serialized_tx - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxSize.py b/src/trezor/messages/TxSize.py index b2fd88b48c..6092715b80 100644 --- a/src/trezor/messages/TxSize.py +++ b/src/trezor/messages/TxSize.py @@ -3,15 +3,13 @@ import protobuf as p class TxSize(p.MessageType): + MESSAGE_WIRE_TYPE = 44 FIELDS = { 1: ('tx_size', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 44 def __init__( self, - tx_size: int = None, - **kwargs, - ): + tx_size: int = None + ) -> None: self.tx_size = tx_size - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/VerifyMessage.py b/src/trezor/messages/VerifyMessage.py index 2a13075a76..82eb738bb8 100644 --- a/src/trezor/messages/VerifyMessage.py +++ b/src/trezor/messages/VerifyMessage.py @@ -3,24 +3,22 @@ import protobuf as p class VerifyMessage(p.MessageType): + MESSAGE_WIRE_TYPE = 39 FIELDS = { 1: ('address', p.UnicodeType, 0), 2: ('signature', p.BytesType, 0), 3: ('message', p.BytesType, 0), 4: ('coin_name', p.UnicodeType, 0), # default='Bitcoin' } - MESSAGE_WIRE_TYPE = 39 def __init__( self, address: str = None, signature: bytes = None, message: bytes = None, - coin_name: str = None, - **kwargs, - ): + coin_name: str = None + ) -> None: self.address = address self.signature = signature self.message = message self.coin_name = coin_name - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/WipeDevice.py b/src/trezor/messages/WipeDevice.py index 830dcac400..483fd6d259 100644 --- a/src/trezor/messages/WipeDevice.py +++ b/src/trezor/messages/WipeDevice.py @@ -4,9 +4,3 @@ import protobuf as p class WipeDevice(p.MessageType): MESSAGE_WIRE_TYPE = 5 - - def __init__( - self, - **kwargs, - ): - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/WordAck.py b/src/trezor/messages/WordAck.py index 3e364a5bdf..9af06b5bcb 100644 --- a/src/trezor/messages/WordAck.py +++ b/src/trezor/messages/WordAck.py @@ -3,15 +3,13 @@ import protobuf as p class WordAck(p.MessageType): + MESSAGE_WIRE_TYPE = 47 FIELDS = { 1: ('word', p.UnicodeType, 0), # required } - MESSAGE_WIRE_TYPE = 47 def __init__( self, - word: str = None, - **kwargs, - ): + word: str = None + ) -> None: self.word = word - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/WordRequest.py b/src/trezor/messages/WordRequest.py index 12c671259a..6df273ea23 100644 --- a/src/trezor/messages/WordRequest.py +++ b/src/trezor/messages/WordRequest.py @@ -3,15 +3,13 @@ import protobuf as p class WordRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 46 FIELDS = { 1: ('type', p.UVarintType, 0), } - MESSAGE_WIRE_TYPE = 46 def __init__( self, - type: int = None, - **kwargs, - ): + type: int = None + ) -> None: self.type = type - p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/WordRequestType.py b/src/trezor/messages/WordRequestType.py index 2c646605a9..324b4c3af3 100644 --- a/src/trezor/messages/WordRequestType.py +++ b/src/trezor/messages/WordRequestType.py @@ -1,6 +1,4 @@ # Automatically generated by pb2py -from micropython import const - -Plain = const(0) -Matrix9 = const(1) -Matrix6 = const(2) +Plain = 0 +Matrix9 = 1 +Matrix6 = 2 diff --git a/src/trezor/messages/wire_types.py b/src/trezor/messages/wire_types.py index c813cb394e..66b2787581 100644 --- a/src/trezor/messages/wire_types.py +++ b/src/trezor/messages/wire_types.py @@ -1,110 +1,108 @@ # Automatically generated by pb2py -from micropython import const - -Address = const(30) -ApplyFlags = const(28) -ApplySettings = const(25) -BackupDevice = const(34) -ButtonAck = const(27) -ButtonRequest = const(26) -Cancel = const(20) -ChangePin = const(4) -CipherKeyValue = const(23) -CipheredKeyValue = const(48) -ClearSession = const(24) -CosiCommit = const(71) -CosiCommitment = const(72) -CosiSign = const(73) -CosiSignature = const(74) -DebugLinkDecision = const(100) -DebugLinkFlashErase = const(113) -DebugLinkGetState = const(101) -DebugLinkLog = const(104) -DebugLinkMemory = const(111) -DebugLinkMemoryRead = const(110) -DebugLinkMemoryWrite = const(112) -DebugLinkState = const(102) -DebugLinkStop = const(103) -DecryptMessage = const(51) -DecryptedMessage = const(52) -ECDHSessionKey = const(62) -EncryptMessage = const(49) -EncryptedMessage = const(50) -Entropy = const(10) -EntropyAck = const(36) -EntropyRequest = const(35) -EstimateTxSize = const(43) -EthereumAddress = const(57) -EthereumGetAddress = const(56) -EthereumMessageSignature = const(66) -EthereumSignMessage = const(64) -EthereumSignTx = const(58) -EthereumTxAck = const(60) -EthereumTxRequest = const(59) -EthereumVerifyMessage = const(65) -Failure = const(3) -Features = const(17) -FirmwareErase = const(6) -FirmwareRequest = const(8) -FirmwareUpload = const(7) -GetAddress = const(29) -GetECDHSessionKey = const(61) -GetEntropy = const(9) -GetFeatures = const(55) -GetPublicKey = const(11) -Initialize = const(0) -LiskAddress = const(115) -LiskGetAddress = const(114) -LiskGetPublicKey = const(121) -LiskPublicKey = const(122) -LiskSignTx = const(116) -LiskSignedTx = const(117) -LoadDevice = const(13) -MessageSignature = const(40) -NEMAddress = const(68) -NEMDecryptMessage = const(75) -NEMDecryptedMessage = const(76) -NEMGetAddress = const(67) -NEMSignTx = const(69) -NEMSignedTx = const(70) -PassphraseAck = const(42) -PassphraseRequest = const(41) -PassphraseStateAck = const(78) -PassphraseStateRequest = const(77) -PinMatrixAck = const(19) -PinMatrixRequest = const(18) -Ping = const(1) -PublicKey = const(12) -RecoveryDevice = const(45) -ResetDevice = const(14) -SelfTest = const(32) -SetU2FCounter = const(63) -SignIdentity = const(53) -SignMessage = const(38) -SignTx = const(15) -SignedIdentity = const(54) -SimpleSignTx = const(16) -StellarAccountMergeOp = const(218) -StellarAllowTrustOp = const(217) -StellarBumpSequenceOp = const(221) -StellarChangeTrustOp = const(216) -StellarCreateAccountOp = const(210) -StellarCreatePassiveOfferOp = const(214) -StellarGetPublicKey = const(200) -StellarManageDataOp = const(220) -StellarManageOfferOp = const(213) -StellarPathPaymentOp = const(212) -StellarPaymentOp = const(211) -StellarPublicKey = const(201) -StellarSetOptionsOp = const(215) -StellarSignTx = const(202) -StellarSignedTx = const(230) -StellarTxOpRequest = const(203) -Success = const(2) -TxAck = const(22) -TxRequest = const(21) -TxSize = const(44) -VerifyMessage = const(39) -WipeDevice = const(5) -WordAck = const(47) -WordRequest = const(46) +Initialize = 0 +Ping = 1 +Success = 2 +Failure = 3 +ChangePin = 4 +WipeDevice = 5 +FirmwareErase = 6 +FirmwareUpload = 7 +FirmwareRequest = 8 +GetEntropy = 9 +Entropy = 10 +GetPublicKey = 11 +PublicKey = 12 +LoadDevice = 13 +ResetDevice = 14 +SignTx = 15 +SimpleSignTx = 16 +Features = 17 +PinMatrixRequest = 18 +PinMatrixAck = 19 +Cancel = 20 +TxRequest = 21 +TxAck = 22 +CipherKeyValue = 23 +ClearSession = 24 +ApplySettings = 25 +ButtonRequest = 26 +ButtonAck = 27 +ApplyFlags = 28 +GetAddress = 29 +Address = 30 +SelfTest = 32 +BackupDevice = 34 +EntropyRequest = 35 +EntropyAck = 36 +SignMessage = 38 +VerifyMessage = 39 +MessageSignature = 40 +PassphraseRequest = 41 +PassphraseAck = 42 +PassphraseStateRequest = 77 +PassphraseStateAck = 78 +EstimateTxSize = 43 +TxSize = 44 +RecoveryDevice = 45 +WordRequest = 46 +WordAck = 47 +CipheredKeyValue = 48 +EncryptMessage = 49 +EncryptedMessage = 50 +DecryptMessage = 51 +DecryptedMessage = 52 +SignIdentity = 53 +SignedIdentity = 54 +GetFeatures = 55 +EthereumGetAddress = 56 +EthereumAddress = 57 +EthereumSignTx = 58 +EthereumTxRequest = 59 +EthereumTxAck = 60 +GetECDHSessionKey = 61 +ECDHSessionKey = 62 +SetU2FCounter = 63 +EthereumSignMessage = 64 +EthereumVerifyMessage = 65 +EthereumMessageSignature = 66 +NEMGetAddress = 67 +NEMAddress = 68 +NEMSignTx = 69 +NEMSignedTx = 70 +CosiCommit = 71 +CosiCommitment = 72 +CosiSign = 73 +CosiSignature = 74 +NEMDecryptMessage = 75 +NEMDecryptedMessage = 76 +DebugLinkDecision = 100 +DebugLinkGetState = 101 +DebugLinkState = 102 +DebugLinkStop = 103 +DebugLinkLog = 104 +DebugLinkMemoryRead = 110 +DebugLinkMemory = 111 +DebugLinkMemoryWrite = 112 +DebugLinkFlashErase = 113 +LiskGetAddress = 114 +LiskAddress = 115 +LiskSignTx = 116 +LiskSignedTx = 117 +LiskGetPublicKey = 121 +LiskPublicKey = 122 +StellarGetPublicKey = 200 +StellarPublicKey = 201 +StellarSignTx = 202 +StellarTxOpRequest = 203 +StellarCreateAccountOp = 210 +StellarPaymentOp = 211 +StellarPathPaymentOp = 212 +StellarManageOfferOp = 213 +StellarCreatePassiveOfferOp = 214 +StellarSetOptionsOp = 215 +StellarChangeTrustOp = 216 +StellarAllowTrustOp = 217 +StellarAccountMergeOp = 218 +StellarManageDataOp = 220 +StellarBumpSequenceOp = 221 +StellarSignedTx = 230