diff --git a/src/trezor/messages/Address.py b/src/trezor/messages/Address.py index 712e6bd84..c04a40a28 100644 --- a/src/trezor/messages/Address.py +++ b/src/trezor/messages/Address.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('Address') -t.wire_type = const(30) -t.add_field(1, 'address', p.UnicodeType, flags=p.FLAG_REQUIRED) -Address = t + +class Address(p.MessageType): + FIELDS = { + 1: ('address', p.UnicodeType, 0), # required + } + MESSAGE_WIRE_TYPE = 30 diff --git a/src/trezor/messages/ApplySettings.py b/src/trezor/messages/ApplySettings.py index 094314876..425103833 100644 --- a/src/trezor/messages/ApplySettings.py +++ b/src/trezor/messages/ApplySettings.py @@ -1,10 +1,12 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('ApplySettings') -t.wire_type = const(25) -t.add_field(1, 'language', p.UnicodeType) -t.add_field(2, 'label', p.UnicodeType) -t.add_field(3, 'use_passphrase', p.BoolType) -t.add_field(4, 'homescreen', p.BytesType) -ApplySettings = t + +class ApplySettings(p.MessageType): + FIELDS = { + 1: ('language', p.UnicodeType, 0), + 2: ('label', p.UnicodeType, 0), + 3: ('use_passphrase', p.BoolType, 0), + 4: ('homescreen', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 25 diff --git a/src/trezor/messages/ButtonAck.py b/src/trezor/messages/ButtonAck.py index 581176cdd..c23d363f8 100644 --- a/src/trezor/messages/ButtonAck.py +++ b/src/trezor/messages/ButtonAck.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('ButtonAck') -t.wire_type = const(27) -ButtonAck = t + +class ButtonAck(p.MessageType): + MESSAGE_WIRE_TYPE = 27 diff --git a/src/trezor/messages/ButtonRequest.py b/src/trezor/messages/ButtonRequest.py index de8446acd..f3f0c0157 100644 --- a/src/trezor/messages/ButtonRequest.py +++ b/src/trezor/messages/ButtonRequest.py @@ -1,8 +1,10 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('ButtonRequest') -t.wire_type = const(26) -t.add_field(1, 'code', p.UVarintType) -t.add_field(2, 'data', p.UnicodeType) -ButtonRequest = t + +class ButtonRequest(p.MessageType): + FIELDS = { + 1: ('code', p.UVarintType, 0), + 2: ('data', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 26 diff --git a/src/trezor/messages/Cancel.py b/src/trezor/messages/Cancel.py index cb7fbd530..1effb5d5f 100644 --- a/src/trezor/messages/Cancel.py +++ b/src/trezor/messages/Cancel.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('Cancel') -t.wire_type = const(20) -Cancel = t + +class Cancel(p.MessageType): + MESSAGE_WIRE_TYPE = 20 diff --git a/src/trezor/messages/ChangePin.py b/src/trezor/messages/ChangePin.py index 2411e6938..d4f1162b9 100644 --- a/src/trezor/messages/ChangePin.py +++ b/src/trezor/messages/ChangePin.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('ChangePin') -t.wire_type = const(4) -t.add_field(1, 'remove', p.BoolType) -ChangePin = t + +class ChangePin(p.MessageType): + FIELDS = { + 1: ('remove', p.BoolType, 0), + } + MESSAGE_WIRE_TYPE = 4 diff --git a/src/trezor/messages/CipherKeyValue.py b/src/trezor/messages/CipherKeyValue.py index 381b77d5e..24cf26be4 100644 --- a/src/trezor/messages/CipherKeyValue.py +++ b/src/trezor/messages/CipherKeyValue.py @@ -1,13 +1,15 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('CipherKeyValue') -t.wire_type = const(23) -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'key', p.UnicodeType) -t.add_field(3, 'value', p.BytesType) -t.add_field(4, 'encrypt', p.BoolType) -t.add_field(5, 'ask_on_encrypt', p.BoolType) -t.add_field(6, 'ask_on_decrypt', p.BoolType) -t.add_field(7, 'iv', p.BytesType) -CipherKeyValue = t + +class CipherKeyValue(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('key', p.UnicodeType, 0), + 3: ('value', p.BytesType, 0), + 4: ('encrypt', p.BoolType, 0), + 5: ('ask_on_encrypt', p.BoolType, 0), + 6: ('ask_on_decrypt', p.BoolType, 0), + 7: ('iv', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 23 diff --git a/src/trezor/messages/CipheredKeyValue.py b/src/trezor/messages/CipheredKeyValue.py index 959025f95..86fc46d97 100644 --- a/src/trezor/messages/CipheredKeyValue.py +++ b/src/trezor/messages/CipheredKeyValue.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('CipheredKeyValue') -t.wire_type = const(48) -t.add_field(1, 'value', p.BytesType) -CipheredKeyValue = t + +class CipheredKeyValue(p.MessageType): + FIELDS = { + 1: ('value', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 48 diff --git a/src/trezor/messages/ClearSession.py b/src/trezor/messages/ClearSession.py index fd723b0a3..a80d802d8 100644 --- a/src/trezor/messages/ClearSession.py +++ b/src/trezor/messages/ClearSession.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('ClearSession') -t.wire_type = const(24) -ClearSession = t + +class ClearSession(p.MessageType): + MESSAGE_WIRE_TYPE = 24 diff --git a/src/trezor/messages/CoinType.py b/src/trezor/messages/CoinType.py index a0bc65788..40d7aaf19 100644 --- a/src/trezor/messages/CoinType.py +++ b/src/trezor/messages/CoinType.py @@ -1,13 +1,15 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('CoinType') -t.add_field(1, 'coin_name', p.UnicodeType) -t.add_field(2, 'coin_shortcut', p.UnicodeType) -t.add_field(3, 'address_type', p.UVarintType, default=0) -t.add_field(4, 'maxfee_kb', p.UVarintType) -t.add_field(5, 'address_type_p2sh', p.UVarintType, default=5) -t.add_field(6, 'address_type_p2wpkh', p.UVarintType, default=6) -t.add_field(7, 'address_type_p2wsh', p.UVarintType, default=10) -t.add_field(8, 'signed_message_header', p.UnicodeType) -CoinType = t + +class CoinType(p.MessageType): + FIELDS = { + 1: ('coin_name', p.UnicodeType, 0), + 2: ('coin_shortcut', p.UnicodeType, 0), + 3: ('address_type', p.UVarintType, 0), # default=0 + 4: ('maxfee_kb', p.UVarintType, 0), + 5: ('address_type_p2sh', p.UVarintType, 0), # default=5 + 6: ('address_type_p2wpkh', p.UVarintType, 0), # default=6 + 7: ('address_type_p2wsh', p.UVarintType, 0), # default=10 + 8: ('signed_message_header', p.UnicodeType, 0), + } diff --git a/src/trezor/messages/DebugLinkDecision.py b/src/trezor/messages/DebugLinkDecision.py index 10ff15e3a..2c4ebc3d0 100644 --- a/src/trezor/messages/DebugLinkDecision.py +++ b/src/trezor/messages/DebugLinkDecision.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkDecision') -t.wire_type = const(100) -t.add_field(1, 'yes_no', p.BoolType, flags=p.FLAG_REQUIRED) -DebugLinkDecision = t + +class DebugLinkDecision(p.MessageType): + FIELDS = { + 1: ('yes_no', p.BoolType, 0), # required + } + MESSAGE_WIRE_TYPE = 100 diff --git a/src/trezor/messages/DebugLinkFlashErase.py b/src/trezor/messages/DebugLinkFlashErase.py index 9aedfee77..6751cc043 100644 --- a/src/trezor/messages/DebugLinkFlashErase.py +++ b/src/trezor/messages/DebugLinkFlashErase.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkFlashErase') -t.wire_type = const(113) -t.add_field(1, 'sector', p.UVarintType) -DebugLinkFlashErase = t + +class DebugLinkFlashErase(p.MessageType): + FIELDS = { + 1: ('sector', p.UVarintType, 0), + } + MESSAGE_WIRE_TYPE = 113 diff --git a/src/trezor/messages/DebugLinkGetState.py b/src/trezor/messages/DebugLinkGetState.py index d772bad56..26615584f 100644 --- a/src/trezor/messages/DebugLinkGetState.py +++ b/src/trezor/messages/DebugLinkGetState.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkGetState') -t.wire_type = const(101) -DebugLinkGetState = t + +class DebugLinkGetState(p.MessageType): + MESSAGE_WIRE_TYPE = 101 diff --git a/src/trezor/messages/DebugLinkLog.py b/src/trezor/messages/DebugLinkLog.py index dde2eecce..0b4707b2a 100644 --- a/src/trezor/messages/DebugLinkLog.py +++ b/src/trezor/messages/DebugLinkLog.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkLog') -t.wire_type = const(104) -t.add_field(1, 'level', p.UVarintType) -t.add_field(2, 'bucket', p.UnicodeType) -t.add_field(3, 'text', p.UnicodeType) -DebugLinkLog = t + +class DebugLinkLog(p.MessageType): + FIELDS = { + 1: ('level', p.UVarintType, 0), + 2: ('bucket', p.UnicodeType, 0), + 3: ('text', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 104 diff --git a/src/trezor/messages/DebugLinkMemory.py b/src/trezor/messages/DebugLinkMemory.py index 40d27b20e..fd2227c67 100644 --- a/src/trezor/messages/DebugLinkMemory.py +++ b/src/trezor/messages/DebugLinkMemory.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkMemory') -t.wire_type = const(111) -t.add_field(1, 'memory', p.BytesType) -DebugLinkMemory = t + +class DebugLinkMemory(p.MessageType): + FIELDS = { + 1: ('memory', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 111 diff --git a/src/trezor/messages/DebugLinkMemoryRead.py b/src/trezor/messages/DebugLinkMemoryRead.py index c991bd978..25954e421 100644 --- a/src/trezor/messages/DebugLinkMemoryRead.py +++ b/src/trezor/messages/DebugLinkMemoryRead.py @@ -1,8 +1,10 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkMemoryRead') -t.wire_type = const(110) -t.add_field(1, 'address', p.UVarintType) -t.add_field(2, 'length', p.UVarintType) -DebugLinkMemoryRead = t + +class DebugLinkMemoryRead(p.MessageType): + FIELDS = { + 1: ('address', p.UVarintType, 0), + 2: ('length', p.UVarintType, 0), + } + MESSAGE_WIRE_TYPE = 110 diff --git a/src/trezor/messages/DebugLinkMemoryWrite.py b/src/trezor/messages/DebugLinkMemoryWrite.py index 9ab2b0b27..d3b6822ae 100644 --- a/src/trezor/messages/DebugLinkMemoryWrite.py +++ b/src/trezor/messages/DebugLinkMemoryWrite.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkMemoryWrite') -t.wire_type = const(112) -t.add_field(1, 'address', p.UVarintType) -t.add_field(2, 'memory', p.BytesType) -t.add_field(3, 'flash', p.BoolType) -DebugLinkMemoryWrite = t + +class DebugLinkMemoryWrite(p.MessageType): + FIELDS = { + 1: ('address', p.UVarintType, 0), + 2: ('memory', p.BytesType, 0), + 3: ('flash', p.BoolType, 0), + } + MESSAGE_WIRE_TYPE = 112 diff --git a/src/trezor/messages/DebugLinkState.py b/src/trezor/messages/DebugLinkState.py index 513b09af1..16ed8d1ba 100644 --- a/src/trezor/messages/DebugLinkState.py +++ b/src/trezor/messages/DebugLinkState.py @@ -2,16 +2,18 @@ import protobuf as p from micropython import const from .HDNodeType import HDNodeType -t = p.MessageType('DebugLinkState') -t.wire_type = const(102) -t.add_field(1, 'layout', p.BytesType) -t.add_field(2, 'pin', p.UnicodeType) -t.add_field(3, 'matrix', p.UnicodeType) -t.add_field(4, 'mnemonic', p.UnicodeType) -t.add_field(5, 'node', p.EmbeddedMessage(HDNodeType)) -t.add_field(6, 'passphrase_protection', p.BoolType) -t.add_field(7, 'reset_word', p.UnicodeType) -t.add_field(8, 'reset_entropy', p.BytesType) -t.add_field(9, 'recovery_fake_word', p.UnicodeType) -t.add_field(10, 'recovery_word_pos', p.UVarintType) -DebugLinkState = t + +class DebugLinkState(p.MessageType): + FIELDS = { + 1: ('layout', p.BytesType, 0), + 2: ('pin', p.UnicodeType, 0), + 3: ('matrix', p.UnicodeType, 0), + 4: ('mnemonic', p.UnicodeType, 0), + 5: ('node', HDNodeType, 0), + 6: ('passphrase_protection', p.BoolType, 0), + 7: ('reset_word', p.UnicodeType, 0), + 8: ('reset_entropy', p.BytesType, 0), + 9: ('recovery_fake_word', p.UnicodeType, 0), + 10: ('recovery_word_pos', p.UVarintType, 0), + } + MESSAGE_WIRE_TYPE = 102 diff --git a/src/trezor/messages/DebugLinkStop.py b/src/trezor/messages/DebugLinkStop.py index 08bc06bf2..4b409c261 100644 --- a/src/trezor/messages/DebugLinkStop.py +++ b/src/trezor/messages/DebugLinkStop.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DebugLinkStop') -t.wire_type = const(103) -DebugLinkStop = t + +class DebugLinkStop(p.MessageType): + MESSAGE_WIRE_TYPE = 103 diff --git a/src/trezor/messages/DecryptMessage.py b/src/trezor/messages/DecryptMessage.py index 1c6302175..31df8c384 100644 --- a/src/trezor/messages/DecryptMessage.py +++ b/src/trezor/messages/DecryptMessage.py @@ -1,10 +1,12 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DecryptMessage') -t.wire_type = const(51) -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'nonce', p.BytesType) -t.add_field(3, 'message', p.BytesType) -t.add_field(4, 'hmac', p.BytesType) -DecryptMessage = t + +class DecryptMessage(p.MessageType): + 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 diff --git a/src/trezor/messages/DecryptedMessage.py b/src/trezor/messages/DecryptedMessage.py index 18d8a4146..4a9d03568 100644 --- a/src/trezor/messages/DecryptedMessage.py +++ b/src/trezor/messages/DecryptedMessage.py @@ -1,8 +1,10 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('DecryptedMessage') -t.wire_type = const(52) -t.add_field(1, 'message', p.BytesType) -t.add_field(2, 'address', p.UnicodeType) -DecryptedMessage = t + +class DecryptedMessage(p.MessageType): + FIELDS = { + 1: ('message', p.BytesType, 0), + 2: ('address', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 52 diff --git a/src/trezor/messages/ECDHSessionKey.py b/src/trezor/messages/ECDHSessionKey.py index 2a5233940..18eac7493 100644 --- a/src/trezor/messages/ECDHSessionKey.py +++ b/src/trezor/messages/ECDHSessionKey.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('ECDHSessionKey') -t.wire_type = const(62) -t.add_field(1, 'session_key', p.BytesType) -ECDHSessionKey = t + +class ECDHSessionKey(p.MessageType): + FIELDS = { + 1: ('session_key', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 62 diff --git a/src/trezor/messages/EncryptMessage.py b/src/trezor/messages/EncryptMessage.py index 03a33418e..21e8c2924 100644 --- a/src/trezor/messages/EncryptMessage.py +++ b/src/trezor/messages/EncryptMessage.py @@ -1,11 +1,13 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EncryptMessage') -t.wire_type = const(49) -t.add_field(1, 'pubkey', p.BytesType) -t.add_field(2, 'message', p.BytesType) -t.add_field(3, 'display_only', p.BoolType) -t.add_field(4, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(5, 'coin_name', p.UnicodeType, default=u'Bitcoin') -EncryptMessage = t + +class EncryptMessage(p.MessageType): + FIELDS = { + 1: ('pubkey', p.BytesType, 0), + 2: ('message', p.BytesType, 0), + 3: ('display_only', p.BoolType, 0), + 4: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 5: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin' + } + MESSAGE_WIRE_TYPE = 49 diff --git a/src/trezor/messages/EncryptedMessage.py b/src/trezor/messages/EncryptedMessage.py index df96a6656..2b9a98147 100644 --- a/src/trezor/messages/EncryptedMessage.py +++ b/src/trezor/messages/EncryptedMessage.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EncryptedMessage') -t.wire_type = const(50) -t.add_field(1, 'nonce', p.BytesType) -t.add_field(2, 'message', p.BytesType) -t.add_field(3, 'hmac', p.BytesType) -EncryptedMessage = t + +class EncryptedMessage(p.MessageType): + FIELDS = { + 1: ('nonce', p.BytesType, 0), + 2: ('message', p.BytesType, 0), + 3: ('hmac', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 50 diff --git a/src/trezor/messages/Entropy.py b/src/trezor/messages/Entropy.py index 3d34c172c..3cae777ae 100644 --- a/src/trezor/messages/Entropy.py +++ b/src/trezor/messages/Entropy.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('Entropy') -t.wire_type = const(10) -t.add_field(1, 'entropy', p.BytesType, flags=p.FLAG_REQUIRED) -Entropy = t + +class Entropy(p.MessageType): + FIELDS = { + 1: ('entropy', p.BytesType, 0), # required + } + MESSAGE_WIRE_TYPE = 10 diff --git a/src/trezor/messages/EntropyAck.py b/src/trezor/messages/EntropyAck.py index 17ebc1317..3266be488 100644 --- a/src/trezor/messages/EntropyAck.py +++ b/src/trezor/messages/EntropyAck.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EntropyAck') -t.wire_type = const(36) -t.add_field(1, 'entropy', p.BytesType) -EntropyAck = t + +class EntropyAck(p.MessageType): + FIELDS = { + 1: ('entropy', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 36 diff --git a/src/trezor/messages/EntropyRequest.py b/src/trezor/messages/EntropyRequest.py index e51b85c6c..42bf91208 100644 --- a/src/trezor/messages/EntropyRequest.py +++ b/src/trezor/messages/EntropyRequest.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EntropyRequest') -t.wire_type = const(35) -EntropyRequest = t + +class EntropyRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 35 diff --git a/src/trezor/messages/EstimateTxSize.py b/src/trezor/messages/EstimateTxSize.py index 020b8c35e..8b19b1d77 100644 --- a/src/trezor/messages/EstimateTxSize.py +++ b/src/trezor/messages/EstimateTxSize.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EstimateTxSize') -t.wire_type = const(43) -t.add_field(1, 'outputs_count', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(2, 'inputs_count', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(3, 'coin_name', p.UnicodeType, default=u'Bitcoin') -EstimateTxSize = t + +class EstimateTxSize(p.MessageType): + FIELDS = { + 1: ('outputs_count', p.UVarintType, 0), # required + 2: ('inputs_count', p.UVarintType, 0), # required + 3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin' + } + MESSAGE_WIRE_TYPE = 43 diff --git a/src/trezor/messages/EthereumAddress.py b/src/trezor/messages/EthereumAddress.py index c8b1a6c93..43238f40f 100644 --- a/src/trezor/messages/EthereumAddress.py +++ b/src/trezor/messages/EthereumAddress.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EthereumAddress') -t.wire_type = const(57) -t.add_field(1, 'address', p.BytesType, flags=p.FLAG_REQUIRED) -EthereumAddress = t + +class EthereumAddress(p.MessageType): + FIELDS = { + 1: ('address', p.BytesType, 0), # required + } + MESSAGE_WIRE_TYPE = 57 diff --git a/src/trezor/messages/EthereumGetAddress.py b/src/trezor/messages/EthereumGetAddress.py index 62338dd42..31a31788f 100644 --- a/src/trezor/messages/EthereumGetAddress.py +++ b/src/trezor/messages/EthereumGetAddress.py @@ -1,8 +1,10 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EthereumGetAddress') -t.wire_type = const(56) -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'show_display', p.BoolType) -EthereumGetAddress = t + +class EthereumGetAddress(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('show_display', p.BoolType, 0), + } + MESSAGE_WIRE_TYPE = 56 diff --git a/src/trezor/messages/EthereumSignTx.py b/src/trezor/messages/EthereumSignTx.py index d11f76a4c..e154cf87d 100644 --- a/src/trezor/messages/EthereumSignTx.py +++ b/src/trezor/messages/EthereumSignTx.py @@ -1,14 +1,16 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EthereumSignTx') -t.wire_type = const(58) -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'nonce', p.BytesType) -t.add_field(3, 'gas_price', p.BytesType) -t.add_field(4, 'gas_limit', p.BytesType) -t.add_field(5, 'to', p.BytesType) -t.add_field(6, 'value', p.BytesType) -t.add_field(7, 'data_initial_chunk', p.BytesType) -t.add_field(8, 'data_length', p.UVarintType) -EthereumSignTx = t + +class EthereumSignTx(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('nonce', p.BytesType, 0), + 3: ('gas_price', p.BytesType, 0), + 4: ('gas_limit', p.BytesType, 0), + 5: ('to', p.BytesType, 0), + 6: ('value', p.BytesType, 0), + 7: ('data_initial_chunk', p.BytesType, 0), + 8: ('data_length', p.UVarintType, 0), + } + MESSAGE_WIRE_TYPE = 58 diff --git a/src/trezor/messages/EthereumTxAck.py b/src/trezor/messages/EthereumTxAck.py index d6fa37851..559a59fbd 100644 --- a/src/trezor/messages/EthereumTxAck.py +++ b/src/trezor/messages/EthereumTxAck.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EthereumTxAck') -t.wire_type = const(60) -t.add_field(1, 'data_chunk', p.BytesType) -EthereumTxAck = t + +class EthereumTxAck(p.MessageType): + FIELDS = { + 1: ('data_chunk', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 60 diff --git a/src/trezor/messages/EthereumTxRequest.py b/src/trezor/messages/EthereumTxRequest.py index 4f81f8013..af861cfa8 100644 --- a/src/trezor/messages/EthereumTxRequest.py +++ b/src/trezor/messages/EthereumTxRequest.py @@ -1,10 +1,12 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('EthereumTxRequest') -t.wire_type = const(59) -t.add_field(1, 'data_length', p.UVarintType) -t.add_field(2, 'signature_v', p.UVarintType) -t.add_field(3, 'signature_r', p.BytesType) -t.add_field(4, 'signature_s', p.BytesType) -EthereumTxRequest = t + +class EthereumTxRequest(p.MessageType): + 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 diff --git a/src/trezor/messages/Failure.py b/src/trezor/messages/Failure.py index 777d8fe6e..b285aa60d 100644 --- a/src/trezor/messages/Failure.py +++ b/src/trezor/messages/Failure.py @@ -1,8 +1,10 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('Failure') -t.wire_type = const(3) -t.add_field(1, 'code', p.UVarintType) -t.add_field(2, 'message', p.UnicodeType) -Failure = t + +class Failure(p.MessageType): + FIELDS = { + 1: ('code', p.UVarintType, 0), + 2: ('message', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 3 diff --git a/src/trezor/messages/Features.py b/src/trezor/messages/Features.py index 751503c24..af5ebbeff 100644 --- a/src/trezor/messages/Features.py +++ b/src/trezor/messages/Features.py @@ -2,24 +2,26 @@ import protobuf as p from micropython import const from .CoinType import CoinType -t = p.MessageType('Features') -t.wire_type = const(17) -t.add_field(1, 'vendor', p.UnicodeType) -t.add_field(2, 'major_version', p.UVarintType) -t.add_field(3, 'minor_version', p.UVarintType) -t.add_field(4, 'patch_version', p.UVarintType) -t.add_field(5, 'bootloader_mode', p.BoolType) -t.add_field(6, 'device_id', p.UnicodeType) -t.add_field(7, 'pin_protection', p.BoolType) -t.add_field(8, 'passphrase_protection', p.BoolType) -t.add_field(9, 'language', p.UnicodeType) -t.add_field(10, 'label', p.UnicodeType) -t.add_field(11, 'coins', p.EmbeddedMessage(CoinType), flags=p.FLAG_REPEATED) -t.add_field(12, 'initialized', p.BoolType) -t.add_field(13, 'revision', p.BytesType) -t.add_field(14, 'bootloader_hash', p.BytesType) -t.add_field(15, 'imported', p.BoolType) -t.add_field(16, 'pin_cached', p.BoolType) -t.add_field(17, 'passphrase_cached', p.BoolType) -t.add_field(18, 'firmware_present', p.BoolType) -Features = t + +class Features(p.MessageType): + FIELDS = { + 1: ('vendor', p.UnicodeType, 0), + 2: ('major_version', p.UVarintType, 0), + 3: ('minor_version', p.UVarintType, 0), + 4: ('patch_version', p.UVarintType, 0), + 5: ('bootloader_mode', p.BoolType, 0), + 6: ('device_id', p.UnicodeType, 0), + 7: ('pin_protection', p.BoolType, 0), + 8: ('passphrase_protection', p.BoolType, 0), + 9: ('language', p.UnicodeType, 0), + 10: ('label', p.UnicodeType, 0), + 11: ('coins', CoinType, p.FLAG_REPEATED), + 12: ('initialized', p.BoolType, 0), + 13: ('revision', p.BytesType, 0), + 14: ('bootloader_hash', p.BytesType, 0), + 15: ('imported', p.BoolType, 0), + 16: ('pin_cached', p.BoolType, 0), + 17: ('passphrase_cached', p.BoolType, 0), + 18: ('firmware_present', p.BoolType, 0), + } + MESSAGE_WIRE_TYPE = 17 diff --git a/src/trezor/messages/FirmwareErase.py b/src/trezor/messages/FirmwareErase.py index e0609a380..4ec469f5b 100644 --- a/src/trezor/messages/FirmwareErase.py +++ b/src/trezor/messages/FirmwareErase.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('FirmwareErase') -t.wire_type = const(6) -FirmwareErase = t + +class FirmwareErase(p.MessageType): + MESSAGE_WIRE_TYPE = 6 diff --git a/src/trezor/messages/FirmwareUpload.py b/src/trezor/messages/FirmwareUpload.py index cb5f03254..2e53a2f36 100644 --- a/src/trezor/messages/FirmwareUpload.py +++ b/src/trezor/messages/FirmwareUpload.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('FirmwareUpload') -t.wire_type = const(7) -t.add_field(1, 'payload', p.BytesType, flags=p.FLAG_REQUIRED) -FirmwareUpload = t + +class FirmwareUpload(p.MessageType): + FIELDS = { + 1: ('payload', p.BytesType, 0), # required + } + MESSAGE_WIRE_TYPE = 7 diff --git a/src/trezor/messages/GetAddress.py b/src/trezor/messages/GetAddress.py index bb7d11d1a..764ab2821 100644 --- a/src/trezor/messages/GetAddress.py +++ b/src/trezor/messages/GetAddress.py @@ -2,11 +2,13 @@ import protobuf as p from micropython import const from .MultisigRedeemScriptType import MultisigRedeemScriptType -t = p.MessageType('GetAddress') -t.wire_type = const(29) -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'coin_name', p.UnicodeType, default=u'Bitcoin') -t.add_field(3, 'show_display', p.BoolType) -t.add_field(4, 'multisig', p.EmbeddedMessage(MultisigRedeemScriptType)) -t.add_field(5, 'script_type', p.UVarintType, default=0) -GetAddress = t + +class GetAddress(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin' + 3: ('show_display', p.BoolType, 0), + 4: ('multisig', MultisigRedeemScriptType, 0), + 5: ('script_type', p.UVarintType, 0), # default=0 + } + MESSAGE_WIRE_TYPE = 29 diff --git a/src/trezor/messages/GetECDHSessionKey.py b/src/trezor/messages/GetECDHSessionKey.py index 0b112339f..2a7f7a130 100644 --- a/src/trezor/messages/GetECDHSessionKey.py +++ b/src/trezor/messages/GetECDHSessionKey.py @@ -2,9 +2,11 @@ import protobuf as p from micropython import const from .IdentityType import IdentityType -t = p.MessageType('GetECDHSessionKey') -t.wire_type = const(61) -t.add_field(1, 'identity', p.EmbeddedMessage(IdentityType)) -t.add_field(2, 'peer_public_key', p.BytesType) -t.add_field(3, 'ecdsa_curve_name', p.UnicodeType) -GetECDHSessionKey = t + +class GetECDHSessionKey(p.MessageType): + FIELDS = { + 1: ('identity', IdentityType, 0), + 2: ('peer_public_key', p.BytesType, 0), + 3: ('ecdsa_curve_name', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 61 diff --git a/src/trezor/messages/GetEntropy.py b/src/trezor/messages/GetEntropy.py index 9495a0597..78417e4a8 100644 --- a/src/trezor/messages/GetEntropy.py +++ b/src/trezor/messages/GetEntropy.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('GetEntropy') -t.wire_type = const(9) -t.add_field(1, 'size', p.UVarintType, flags=p.FLAG_REQUIRED) -GetEntropy = t + +class GetEntropy(p.MessageType): + FIELDS = { + 1: ('size', p.UVarintType, 0), # required + } + MESSAGE_WIRE_TYPE = 9 diff --git a/src/trezor/messages/GetFeatures.py b/src/trezor/messages/GetFeatures.py index 02efc58ba..8fab4f121 100644 --- a/src/trezor/messages/GetFeatures.py +++ b/src/trezor/messages/GetFeatures.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('GetFeatures') -t.wire_type = const(55) -GetFeatures = t + +class GetFeatures(p.MessageType): + MESSAGE_WIRE_TYPE = 55 diff --git a/src/trezor/messages/GetPublicKey.py b/src/trezor/messages/GetPublicKey.py index bb78e3efa..adc19545e 100644 --- a/src/trezor/messages/GetPublicKey.py +++ b/src/trezor/messages/GetPublicKey.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('GetPublicKey') -t.wire_type = const(11) -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'ecdsa_curve_name', p.UnicodeType) -t.add_field(3, 'show_display', p.BoolType) -GetPublicKey = t + +class GetPublicKey(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('ecdsa_curve_name', p.UnicodeType, 0), + 3: ('show_display', p.BoolType, 0), + } + MESSAGE_WIRE_TYPE = 11 diff --git a/src/trezor/messages/HDNodePathType.py b/src/trezor/messages/HDNodePathType.py index 3afb9235c..d022f0096 100644 --- a/src/trezor/messages/HDNodePathType.py +++ b/src/trezor/messages/HDNodePathType.py @@ -2,7 +2,9 @@ import protobuf as p from micropython import const from .HDNodeType import HDNodeType -t = p.MessageType('HDNodePathType') -t.add_field(1, 'node', p.EmbeddedMessage(HDNodeType), flags=p.FLAG_REQUIRED) -t.add_field(2, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -HDNodePathType = t + +class HDNodePathType(p.MessageType): + FIELDS = { + 1: ('node', HDNodeType, 0), # required + 2: ('address_n', p.UVarintType, p.FLAG_REPEATED), + } diff --git a/src/trezor/messages/HDNodeType.py b/src/trezor/messages/HDNodeType.py index 7e3ed0480..64e014756 100644 --- a/src/trezor/messages/HDNodeType.py +++ b/src/trezor/messages/HDNodeType.py @@ -1,11 +1,13 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('HDNodeType') -t.add_field(1, 'depth', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(2, 'fingerprint', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(3, 'child_num', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(4, 'chain_code', p.BytesType, flags=p.FLAG_REQUIRED) -t.add_field(5, 'private_key', p.BytesType) -t.add_field(6, 'public_key', p.BytesType) -HDNodeType = t + +class HDNodeType(p.MessageType): + FIELDS = { + 1: ('depth', p.UVarintType, 0), # required + 2: ('fingerprint', p.UVarintType, 0), # required + 3: ('child_num', p.UVarintType, 0), # required + 4: ('chain_code', p.BytesType, 0), # required + 5: ('private_key', p.BytesType, 0), + 6: ('public_key', p.BytesType, 0), + } diff --git a/src/trezor/messages/IdentityType.py b/src/trezor/messages/IdentityType.py index 5c3a2367e..a9b398e26 100644 --- a/src/trezor/messages/IdentityType.py +++ b/src/trezor/messages/IdentityType.py @@ -1,11 +1,13 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('IdentityType') -t.add_field(1, 'proto', p.UnicodeType) -t.add_field(2, 'user', p.UnicodeType) -t.add_field(3, 'host', p.UnicodeType) -t.add_field(4, 'port', p.UnicodeType) -t.add_field(5, 'path', p.UnicodeType) -t.add_field(6, 'index', p.UVarintType, default=0) -IdentityType = t + +class IdentityType(p.MessageType): + FIELDS = { + 1: ('proto', p.UnicodeType, 0), + 2: ('user', p.UnicodeType, 0), + 3: ('host', p.UnicodeType, 0), + 4: ('port', p.UnicodeType, 0), + 5: ('path', p.UnicodeType, 0), + 6: ('index', p.UVarintType, 0), # default=0 + } diff --git a/src/trezor/messages/Initialize.py b/src/trezor/messages/Initialize.py index c8de835d0..6929682dc 100644 --- a/src/trezor/messages/Initialize.py +++ b/src/trezor/messages/Initialize.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('Initialize') -t.wire_type = const(0) -Initialize = t + +class Initialize(p.MessageType): + MESSAGE_WIRE_TYPE = 0 diff --git a/src/trezor/messages/LoadDevice.py b/src/trezor/messages/LoadDevice.py index f688d36d9..8be661ee0 100644 --- a/src/trezor/messages/LoadDevice.py +++ b/src/trezor/messages/LoadDevice.py @@ -2,13 +2,15 @@ import protobuf as p from micropython import const from .HDNodeType import HDNodeType -t = p.MessageType('LoadDevice') -t.wire_type = const(13) -t.add_field(1, 'mnemonic', p.UnicodeType) -t.add_field(2, 'node', p.EmbeddedMessage(HDNodeType)) -t.add_field(3, 'pin', p.UnicodeType) -t.add_field(4, 'passphrase_protection', p.BoolType) -t.add_field(5, 'language', p.UnicodeType, default=u'english') -t.add_field(6, 'label', p.UnicodeType) -t.add_field(7, 'skip_checksum', p.BoolType) -LoadDevice = t + +class LoadDevice(p.MessageType): + FIELDS = { + 1: ('mnemonic', p.UnicodeType, 0), + 2: ('node', HDNodeType, 0), + 3: ('pin', p.UnicodeType, 0), + 4: ('passphrase_protection', p.BoolType, 0), + 5: ('language', p.UnicodeType, 0), # default=u'english' + 6: ('label', p.UnicodeType, 0), + 7: ('skip_checksum', p.BoolType, 0), + } + MESSAGE_WIRE_TYPE = 13 diff --git a/src/trezor/messages/MessageSignature.py b/src/trezor/messages/MessageSignature.py index 8de49fc5d..86da93832 100644 --- a/src/trezor/messages/MessageSignature.py +++ b/src/trezor/messages/MessageSignature.py @@ -1,8 +1,10 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('MessageSignature') -t.wire_type = const(40) -t.add_field(1, 'address', p.UnicodeType) -t.add_field(2, 'signature', p.BytesType) -MessageSignature = t + +class MessageSignature(p.MessageType): + FIELDS = { + 1: ('address', p.UnicodeType, 0), + 2: ('signature', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 40 diff --git a/src/trezor/messages/MultisigRedeemScriptType.py b/src/trezor/messages/MultisigRedeemScriptType.py index d7e290f89..e3fad435e 100644 --- a/src/trezor/messages/MultisigRedeemScriptType.py +++ b/src/trezor/messages/MultisigRedeemScriptType.py @@ -2,8 +2,10 @@ import protobuf as p from micropython import const from .HDNodePathType import HDNodePathType -t = p.MessageType('MultisigRedeemScriptType') -t.add_field(1, 'pubkeys', p.EmbeddedMessage(HDNodePathType), flags=p.FLAG_REPEATED) -t.add_field(2, 'signatures', p.BytesType, flags=p.FLAG_REPEATED) -t.add_field(3, 'm', p.UVarintType) -MultisigRedeemScriptType = t + +class MultisigRedeemScriptType(p.MessageType): + FIELDS = { + 1: ('pubkeys', HDNodePathType, p.FLAG_REPEATED), + 2: ('signatures', p.BytesType, p.FLAG_REPEATED), + 3: ('m', p.UVarintType, 0), + } diff --git a/src/trezor/messages/PassphraseAck.py b/src/trezor/messages/PassphraseAck.py index 55a157244..3f39ab574 100644 --- a/src/trezor/messages/PassphraseAck.py +++ b/src/trezor/messages/PassphraseAck.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('PassphraseAck') -t.wire_type = const(42) -t.add_field(1, 'passphrase', p.UnicodeType, flags=p.FLAG_REQUIRED) -PassphraseAck = t + +class PassphraseAck(p.MessageType): + FIELDS = { + 1: ('passphrase', p.UnicodeType, 0), # required + } + MESSAGE_WIRE_TYPE = 42 diff --git a/src/trezor/messages/PassphraseRequest.py b/src/trezor/messages/PassphraseRequest.py index ea368e519..bfbb13b6f 100644 --- a/src/trezor/messages/PassphraseRequest.py +++ b/src/trezor/messages/PassphraseRequest.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('PassphraseRequest') -t.wire_type = const(41) -PassphraseRequest = t + +class PassphraseRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 41 diff --git a/src/trezor/messages/PinMatrixAck.py b/src/trezor/messages/PinMatrixAck.py index a17981aeb..2a7961111 100644 --- a/src/trezor/messages/PinMatrixAck.py +++ b/src/trezor/messages/PinMatrixAck.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('PinMatrixAck') -t.wire_type = const(19) -t.add_field(1, 'pin', p.UnicodeType, flags=p.FLAG_REQUIRED) -PinMatrixAck = t + +class PinMatrixAck(p.MessageType): + FIELDS = { + 1: ('pin', p.UnicodeType, 0), # required + } + MESSAGE_WIRE_TYPE = 19 diff --git a/src/trezor/messages/PinMatrixRequest.py b/src/trezor/messages/PinMatrixRequest.py index 29b599696..7b87504c9 100644 --- a/src/trezor/messages/PinMatrixRequest.py +++ b/src/trezor/messages/PinMatrixRequest.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('PinMatrixRequest') -t.wire_type = const(18) -t.add_field(1, 'type', p.UVarintType) -PinMatrixRequest = t + +class PinMatrixRequest(p.MessageType): + FIELDS = { + 1: ('type', p.UVarintType, 0), + } + MESSAGE_WIRE_TYPE = 18 diff --git a/src/trezor/messages/Ping.py b/src/trezor/messages/Ping.py index d17f2fc69..26c2fd8ea 100644 --- a/src/trezor/messages/Ping.py +++ b/src/trezor/messages/Ping.py @@ -1,10 +1,12 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('Ping') -t.wire_type = const(1) -t.add_field(1, 'message', p.UnicodeType) -t.add_field(2, 'button_protection', p.BoolType) -t.add_field(3, 'pin_protection', p.BoolType) -t.add_field(4, 'passphrase_protection', p.BoolType) -Ping = t + +class Ping(p.MessageType): + 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 diff --git a/src/trezor/messages/PublicKey.py b/src/trezor/messages/PublicKey.py index d0ad4eb09..448463eca 100644 --- a/src/trezor/messages/PublicKey.py +++ b/src/trezor/messages/PublicKey.py @@ -2,8 +2,10 @@ import protobuf as p from micropython import const from .HDNodeType import HDNodeType -t = p.MessageType('PublicKey') -t.wire_type = const(12) -t.add_field(1, 'node', p.EmbeddedMessage(HDNodeType), flags=p.FLAG_REQUIRED) -t.add_field(2, 'xpub', p.UnicodeType) -PublicKey = t + +class PublicKey(p.MessageType): + FIELDS = { + 1: ('node', HDNodeType, 0), # required + 2: ('xpub', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 12 diff --git a/src/trezor/messages/RecoveryDevice.py b/src/trezor/messages/RecoveryDevice.py index cb7b08361..a46e64531 100644 --- a/src/trezor/messages/RecoveryDevice.py +++ b/src/trezor/messages/RecoveryDevice.py @@ -1,12 +1,14 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('RecoveryDevice') -t.wire_type = const(45) -t.add_field(1, 'word_count', p.UVarintType) -t.add_field(2, 'passphrase_protection', p.BoolType) -t.add_field(3, 'pin_protection', p.BoolType) -t.add_field(4, 'language', p.UnicodeType, default=u'english') -t.add_field(5, 'label', p.UnicodeType) -t.add_field(6, 'enforce_wordlist', p.BoolType) -RecoveryDevice = t + +class RecoveryDevice(p.MessageType): + FIELDS = { + 1: ('word_count', p.UVarintType, 0), + 2: ('passphrase_protection', p.BoolType, 0), + 3: ('pin_protection', p.BoolType, 0), + 4: ('language', p.UnicodeType, 0), # default=u'english' + 5: ('label', p.UnicodeType, 0), + 6: ('enforce_wordlist', p.BoolType, 0), + } + MESSAGE_WIRE_TYPE = 45 diff --git a/src/trezor/messages/ResetDevice.py b/src/trezor/messages/ResetDevice.py index 1c9f1047c..73935487b 100644 --- a/src/trezor/messages/ResetDevice.py +++ b/src/trezor/messages/ResetDevice.py @@ -1,12 +1,14 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('ResetDevice') -t.wire_type = const(14) -t.add_field(1, 'display_random', p.BoolType) -t.add_field(2, 'strength', p.UVarintType, default=256) -t.add_field(3, 'passphrase_protection', p.BoolType) -t.add_field(4, 'pin_protection', p.BoolType) -t.add_field(5, 'language', p.UnicodeType, default=u'english') -t.add_field(6, 'label', p.UnicodeType) -ResetDevice = t + +class ResetDevice(p.MessageType): + FIELDS = { + 1: ('display_random', p.BoolType, 0), + 2: ('strength', p.UVarintType, 0), # default=256 + 3: ('passphrase_protection', p.BoolType, 0), + 4: ('pin_protection', p.BoolType, 0), + 5: ('language', p.UnicodeType, 0), # default=u'english' + 6: ('label', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 14 diff --git a/src/trezor/messages/SetU2FCounter.py b/src/trezor/messages/SetU2FCounter.py index 16dd27b05..993acb14b 100644 --- a/src/trezor/messages/SetU2FCounter.py +++ b/src/trezor/messages/SetU2FCounter.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('SetU2FCounter') -t.wire_type = const(63) -t.add_field(1, 'u2f_counter', p.UVarintType) -SetU2FCounter = t + +class SetU2FCounter(p.MessageType): + FIELDS = { + 1: ('u2f_counter', p.UVarintType, 0), + } + MESSAGE_WIRE_TYPE = 63 diff --git a/src/trezor/messages/SignIdentity.py b/src/trezor/messages/SignIdentity.py index 18f60074f..16a73adf2 100644 --- a/src/trezor/messages/SignIdentity.py +++ b/src/trezor/messages/SignIdentity.py @@ -2,10 +2,12 @@ import protobuf as p from micropython import const from .IdentityType import IdentityType -t = p.MessageType('SignIdentity') -t.wire_type = const(53) -t.add_field(1, 'identity', p.EmbeddedMessage(IdentityType)) -t.add_field(2, 'challenge_hidden', p.BytesType) -t.add_field(3, 'challenge_visual', p.UnicodeType) -t.add_field(4, 'ecdsa_curve_name', p.UnicodeType) -SignIdentity = t + +class SignIdentity(p.MessageType): + 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 diff --git a/src/trezor/messages/SignMessage.py b/src/trezor/messages/SignMessage.py index 22f8455e1..b2db7357f 100644 --- a/src/trezor/messages/SignMessage.py +++ b/src/trezor/messages/SignMessage.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('SignMessage') -t.wire_type = const(38) -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'message', p.BytesType, flags=p.FLAG_REQUIRED) -t.add_field(3, 'coin_name', p.UnicodeType, default=u'Bitcoin') -SignMessage = t + +class SignMessage(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('message', p.BytesType, 0), # required + 3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin' + } + MESSAGE_WIRE_TYPE = 38 diff --git a/src/trezor/messages/SignTx.py b/src/trezor/messages/SignTx.py index d7d8617b3..2b6c7a339 100644 --- a/src/trezor/messages/SignTx.py +++ b/src/trezor/messages/SignTx.py @@ -1,11 +1,13 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('SignTx') -t.wire_type = const(15) -t.add_field(1, 'outputs_count', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(2, 'inputs_count', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(3, 'coin_name', p.UnicodeType, default=u'Bitcoin') -t.add_field(4, 'version', p.UVarintType, default=1) -t.add_field(5, 'lock_time', p.UVarintType, default=0) -SignTx = t + +class SignTx(p.MessageType): + FIELDS = { + 1: ('outputs_count', p.UVarintType, 0), # required + 2: ('inputs_count', p.UVarintType, 0), # required + 3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin' + 4: ('version', p.UVarintType, 0), # default=1 + 5: ('lock_time', p.UVarintType, 0), # default=0 + } + MESSAGE_WIRE_TYPE = 15 diff --git a/src/trezor/messages/SignedIdentity.py b/src/trezor/messages/SignedIdentity.py index bb751f33d..d5806a1b5 100644 --- a/src/trezor/messages/SignedIdentity.py +++ b/src/trezor/messages/SignedIdentity.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('SignedIdentity') -t.wire_type = const(54) -t.add_field(1, 'address', p.UnicodeType) -t.add_field(2, 'public_key', p.BytesType) -t.add_field(3, 'signature', p.BytesType) -SignedIdentity = t + +class SignedIdentity(p.MessageType): + FIELDS = { + 1: ('address', p.UnicodeType, 0), + 2: ('public_key', p.BytesType, 0), + 3: ('signature', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 54 diff --git a/src/trezor/messages/SimpleSignTx.py b/src/trezor/messages/SimpleSignTx.py index fe595f1fc..65caf70c5 100644 --- a/src/trezor/messages/SimpleSignTx.py +++ b/src/trezor/messages/SimpleSignTx.py @@ -4,12 +4,14 @@ from micropython import const from .TxInputType import TxInputType from .TxOutputType import TxOutputType from .TransactionType import TransactionType -t = p.MessageType('SimpleSignTx') -t.wire_type = const(16) -t.add_field(1, 'inputs', p.EmbeddedMessage(TxInputType), flags=p.FLAG_REPEATED) -t.add_field(2, 'outputs', p.EmbeddedMessage(TxOutputType), flags=p.FLAG_REPEATED) -t.add_field(3, 'transactions', p.EmbeddedMessage(TransactionType), flags=p.FLAG_REPEATED) -t.add_field(4, 'coin_name', p.UnicodeType, default=u'Bitcoin') -t.add_field(5, 'version', p.UVarintType, default=1) -t.add_field(6, 'lock_time', p.UVarintType, default=0) -SimpleSignTx = t + +class SimpleSignTx(p.MessageType): + FIELDS = { + 1: ('inputs', TxInputType, p.FLAG_REPEATED), + 2: ('outputs', TxOutputType, p.FLAG_REPEATED), + 3: ('transactions', TransactionType, p.FLAG_REPEATED), + 4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin' + 5: ('version', p.UVarintType, 0), # default=1 + 6: ('lock_time', p.UVarintType, 0), # default=0 + } + MESSAGE_WIRE_TYPE = 16 diff --git a/src/trezor/messages/Storage.py b/src/trezor/messages/Storage.py index ec5d2dd97..a577b57f8 100644 --- a/src/trezor/messages/Storage.py +++ b/src/trezor/messages/Storage.py @@ -2,16 +2,18 @@ import protobuf as p from micropython import const from .HDNodeType import HDNodeType -t = p.MessageType('Storage') -t.add_field(1, 'version', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(2, 'node', p.EmbeddedMessage(HDNodeType)) -t.add_field(3, 'mnemonic', p.UnicodeType) -t.add_field(4, 'passphrase_protection', p.BoolType) -t.add_field(5, 'pin_failed_attempts', p.UVarintType) -t.add_field(6, 'pin', p.UnicodeType) -t.add_field(7, 'language', p.UnicodeType) -t.add_field(8, 'label', p.UnicodeType) -t.add_field(9, 'imported', p.BoolType) -t.add_field(10, 'homescreen', p.BytesType) -t.add_field(11, 'u2f_counter', p.UVarintType) -Storage = t + +class Storage(p.MessageType): + FIELDS = { + 1: ('version', p.UVarintType, 0), # required + 2: ('node', HDNodeType, 0), + 3: ('mnemonic', p.UnicodeType, 0), + 4: ('passphrase_protection', p.BoolType, 0), + 5: ('pin_failed_attempts', p.UVarintType, 0), + 6: ('pin', p.UnicodeType, 0), + 7: ('language', p.UnicodeType, 0), + 8: ('label', p.UnicodeType, 0), + 9: ('imported', p.BoolType, 0), + 10: ('homescreen', p.BytesType, 0), + 11: ('u2f_counter', p.UVarintType, 0), + } diff --git a/src/trezor/messages/Success.py b/src/trezor/messages/Success.py index ba55a5c7f..c39d80ad2 100644 --- a/src/trezor/messages/Success.py +++ b/src/trezor/messages/Success.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('Success') -t.wire_type = const(2) -t.add_field(1, 'message', p.UnicodeType) -Success = t + +class Success(p.MessageType): + FIELDS = { + 1: ('message', p.UnicodeType, 0), + } + MESSAGE_WIRE_TYPE = 2 diff --git a/src/trezor/messages/TransactionType.py b/src/trezor/messages/TransactionType.py index 180c1893d..2ae18c7ed 100644 --- a/src/trezor/messages/TransactionType.py +++ b/src/trezor/messages/TransactionType.py @@ -4,14 +4,16 @@ from micropython import const from .TxInputType import TxInputType from .TxOutputBinType import TxOutputBinType from .TxOutputType import TxOutputType -t = p.MessageType('TransactionType') -t.add_field(1, 'version', p.UVarintType) -t.add_field(2, 'inputs', p.EmbeddedMessage(TxInputType), flags=p.FLAG_REPEATED) -t.add_field(3, 'bin_outputs', p.EmbeddedMessage(TxOutputBinType), flags=p.FLAG_REPEATED) -t.add_field(4, 'lock_time', p.UVarintType) -t.add_field(5, 'outputs', p.EmbeddedMessage(TxOutputType), flags=p.FLAG_REPEATED) -t.add_field(6, 'inputs_cnt', p.UVarintType) -t.add_field(7, 'outputs_cnt', p.UVarintType) -t.add_field(8, 'extra_data', p.BytesType) -t.add_field(9, 'extra_data_len', p.UVarintType) -TransactionType = t + +class TransactionType(p.MessageType): + FIELDS = { + 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), + 6: ('inputs_cnt', p.UVarintType, 0), + 7: ('outputs_cnt', p.UVarintType, 0), + 8: ('extra_data', p.BytesType, 0), + 9: ('extra_data_len', p.UVarintType, 0), + } diff --git a/src/trezor/messages/TxAck.py b/src/trezor/messages/TxAck.py index bf7a32dcb..83d418a26 100644 --- a/src/trezor/messages/TxAck.py +++ b/src/trezor/messages/TxAck.py @@ -2,7 +2,9 @@ import protobuf as p from micropython import const from .TransactionType import TransactionType -t = p.MessageType('TxAck') -t.wire_type = const(22) -t.add_field(1, 'tx', p.EmbeddedMessage(TransactionType)) -TxAck = t + +class TxAck(p.MessageType): + FIELDS = { + 1: ('tx', TransactionType, 0), + } + MESSAGE_WIRE_TYPE = 22 diff --git a/src/trezor/messages/TxInputType.py b/src/trezor/messages/TxInputType.py index 6917b9f2f..4038ef67d 100644 --- a/src/trezor/messages/TxInputType.py +++ b/src/trezor/messages/TxInputType.py @@ -2,13 +2,15 @@ import protobuf as p from micropython import const from .MultisigRedeemScriptType import MultisigRedeemScriptType -t = p.MessageType('TxInputType') -t.add_field(1, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(2, 'prev_hash', p.BytesType, flags=p.FLAG_REQUIRED) -t.add_field(3, 'prev_index', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(4, 'script_sig', p.BytesType) -t.add_field(5, 'sequence', p.UVarintType, default=4294967295) -t.add_field(6, 'script_type', p.UVarintType, default=0) -t.add_field(7, 'multisig', p.EmbeddedMessage(MultisigRedeemScriptType)) -t.add_field(8, 'amount', p.UVarintType) -TxInputType = t + +class TxInputType(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('prev_hash', p.BytesType, 0), # required + 3: ('prev_index', p.UVarintType, 0), # required + 4: ('script_sig', p.BytesType, 0), + 5: ('sequence', p.UVarintType, 0), # default=4294967295 + 6: ('script_type', p.UVarintType, 0), # default=0 + 7: ('multisig', MultisigRedeemScriptType, 0), + 8: ('amount', p.UVarintType, 0), + } diff --git a/src/trezor/messages/TxOutputBinType.py b/src/trezor/messages/TxOutputBinType.py index 0ba47897c..3f7830ecf 100644 --- a/src/trezor/messages/TxOutputBinType.py +++ b/src/trezor/messages/TxOutputBinType.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('TxOutputBinType') -t.add_field(1, 'amount', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(2, 'script_pubkey', p.BytesType, flags=p.FLAG_REQUIRED) -TxOutputBinType = t + +class TxOutputBinType(p.MessageType): + FIELDS = { + 1: ('amount', p.UVarintType, 0), # required + 2: ('script_pubkey', p.BytesType, 0), # required + } diff --git a/src/trezor/messages/TxOutputType.py b/src/trezor/messages/TxOutputType.py index d26faa2a1..05394fdb6 100644 --- a/src/trezor/messages/TxOutputType.py +++ b/src/trezor/messages/TxOutputType.py @@ -2,11 +2,13 @@ import protobuf as p from micropython import const from .MultisigRedeemScriptType import MultisigRedeemScriptType -t = p.MessageType('TxOutputType') -t.add_field(1, 'address', p.UnicodeType) -t.add_field(2, 'address_n', p.UVarintType, flags=p.FLAG_REPEATED) -t.add_field(3, 'amount', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(4, 'script_type', p.UVarintType, flags=p.FLAG_REQUIRED) -t.add_field(5, 'multisig', p.EmbeddedMessage(MultisigRedeemScriptType)) -t.add_field(6, 'op_return_data', p.BytesType) -TxOutputType = t + +class TxOutputType(p.MessageType): + FIELDS = { + 1: ('address', p.UnicodeType, 0), + 2: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 3: ('amount', p.UVarintType, 0), # required + 4: ('script_type', p.UVarintType, 0), # required + 5: ('multisig', MultisigRedeemScriptType, 0), + 6: ('op_return_data', p.BytesType, 0), + } diff --git a/src/trezor/messages/TxRequest.py b/src/trezor/messages/TxRequest.py index 5eb4730fe..60e202409 100644 --- a/src/trezor/messages/TxRequest.py +++ b/src/trezor/messages/TxRequest.py @@ -3,9 +3,11 @@ import protobuf as p from micropython import const from .TxRequestDetailsType import TxRequestDetailsType from .TxRequestSerializedType import TxRequestSerializedType -t = p.MessageType('TxRequest') -t.wire_type = const(21) -t.add_field(1, 'request_type', p.UVarintType) -t.add_field(2, 'details', p.EmbeddedMessage(TxRequestDetailsType)) -t.add_field(3, 'serialized', p.EmbeddedMessage(TxRequestSerializedType)) -TxRequest = t + +class TxRequest(p.MessageType): + FIELDS = { + 1: ('request_type', p.UVarintType, 0), + 2: ('details', TxRequestDetailsType, 0), + 3: ('serialized', TxRequestSerializedType, 0), + } + MESSAGE_WIRE_TYPE = 21 diff --git a/src/trezor/messages/TxRequestDetailsType.py b/src/trezor/messages/TxRequestDetailsType.py index e0cd05362..7aad5880c 100644 --- a/src/trezor/messages/TxRequestDetailsType.py +++ b/src/trezor/messages/TxRequestDetailsType.py @@ -1,9 +1,11 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('TxRequestDetailsType') -t.add_field(1, 'request_index', p.UVarintType) -t.add_field(2, 'tx_hash', p.BytesType) -t.add_field(3, 'extra_data_len', p.UVarintType) -t.add_field(4, 'extra_data_offset', p.UVarintType) -TxRequestDetailsType = t + +class TxRequestDetailsType(p.MessageType): + FIELDS = { + 1: ('request_index', p.UVarintType, 0), + 2: ('tx_hash', p.BytesType, 0), + 3: ('extra_data_len', p.UVarintType, 0), + 4: ('extra_data_offset', p.UVarintType, 0), + } diff --git a/src/trezor/messages/TxRequestSerializedType.py b/src/trezor/messages/TxRequestSerializedType.py index 12efbebe9..5a700438e 100644 --- a/src/trezor/messages/TxRequestSerializedType.py +++ b/src/trezor/messages/TxRequestSerializedType.py @@ -1,8 +1,10 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('TxRequestSerializedType') -t.add_field(1, 'signature_index', p.UVarintType) -t.add_field(2, 'signature', p.BytesType) -t.add_field(3, 'serialized_tx', p.BytesType) -TxRequestSerializedType = t + +class TxRequestSerializedType(p.MessageType): + FIELDS = { + 1: ('signature_index', p.UVarintType, 0), + 2: ('signature', p.BytesType, 0), + 3: ('serialized_tx', p.BytesType, 0), + } diff --git a/src/trezor/messages/TxSize.py b/src/trezor/messages/TxSize.py index 888814294..de9583e37 100644 --- a/src/trezor/messages/TxSize.py +++ b/src/trezor/messages/TxSize.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('TxSize') -t.wire_type = const(44) -t.add_field(1, 'tx_size', p.UVarintType) -TxSize = t + +class TxSize(p.MessageType): + FIELDS = { + 1: ('tx_size', p.UVarintType, 0), + } + MESSAGE_WIRE_TYPE = 44 diff --git a/src/trezor/messages/VerifyMessage.py b/src/trezor/messages/VerifyMessage.py index d62558970..90e3e6404 100644 --- a/src/trezor/messages/VerifyMessage.py +++ b/src/trezor/messages/VerifyMessage.py @@ -1,10 +1,12 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('VerifyMessage') -t.wire_type = const(39) -t.add_field(1, 'address', p.UnicodeType) -t.add_field(2, 'signature', p.BytesType) -t.add_field(3, 'message', p.BytesType) -t.add_field(4, 'coin_name', p.UnicodeType, default=u'Bitcoin') -VerifyMessage = t + +class VerifyMessage(p.MessageType): + FIELDS = { + 1: ('address', p.UnicodeType, 0), + 2: ('signature', p.BytesType, 0), + 3: ('message', p.BytesType, 0), + 4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin' + } + MESSAGE_WIRE_TYPE = 39 diff --git a/src/trezor/messages/WipeDevice.py b/src/trezor/messages/WipeDevice.py index 22535f4b1..36f197460 100644 --- a/src/trezor/messages/WipeDevice.py +++ b/src/trezor/messages/WipeDevice.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('WipeDevice') -t.wire_type = const(5) -WipeDevice = t + +class WipeDevice(p.MessageType): + MESSAGE_WIRE_TYPE = 5 diff --git a/src/trezor/messages/WordAck.py b/src/trezor/messages/WordAck.py index 377b67bbc..cf9ab65a2 100644 --- a/src/trezor/messages/WordAck.py +++ b/src/trezor/messages/WordAck.py @@ -1,7 +1,9 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('WordAck') -t.wire_type = const(47) -t.add_field(1, 'word', p.UnicodeType, flags=p.FLAG_REQUIRED) -WordAck = t + +class WordAck(p.MessageType): + FIELDS = { + 1: ('word', p.UnicodeType, 0), # required + } + MESSAGE_WIRE_TYPE = 47 diff --git a/src/trezor/messages/WordRequest.py b/src/trezor/messages/WordRequest.py index 852f7494a..8ca75a7e2 100644 --- a/src/trezor/messages/WordRequest.py +++ b/src/trezor/messages/WordRequest.py @@ -1,6 +1,6 @@ # Automatically generated by pb2py import protobuf as p from micropython import const -t = p.MessageType('WordRequest') -t.wire_type = const(46) -WordRequest = t + +class WordRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 46