mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-03 16:56:07 +00:00
protobuf: update build_protobuf and pb2py from python-trezor, regenerate messages
This commit is contained in:
parent
af93c7299d
commit
a31c118d8e
10
src/trezor/messages/CosiCommit.py
Normal file
10
src/trezor/messages/CosiCommit.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class CosiCommit(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
2: ('data', p.BytesType, 0),
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 71
|
10
src/trezor/messages/CosiCommitment.py
Normal file
10
src/trezor/messages/CosiCommitment.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class CosiCommitment(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('commitment', p.BytesType, 0),
|
||||||
|
2: ('pubkey', p.BytesType, 0),
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 72
|
12
src/trezor/messages/CosiSign.py
Normal file
12
src/trezor/messages/CosiSign.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class CosiSign(p.MessageType):
|
||||||
|
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
|
9
src/trezor/messages/CosiSignature.py
Normal file
9
src/trezor/messages/CosiSignature.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class CosiSignature(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('signature', p.BytesType, 0),
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 74
|
@ -65,6 +65,16 @@ SetU2FCounter = const(63)
|
|||||||
EthereumSignMessage = const(64)
|
EthereumSignMessage = const(64)
|
||||||
EthereumVerifyMessage = const(65)
|
EthereumVerifyMessage = const(65)
|
||||||
EthereumMessageSignature = const(66)
|
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)
|
DebugLinkDecision = const(100)
|
||||||
DebugLinkGetState = const(101)
|
DebugLinkGetState = const(101)
|
||||||
DebugLinkState = const(102)
|
DebugLinkState = const(102)
|
||||||
|
9
src/trezor/messages/NEMAddress.py
Normal file
9
src/trezor/messages/NEMAddress.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMAddress(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('address', p.UnicodeType, 0), # required
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 68
|
10
src/trezor/messages/NEMAggregateModification.py
Normal file
10
src/trezor/messages/NEMAggregateModification.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
from .NEMCosignatoryModification import NEMCosignatoryModification
|
||||||
|
|
||||||
|
|
||||||
|
class NEMAggregateModification(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('modifications', NEMCosignatoryModification, p.FLAG_REPEATED),
|
||||||
|
2: ('relative_change', p.Sint32Type, 0),
|
||||||
|
}
|
9
src/trezor/messages/NEMCosignatoryModification.py
Normal file
9
src/trezor/messages/NEMCosignatoryModification.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMCosignatoryModification(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('type', p.UVarintType, 0),
|
||||||
|
2: ('public_key', p.BytesType, 0),
|
||||||
|
}
|
12
src/trezor/messages/NEMDecryptMessage.py
Normal file
12
src/trezor/messages/NEMDecryptMessage.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMDecryptMessage(p.MessageType):
|
||||||
|
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
|
9
src/trezor/messages/NEMDecryptedMessage.py
Normal file
9
src/trezor/messages/NEMDecryptedMessage.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMDecryptedMessage(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('payload', p.BytesType, 0),
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 76
|
11
src/trezor/messages/NEMGetAddress.py
Normal file
11
src/trezor/messages/NEMGetAddress.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMGetAddress(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
2: ('network', p.UVarintType, 0),
|
||||||
|
3: ('show_display', p.BoolType, 0),
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 67
|
9
src/trezor/messages/NEMImportanceTransfer.py
Normal file
9
src/trezor/messages/NEMImportanceTransfer.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMImportanceTransfer(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('mode', p.UVarintType, 0),
|
||||||
|
2: ('public_key', p.BytesType, 0),
|
||||||
|
}
|
5
src/trezor/messages/NEMImportanceTransferMode.py
Normal file
5
src/trezor/messages/NEMImportanceTransferMode.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
from micropython import const
|
||||||
|
|
||||||
|
ImportanceTransfer_Activate = const(1)
|
||||||
|
ImportanceTransfer_Deactivate = const(2)
|
5
src/trezor/messages/NEMModificationType.py
Normal file
5
src/trezor/messages/NEMModificationType.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
from micropython import const
|
||||||
|
|
||||||
|
CosignatoryModification_Add = const(1)
|
||||||
|
CosignatoryModification_Delete = const(2)
|
10
src/trezor/messages/NEMMosaic.py
Normal file
10
src/trezor/messages/NEMMosaic.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMMosaic(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('namespace', p.UnicodeType, 0),
|
||||||
|
2: ('mosaic', p.UnicodeType, 0),
|
||||||
|
3: ('quantity', p.UVarintType, 0),
|
||||||
|
}
|
11
src/trezor/messages/NEMMosaicCreation.py
Normal file
11
src/trezor/messages/NEMMosaicCreation.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
from .NEMMosaicDefinition import NEMMosaicDefinition
|
||||||
|
|
||||||
|
|
||||||
|
class NEMMosaicCreation(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('definition', NEMMosaicDefinition, 0),
|
||||||
|
2: ('sink', p.UnicodeType, 0),
|
||||||
|
3: ('fee', p.UVarintType, 0),
|
||||||
|
}
|
22
src/trezor/messages/NEMMosaicDefinition.py
Normal file
22
src/trezor/messages/NEMMosaicDefinition.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMMosaicDefinition(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('name', p.UnicodeType, 0),
|
||||||
|
2: ('ticker', p.UnicodeType, 0),
|
||||||
|
3: ('namespace', p.UnicodeType, 0),
|
||||||
|
4: ('mosaic', p.UnicodeType, 0),
|
||||||
|
5: ('divisibility', p.UVarintType, 0),
|
||||||
|
6: ('levy', p.UVarintType, 0),
|
||||||
|
7: ('fee', p.UVarintType, 0),
|
||||||
|
8: ('levy_address', p.UnicodeType, 0),
|
||||||
|
9: ('levy_namespace', p.UnicodeType, 0),
|
||||||
|
10: ('levy_mosaic', p.UnicodeType, 0),
|
||||||
|
11: ('supply', p.UVarintType, 0),
|
||||||
|
12: ('mutable_supply', p.BoolType, 0),
|
||||||
|
13: ('transferable', p.BoolType, 0),
|
||||||
|
14: ('description', p.UnicodeType, 0),
|
||||||
|
15: ('networks', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
}
|
5
src/trezor/messages/NEMMosaicLevy.py
Normal file
5
src/trezor/messages/NEMMosaicLevy.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
from micropython import const
|
||||||
|
|
||||||
|
MosaicLevy_Absolute = const(1)
|
||||||
|
MosaicLevy_Percentile = const(2)
|
11
src/trezor/messages/NEMMosaicSupplyChange.py
Normal file
11
src/trezor/messages/NEMMosaicSupplyChange.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMMosaicSupplyChange(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('namespace', p.UnicodeType, 0),
|
||||||
|
2: ('mosaic', p.UnicodeType, 0),
|
||||||
|
3: ('type', p.UVarintType, 0),
|
||||||
|
4: ('delta', p.UVarintType, 0),
|
||||||
|
}
|
11
src/trezor/messages/NEMProvisionNamespace.py
Normal file
11
src/trezor/messages/NEMProvisionNamespace.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMProvisionNamespace(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('namespace', p.UnicodeType, 0),
|
||||||
|
2: ('parent', p.UnicodeType, 0),
|
||||||
|
3: ('sink', p.UnicodeType, 0),
|
||||||
|
4: ('fee', p.UVarintType, 0),
|
||||||
|
}
|
24
src/trezor/messages/NEMSignTx.py
Normal file
24
src/trezor/messages/NEMSignTx.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
from .NEMAggregateModification import NEMAggregateModification
|
||||||
|
from .NEMImportanceTransfer import NEMImportanceTransfer
|
||||||
|
from .NEMMosaicCreation import NEMMosaicCreation
|
||||||
|
from .NEMMosaicSupplyChange import NEMMosaicSupplyChange
|
||||||
|
from .NEMProvisionNamespace import NEMProvisionNamespace
|
||||||
|
from .NEMTransactionCommon import NEMTransactionCommon
|
||||||
|
from .NEMTransfer import NEMTransfer
|
||||||
|
|
||||||
|
|
||||||
|
class NEMSignTx(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('transaction', NEMTransactionCommon, 0),
|
||||||
|
2: ('multisig', NEMTransactionCommon, 0),
|
||||||
|
3: ('transfer', NEMTransfer, 0),
|
||||||
|
4: ('cosigning', p.BoolType, 0),
|
||||||
|
5: ('provision_namespace', NEMProvisionNamespace, 0),
|
||||||
|
6: ('mosaic_creation', NEMMosaicCreation, 0),
|
||||||
|
7: ('supply_change', NEMMosaicSupplyChange, 0),
|
||||||
|
8: ('aggregate_modification', NEMAggregateModification, 0),
|
||||||
|
9: ('importance_transfer', NEMImportanceTransfer, 0),
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 69
|
10
src/trezor/messages/NEMSignedTx.py
Normal file
10
src/trezor/messages/NEMSignedTx.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMSignedTx(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('data', p.BytesType, 0),
|
||||||
|
2: ('signature', p.BytesType, 0),
|
||||||
|
}
|
||||||
|
MESSAGE_WIRE_TYPE = 70
|
5
src/trezor/messages/NEMSupplyChangeType.py
Normal file
5
src/trezor/messages/NEMSupplyChangeType.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
from micropython import const
|
||||||
|
|
||||||
|
SupplyChange_Increase = const(1)
|
||||||
|
SupplyChange_Decrease = const(2)
|
13
src/trezor/messages/NEMTransactionCommon.py
Normal file
13
src/trezor/messages/NEMTransactionCommon.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
|
class NEMTransactionCommon(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
2: ('network', p.UVarintType, 0),
|
||||||
|
3: ('timestamp', p.UVarintType, 0),
|
||||||
|
4: ('fee', p.UVarintType, 0),
|
||||||
|
5: ('deadline', p.UVarintType, 0),
|
||||||
|
6: ('signer', p.BytesType, 0),
|
||||||
|
}
|
13
src/trezor/messages/NEMTransfer.py
Normal file
13
src/trezor/messages/NEMTransfer.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Automatically generated by pb2py
|
||||||
|
import protobuf as p
|
||||||
|
from .NEMMosaic import NEMMosaic
|
||||||
|
|
||||||
|
|
||||||
|
class NEMTransfer(p.MessageType):
|
||||||
|
FIELDS = {
|
||||||
|
1: ('recipient', p.UnicodeType, 0),
|
||||||
|
2: ('amount', p.UVarintType, 0),
|
||||||
|
3: ('payload', p.BytesType, 0),
|
||||||
|
4: ('public_key', p.BytesType, 0),
|
||||||
|
5: ('mosaics', NEMMosaic, p.FLAG_REPEATED),
|
||||||
|
}
|
@ -9,5 +9,6 @@ class SignTx(p.MessageType):
|
|||||||
3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin'
|
||||||
4: ('version', p.UVarintType, 0), # default=1
|
4: ('version', p.UVarintType, 0), # default=1
|
||||||
5: ('lock_time', p.UVarintType, 0), # default=0
|
5: ('lock_time', p.UVarintType, 0), # default=0
|
||||||
|
6: ('decred_expiry', p.UVarintType, 0),
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 15
|
MESSAGE_WIRE_TYPE = 15
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
from .TransactionType import TransactionType
|
||||||
from .TxInputType import TxInputType
|
from .TxInputType import TxInputType
|
||||||
from .TxOutputType import TxOutputType
|
from .TxOutputType import TxOutputType
|
||||||
from .TransactionType import TransactionType
|
|
||||||
|
|
||||||
|
|
||||||
class SimpleSignTx(p.MessageType):
|
class SimpleSignTx(p.MessageType):
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
# Automatically generated by pb2py
|
|
||||||
import protobuf as p
|
|
||||||
from .HDNodeType import HDNodeType
|
|
||||||
|
|
||||||
|
|
||||||
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),
|
|
||||||
12: ('needs_backup', p.BoolType, 0),
|
|
||||||
13: ('flags', p.UVarintType, 0),
|
|
||||||
}
|
|
@ -16,4 +16,5 @@ class TransactionType(p.MessageType):
|
|||||||
7: ('outputs_cnt', p.UVarintType, 0),
|
7: ('outputs_cnt', p.UVarintType, 0),
|
||||||
8: ('extra_data', p.BytesType, 0),
|
8: ('extra_data', p.BytesType, 0),
|
||||||
9: ('extra_data_len', p.UVarintType, 0),
|
9: ('extra_data_len', p.UVarintType, 0),
|
||||||
|
10: ('decred_expiry', p.UVarintType, 0),
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,6 @@ class TxInputType(p.MessageType):
|
|||||||
6: ('script_type', p.UVarintType, 0), # default=0
|
6: ('script_type', p.UVarintType, 0), # default=0
|
||||||
7: ('multisig', MultisigRedeemScriptType, 0),
|
7: ('multisig', MultisigRedeemScriptType, 0),
|
||||||
8: ('amount', p.UVarintType, 0),
|
8: ('amount', p.UVarintType, 0),
|
||||||
|
9: ('decred_tree', p.UVarintType, 0),
|
||||||
|
10: ('decred_script_version', p.UVarintType, 0),
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,5 @@ class TxOutputBinType(p.MessageType):
|
|||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('amount', p.UVarintType, 0), # required
|
1: ('amount', p.UVarintType, 0), # required
|
||||||
2: ('script_pubkey', p.BytesType, 0), # required
|
2: ('script_pubkey', p.BytesType, 0), # required
|
||||||
|
3: ('decred_script_version', p.UVarintType, 0),
|
||||||
}
|
}
|
||||||
|
@ -11,4 +11,5 @@ class TxOutputType(p.MessageType):
|
|||||||
4: ('script_type', p.UVarintType, 0), # required
|
4: ('script_type', p.UVarintType, 0), # required
|
||||||
5: ('multisig', MultisigRedeemScriptType, 0),
|
5: ('multisig', MultisigRedeemScriptType, 0),
|
||||||
6: ('op_return_data', p.BytesType, 0),
|
6: ('op_return_data', p.BytesType, 0),
|
||||||
|
7: ('decred_script_version', p.UVarintType, 0),
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,10 @@ ChangePin = const(4)
|
|||||||
CipherKeyValue = const(23)
|
CipherKeyValue = const(23)
|
||||||
CipheredKeyValue = const(48)
|
CipheredKeyValue = const(48)
|
||||||
ClearSession = const(24)
|
ClearSession = const(24)
|
||||||
|
CosiCommit = const(71)
|
||||||
|
CosiCommitment = const(72)
|
||||||
|
CosiSign = const(73)
|
||||||
|
CosiSignature = const(74)
|
||||||
DebugLinkDecision = const(100)
|
DebugLinkDecision = const(100)
|
||||||
DebugLinkFlashErase = const(113)
|
DebugLinkFlashErase = const(113)
|
||||||
DebugLinkGetState = const(101)
|
DebugLinkGetState = const(101)
|
||||||
@ -51,6 +55,12 @@ GetPublicKey = const(11)
|
|||||||
Initialize = const(0)
|
Initialize = const(0)
|
||||||
LoadDevice = const(13)
|
LoadDevice = const(13)
|
||||||
MessageSignature = const(40)
|
MessageSignature = const(40)
|
||||||
|
NEMAddress = const(68)
|
||||||
|
NEMDecryptMessage = const(75)
|
||||||
|
NEMDecryptedMessage = const(76)
|
||||||
|
NEMGetAddress = const(67)
|
||||||
|
NEMSignTx = const(69)
|
||||||
|
NEMSignedTx = const(70)
|
||||||
PassphraseAck = const(42)
|
PassphraseAck = const(42)
|
||||||
PassphraseRequest = const(41)
|
PassphraseRequest = const(41)
|
||||||
PinMatrixAck = const(19)
|
PinMatrixAck = const(19)
|
||||||
|
@ -247,7 +247,6 @@ class VendorHeader(object):
|
|||||||
|
|
||||||
def binopen(filename):
|
def binopen(filename):
|
||||||
data = open(filename, 'rb').read()
|
data = open(filename, 'rb').read()
|
||||||
data = bytearray(data) # python2/3 compatibility
|
|
||||||
magic = data[:4]
|
magic = data[:4]
|
||||||
if magic == b'TRZB':
|
if magic == b'TRZB':
|
||||||
return BootloaderImage(data)
|
return BootloaderImage(data)
|
||||||
|
@ -1,30 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
CURDIR=$(pwd)
|
CURDIR=$(pwd)
|
||||||
mkdir -p $CURDIR/pb2/
|
PB2DIR=$CURDIR/pb2
|
||||||
touch $CURDIR/pb2/__init__.py
|
OUTDIR=../src/trezor/messages
|
||||||
|
INDEX=$OUTDIR/wire_types.py
|
||||||
|
|
||||||
mkdir -p ../src/trezor/messages
|
rm -f $OUTDIR/[A-Z]*.py
|
||||||
|
mkdir -p $OUTDIR
|
||||||
|
mkdir -p $PB2DIR
|
||||||
|
touch $PB2DIR/__init__.py
|
||||||
|
|
||||||
INDEX=../src/trezor/messages/wire_types.py
|
|
||||||
rm -f $INDEX
|
rm -f $INDEX
|
||||||
echo '# Automatically generated by pb2py' >> $INDEX
|
echo '# Automatically generated by pb2py' >> $INDEX
|
||||||
echo 'from micropython import const' >> $INDEX
|
echo 'from micropython import const' >> $INDEX
|
||||||
echo '' >> $INDEX
|
echo '' >> $INDEX
|
||||||
|
|
||||||
for i in types messages storage ; do
|
for i in types messages ; do
|
||||||
# Compile .proto files to python2 modules using google protobuf library
|
# Compile .proto files to python2 modules using google protobuf library
|
||||||
cd $CURDIR/../../trezor-common/protob
|
cd $CURDIR/../../trezor-common/protob
|
||||||
protoc --python_out=$CURDIR/pb2/ -I/usr/include -I. $i.proto
|
protoc --python_out=$PB2DIR -I/usr/include -I. $i.proto
|
||||||
done
|
done
|
||||||
|
|
||||||
# hack to make output python 3 compatible
|
# hack to make output python 3 compatible
|
||||||
sed -i 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/messages_pb2.py
|
sed -i 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/messages_pb2.py
|
||||||
sed -i 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/storage_pb2.py
|
|
||||||
|
|
||||||
for i in types messages storage ; do
|
for i in types messages ; do
|
||||||
# Convert google protobuf library to trezor's internal format
|
# Convert google protobuf library to trezor's internal format
|
||||||
cd $CURDIR
|
cd $CURDIR
|
||||||
./pb2py -m -p $CURDIR -i $INDEX $i ../src/trezor/messages/
|
./pb2py -m -p $CURDIR -i $INDEX $i $OUTDIR
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -rf $CURDIR/pb2/
|
rm -rf $PB2DIR
|
||||||
|
30
tools/pb2py
30
tools/pb2py
@ -12,8 +12,7 @@ from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
|
|||||||
def process_type(t, cls, msg_id, indexfile, is_upy):
|
def process_type(t, cls, msg_id, indexfile, is_upy):
|
||||||
print(" * type %s" % t)
|
print(" * type %s" % t)
|
||||||
|
|
||||||
imports = ['import protobuf as p']
|
imports = []
|
||||||
|
|
||||||
out = ["", "", "class %s(p.MessageType):" % t, ]
|
out = ["", "", "class %s(p.MessageType):" % t, ]
|
||||||
|
|
||||||
if cls.DESCRIPTOR.fields_by_name:
|
if cls.DESCRIPTOR.fields_by_name:
|
||||||
@ -36,6 +35,10 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
|
|||||||
# TYPE_ENUM = 14
|
# TYPE_ENUM = 14
|
||||||
type = 'p.UVarintType'
|
type = 'p.UVarintType'
|
||||||
|
|
||||||
|
elif v.type in (17,):
|
||||||
|
# TYPE_SINT32 = 17
|
||||||
|
type = 'p.Sint32Type'
|
||||||
|
|
||||||
elif v.type == 9:
|
elif v.type == 9:
|
||||||
# TYPE_STRING = 9
|
# TYPE_STRING = 9
|
||||||
type = 'p.UnicodeType'
|
type = 'p.UnicodeType'
|
||||||
@ -93,6 +96,15 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
|
|||||||
else:
|
else:
|
||||||
indexfile.write("%s = %d\n" % (t, msg_id))
|
indexfile.write("%s = %d\n" % (t, msg_id))
|
||||||
|
|
||||||
|
# Remove duplicate imports
|
||||||
|
imports = sorted(list(set(imports)))
|
||||||
|
|
||||||
|
if is_upy:
|
||||||
|
imports = ['import protobuf as p'] + imports
|
||||||
|
else:
|
||||||
|
imports = ['from __future__ import absolute_import',
|
||||||
|
'from .. import protobuf as p'] + imports
|
||||||
|
|
||||||
return imports + out
|
return imports + out
|
||||||
|
|
||||||
|
|
||||||
@ -130,7 +142,7 @@ def find_msg_type(msg_types, t):
|
|||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
||||||
def process_module(mod, genpath, indexfile, is_upy):
|
def process_module(mod, genpath, indexfile, modlist, is_upy):
|
||||||
|
|
||||||
print("Processing module %s" % mod.__name__)
|
print("Processing module %s" % mod.__name__)
|
||||||
types = dict([(name, cls)
|
types = dict([(name, cls)
|
||||||
@ -146,6 +158,8 @@ def process_module(mod, genpath, indexfile, is_upy):
|
|||||||
out = process_type(t, cls, msg_id, indexfile, is_upy)
|
out = process_type(t, cls, msg_id, indexfile, is_upy)
|
||||||
|
|
||||||
write_to_file(genpath, t, out)
|
write_to_file(genpath, t, out)
|
||||||
|
if modlist:
|
||||||
|
modlist.write("from .%s import *\n" % t)
|
||||||
|
|
||||||
enums = dict([(name, cls) for name, cls in mod.__dict__.items()
|
enums = dict([(name, cls) for name, cls in mod.__dict__.items()
|
||||||
if isinstance(cls, EnumTypeWrapper)])
|
if isinstance(cls, EnumTypeWrapper)])
|
||||||
@ -153,6 +167,8 @@ def process_module(mod, genpath, indexfile, is_upy):
|
|||||||
for t, cls in enums.items():
|
for t, cls in enums.items():
|
||||||
out = process_enum(t, cls, is_upy)
|
out = process_enum(t, cls, is_upy)
|
||||||
write_to_file(genpath, t, out)
|
write_to_file(genpath, t, out)
|
||||||
|
if modlist:
|
||||||
|
modlist.write("from . import %s\n" % t)
|
||||||
|
|
||||||
|
|
||||||
def write_to_file(genpath, t, out):
|
def write_to_file(genpath, t, out):
|
||||||
@ -171,6 +187,7 @@ if __name__ == '__main__':
|
|||||||
parser.add_argument('modulename', type=str, help="Name of module to generate")
|
parser.add_argument('modulename', type=str, help="Name of module to generate")
|
||||||
parser.add_argument('genpath', type=str, help="Directory for generated source code")
|
parser.add_argument('genpath', type=str, help="Directory for generated source code")
|
||||||
parser.add_argument('-i', '--indexfile', type=str, help="[optional] Generate index file of wire types")
|
parser.add_argument('-i', '--indexfile', type=str, help="[optional] Generate index file of wire types")
|
||||||
|
parser.add_argument('-l', '--modlist', type=str, help="[optional] Generate list of modules")
|
||||||
parser.add_argument('-p', '--protopath', type=str, help="[optional] Path to search for pregenerated Google's python sources")
|
parser.add_argument('-p', '--protopath', type=str, help="[optional] Path to search for pregenerated Google's python sources")
|
||||||
parser.add_argument('-m', '--micropython', action='store_true', help="Use micropython-favoured source code")
|
parser.add_argument('-m', '--micropython', action='store_true', help="Use micropython-favoured source code")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@ -180,6 +197,11 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
indexfile = None
|
indexfile = None
|
||||||
|
|
||||||
|
if args.modlist:
|
||||||
|
modlist = open(args.modlist, 'a')
|
||||||
|
else:
|
||||||
|
modlist = None
|
||||||
|
|
||||||
if args.protopath:
|
if args.protopath:
|
||||||
sys.path.append(args.protopath)
|
sys.path.append(args.protopath)
|
||||||
|
|
||||||
@ -187,4 +209,4 @@ if __name__ == '__main__':
|
|||||||
tmp = __import__('pb2', globals(), locals(), ['%s_pb2' % args.modulename])
|
tmp = __import__('pb2', globals(), locals(), ['%s_pb2' % args.modulename])
|
||||||
mod = getattr(tmp, "%s_pb2" % args.modulename)
|
mod = getattr(tmp, "%s_pb2" % args.modulename)
|
||||||
|
|
||||||
process_module(mod, args.genpath, indexfile, args.micropython)
|
process_module(mod, args.genpath, indexfile, modlist, args.micropython)
|
||||||
|
Loading…
Reference in New Issue
Block a user