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

protobuf: update generators and messages to be identical with trezor-core

This commit is contained in:
matejcik 2018-05-09 17:14:44 +02:00
parent 18adf6cc4d
commit e0d850df7d
131 changed files with 1848 additions and 177 deletions

View File

@ -1,6 +1,17 @@
#!/bin/bash
set -e
IS_CORE=""
if [ "$1" == "--core" ]; then
shift
IS_CORE=yes
elif [ "$1" == "--no-core" ]; then
shift
elif echo $PWD | grep -q "trezor-core"; then
IS_CORE=yes
fi
if [ -n "$1" ]; then
OUTDIR=`readlink -f "$1"`
fi
@ -29,17 +40,26 @@ for file in $PROTO_FILES; do
protoc --python_out="$PB2_OUT" -I/usr/include -I"$PROTO_PATH" "$PROTO_PATH/$file.proto"
done
# create index (__init__.py)
cat > "$TMPDIR/$INDEX" << EOF
# Automatically generated by pb2py
EOF
if [ -n "$IS_CORE" ]; then
# generate for micropython
PB2PY_OPTS="-m"
else
# create index (__init__.py)
echo "# Automatically generated by pb2py" > $TMPDIR/$INDEX
echo >> $TMPDIR/$INDEX
PB2PY_OPTS="-l $TMPDIR/$INDEX"
fi
# convert google protobuf library to trezor's internal format
for file in $PROTO_FILES; do
./pb2py -P "trezorlib.protobuf" -p "$PB2_OUT" -l "$TMPDIR/$INDEX" "$file" "$TMPDIR"
./pb2py $PB2PY_OPTS -P "trezorlib.protobuf" -p "$PB2_OUT" "$file" "$TMPDIR"
done
if [ -n "$IS_CORE" ]; then
cp "$TMPDIR/MessageType.py" "$TMPDIR/wire_types.py"
fi
# ensure $GENPATH exists and is empty of messages
mkdir -p "$GENPATH"
# only remove messages - there could possibly be other files not starting with capital letter

View File

@ -7,6 +7,44 @@ import importlib
import logging
import os
import sys
from collections import namedtuple
ProtoField = namedtuple('ProtoField', 'name, number, proto_type, py_type, repeated, required, orig')
def parse_field(number, field):
FIELD_TYPES = {
field.TYPE_UINT64: ('p.UVarintType', 'int'),
field.TYPE_UINT32: ('p.UVarintType', 'int'),
field.TYPE_ENUM: ('p.UVarintType', 'int'),
field.TYPE_SINT32: ('p.SVarintType', 'int'),
field.TYPE_SINT64: ('p.SVarintType', 'int'),
field.TYPE_STRING: ('p.UnicodeType', 'str'),
field.TYPE_BOOL: ('p.BoolType', 'bool'),
field.TYPE_BYTES: ('p.BytesType', 'bytes'),
}
repeated = (field.label == field.LABEL_REPEATED)
required = (field.label == field.LABEL_REQUIRED)
if field.type == field.TYPE_MESSAGE:
proto_type = py_type = field.message_type.name
else:
try:
proto_type, py_type = FIELD_TYPES[field.type]
except KeyError:
raise ValueError("Unknown field type %d for field %s" % (field.type, field.name)) from None
if repeated:
py_type = "List[%s]" % py_type
return ProtoField(
name=field.name,
number=number,
proto_type=proto_type,
py_type=py_type,
repeated=repeated,
required=required,
orig=field,
)
def import_pb2(name):
@ -17,13 +55,6 @@ def create_message_import(name):
return "from .%s import %s" % (name, name)
def create_const(name, value, is_upy):
if is_upy:
return "%s = const(%s)" % (name, value)
else:
return "%s = %s" % (name, value)
def remove_from_start(s, prefix):
if s.startswith(prefix):
return s[len(prefix):]
@ -42,83 +73,82 @@ def process_message_imports(descriptor):
yield create_message_import(name)
def process_message(descriptor, protobuf_module, msg_id, indexfile, is_upy):
def create_init_method(fields):
yield " def __init__("
yield " self,"
for field in fields[:-1]:
yield " %s: %s = None," % (field.name, field.py_type)
# last field must not have a traling comma
yield " %s: %s = None" % (fields[-1].name, fields[-1].py_type)
yield " ) -> None:"
for field in fields:
if field.repeated:
yield " self.{0} = {0} if {0} is not None else []".format(field.name)
else:
yield " self.{0} = {0}".format(field.name)
def process_message(descriptor, protobuf_module, msg_id, is_upy):
logging.debug("Processing message %s", descriptor.name)
if is_upy:
yield "import protobuf as p"
else:
yield "from .. import protobuf as p"
fields = list(parse_field(number, field)
for number, field
in descriptor.fields_by_number.items())
if any(field.repeated for field in fields):
yield "if __debug__:"
yield " try:"
yield " from typing import List"
yield " except ImportError:"
yield " List = None"
yield from process_message_imports(descriptor)
yield ""
yield ""
yield "class %s(p.MessageType):" % descriptor.name
if descriptor.fields_by_number:
yield " FIELDS = {"
elif msg_id is None:
yield " pass"
for number, field in descriptor.fields_by_number.items():
field_name = field.name
field_type = None
repeated = (field.label == field.LABEL_REPEATED)
required = (field.label == field.LABEL_REQUIRED)
types = {
field.TYPE_UINT64: 'p.UVarintType',
field.TYPE_UINT32: 'p.UVarintType',
field.TYPE_ENUM: 'p.UVarintType',
field.TYPE_SINT32: 'p.SVarintType',
field.TYPE_SINT64: 'p.SVarintType',
field.TYPE_STRING: 'p.UnicodeType',
field.TYPE_BOOL: 'p.BoolType',
field.TYPE_BYTES: 'p.BytesType'
}
if field.type == field.TYPE_MESSAGE:
field_type = field.message_type.name
else:
try:
field_type = types[field.type]
except KeyError:
raise ValueError("Unknown field type %d for field %s" % (field.type, field_name))
comments = []
if required:
comments.append('required')
if field.has_default_value:
comments.append("default=%s" % repr(field.default_value))
if comments:
comment = " # %s" % ' '.join(comments)
else:
comment = ''
if repeated:
flags = 'p.FLAG_REPEATED'
else:
flags = '0'
yield " %d: ('%s', %s, %s),%s" % (number, field_name, field_type, flags, comment)
if descriptor.fields_by_name:
yield " }"
if msg_id is not None:
yield " MESSAGE_WIRE_TYPE = %d" % msg_id
if indexfile is not None:
indexfile.write(create_const(t, msg_id, is_upy))
if fields:
yield " FIELDS = {"
for field in fields:
comments = []
if field.required:
comments.append('required')
if field.orig.has_default_value:
comments.append("default=%s" % repr(field.orig.default_value))
if comments:
comment = " # %s" % ' '.join(comments)
else:
comment = ''
if field.repeated:
flags = 'p.FLAG_REPEATED'
else:
flags = '0'
yield " %d: ('%s', %s, %s),%s" % (field.number, field.name, field.proto_type, flags, comment)
yield " }"
yield ""
yield from create_init_method(fields)
if not fields and not msg_id:
yield " pass"
def process_enum(descriptor, is_upy):
logging.debug("Processing enum %s", descriptor.name)
if is_upy:
yield "from micropython import const"
yield ""
for name, value in descriptor.values_by_name.items():
# Remove type name from the beginning of the constant
# For example "PinMatrixRequestType_Current" -> "Current"
@ -131,10 +161,10 @@ def process_enum(descriptor, is_upy):
enum_prefix, _ = enum_prefix.rsplit("Type", 1)
name = remove_from_start(name, "%s_" % enum_prefix)
yield create_const(name, value.number, is_upy)
yield "%s = %s" % (name, value.number)
def process_file(descriptor, protobuf_module, genpath, indexfile, modlist, is_upy):
def process_file(descriptor, protobuf_module, genpath, modlist, is_upy):
logging.info("Processing module %s", descriptor.name)
msg_types = import_pb2('messages').MessageType
@ -146,7 +176,7 @@ def process_file(descriptor, protobuf_module, genpath, indexfile, modlist, is_up
except ValueError:
msg_id = None
out = process_message(message_descriptor, protobuf_module, msg_id, indexfile, is_upy)
out = process_message(message_descriptor, protobuf_module, msg_id, is_upy)
write_to_file(genpath, name, out)
if modlist:
modlist.write(create_message_import(name) + "\n")
@ -173,7 +203,6 @@ if __name__ == '__main__':
parser.add_argument('module', help="Name of module to generate")
parser.add_argument('genpath', help="Directory for generated source code")
parser.add_argument('-P', '--protobuf-module', default="protobuf", help="Name of protobuf module")
parser.add_argument('-i', '--indexfile', type=argparse.FileType('a'), help="Generate index file of wire types")
parser.add_argument('-l', '--modlist', type=argparse.FileType('a'), help="Generate list of modules")
parser.add_argument('-p', '--protopath', type=str, help="Path to search for pregenerated Google's python sources")
parser.add_argument('-m', '--micropython', action='store_true', help="Use micropython-favoured source code")
@ -185,4 +214,4 @@ if __name__ == '__main__':
# This must be done after sys.path.append
module = import_pb2(args.module)
process_file(module.DESCRIPTOR, args.protobuf_module, args.genpath, args.indexfile, args.modlist, args.micropython)
process_file(module.DESCRIPTOR, args.protobuf_module, args.genpath, args.modlist, args.micropython)

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.address = address

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.flags = flags

View File

@ -3,6 +3,7 @@ from .. import protobuf as p
class ApplySettings(p.MessageType):
MESSAGE_WIRE_TYPE = 25
FIELDS = {
1: ('language', p.UnicodeType, 0),
2: ('label', p.UnicodeType, 0),
@ -11,4 +12,19 @@ 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,
language: str = None,
label: str = None,
use_passphrase: bool = None,
homescreen: bytes = None,
passphrase_source: int = None,
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

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.code = code
self.data = data

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.remove = remove

View File

@ -1,8 +1,14 @@
# Automatically generated by pb2py
from .. 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,4 +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[int] = None,
key: str = None,
value: bytes = None,
encrypt: bool = None,
ask_on_encrypt: bool = None,
ask_on_decrypt: bool = None,
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

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.value = value

View File

@ -16,3 +16,29 @@ class CoinType(p.MessageType):
12: ('forkid', p.UVarintType, 0),
13: ('force_bip143', p.BoolType, 0),
}
def __init__(
self,
coin_name: str = None,
coin_shortcut: str = None,
address_type: int = None,
maxfee_kb: int = None,
address_type_p2sh: int = None,
signed_message_header: str = None,
xpub_magic: int = None,
xprv_magic: int = None,
segwit: bool = None,
forkid: int = None,
force_bip143: bool = None
) -> None:
self.coin_name = coin_name
self.coin_shortcut = coin_shortcut
self.address_type = address_type
self.maxfee_kb = maxfee_kb
self.address_type_p2sh = address_type_p2sh
self.signed_message_header = signed_message_header
self.xpub_magic = xpub_magic
self.xprv_magic = xprv_magic
self.segwit = segwit
self.forkid = forkid
self.force_bip143 = force_bip143

View File

@ -1,10 +1,23 @@
# Automatically generated by pb2py
from .. 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[int] = None,
data: bytes = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.data = data

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.commitment = commitment
self.pubkey = pubkey

View File

@ -1,12 +1,29 @@
# Automatically generated by pb2py
from .. 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[int] = None,
data: bytes = None,
global_commitment: bytes = None,
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

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.signature = signature

View File

@ -3,9 +3,19 @@ from .. 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
) -> None:
self.yes_no = yes_no
self.up_down = up_down
self.input = input

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.sector = sector

View File

@ -3,9 +3,19 @@ from .. 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
) -> None:
self.level = level
self.bucket = bucket
self.text = text

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.memory = memory

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.address = address
self.length = length

View File

@ -3,9 +3,19 @@ from .. 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
) -> None:
self.address = address
self.memory = memory
self.flash = flash

View File

@ -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,4 +18,29 @@ 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,
layout: bytes = None,
pin: str = None,
matrix: str = None,
mnemonic: str = None,
node: HDNodeType = None,
passphrase_protection: bool = None,
reset_word: str = None,
reset_entropy: bytes = None,
recovery_fake_word: str = None,
recovery_word_pos: int = None,
reset_word_pos: int = None
) -> None:
self.layout = layout
self.pin = pin
self.matrix = matrix
self.mnemonic = mnemonic
self.node = node
self.passphrase_protection = passphrase_protection
self.reset_word = reset_word
self.reset_entropy = reset_entropy
self.recovery_fake_word = recovery_fake_word
self.recovery_word_pos = recovery_word_pos
self.reset_word_pos = reset_word_pos

View File

@ -1,12 +1,29 @@
# Automatically generated by pb2py
from .. 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[int] = None,
nonce: bytes = None,
message: bytes = None,
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

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.message = message
self.address = address

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.session_key = session_key

View File

@ -1,8 +1,14 @@
# Automatically generated by pb2py
from .. 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,4 +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[int] = None,
coin_name: str = None
) -> None:
self.pubkey = pubkey
self.message = message
self.display_only = display_only
self.address_n = address_n if address_n is not None else []
self.coin_name = coin_name

View File

@ -3,9 +3,19 @@ from .. 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
) -> None:
self.nonce = nonce
self.message = message
self.hmac = hmac

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.entropy = entropy

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.entropy = entropy

View File

@ -3,9 +3,19 @@ from .. 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
) -> None:
self.outputs_count = outputs_count
self.inputs_count = inputs_count
self.coin_name = coin_name

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.address = address

View File

@ -1,10 +1,23 @@
# Automatically generated by pb2py
from .. 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[int] = None,
show_display: bool = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.show_display = show_display

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.address = address
self.signature = signature

View File

@ -1,10 +1,23 @@
# Automatically generated by pb2py
from .. 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[int] = None,
message: bytes = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.message = message

View File

@ -1,8 +1,14 @@
# Automatically generated by pb2py
from .. 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,4 +21,27 @@ 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[int] = None,
nonce: bytes = None,
gas_price: bytes = None,
gas_limit: bytes = None,
to: bytes = None,
value: bytes = None,
data_initial_chunk: bytes = None,
data_length: int = None,
chain_id: int = None,
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
self.to = to
self.value = value
self.data_initial_chunk = data_initial_chunk
self.data_length = data_length
self.chain_id = chain_id
self.tx_type = tx_type

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.data_chunk = data_chunk

View File

@ -3,10 +3,22 @@ from .. 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
) -> None:
self.data_length = data_length
self.signature_v = signature_v
self.signature_r = signature_r
self.signature_s = signature_s

View File

@ -3,9 +3,19 @@ from .. 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
) -> None:
self.address = address
self.signature = signature
self.message = message

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.code = code
self.message = message

View File

@ -1,9 +1,15 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
from .CoinType import CoinType
class Features(p.MessageType):
MESSAGE_WIRE_TYPE = 17
FIELDS = {
1: ('vendor', p.UnicodeType, 0),
2: ('major_version', p.UVarintType, 0),
@ -33,4 +39,61 @@ class Features(p.MessageType):
26: ('fw_vendor_keys', p.BytesType, 0),
27: ('unfinished_backup', p.BoolType, 0),
}
MESSAGE_WIRE_TYPE = 17
def __init__(
self,
vendor: str = None,
major_version: int = None,
minor_version: int = None,
patch_version: int = None,
bootloader_mode: bool = None,
device_id: str = None,
pin_protection: bool = None,
passphrase_protection: bool = None,
language: str = None,
label: str = None,
coins: List[CoinType] = None,
initialized: bool = None,
revision: bytes = None,
bootloader_hash: bytes = None,
imported: bool = None,
pin_cached: bool = None,
passphrase_cached: bool = None,
firmware_present: bool = None,
needs_backup: bool = None,
flags: int = None,
model: str = None,
fw_major: int = None,
fw_minor: int = None,
fw_patch: int = None,
fw_vendor: str = None,
fw_vendor_keys: bytes = None,
unfinished_backup: bool = None
) -> None:
self.vendor = vendor
self.major_version = major_version
self.minor_version = minor_version
self.patch_version = patch_version
self.bootloader_mode = bootloader_mode
self.device_id = device_id
self.pin_protection = pin_protection
self.passphrase_protection = passphrase_protection
self.language = language
self.label = label
self.coins = coins if coins is not None else []
self.initialized = initialized
self.revision = revision
self.bootloader_hash = bootloader_hash
self.imported = imported
self.pin_cached = pin_cached
self.passphrase_cached = passphrase_cached
self.firmware_present = firmware_present
self.needs_backup = needs_backup
self.flags = flags
self.model = model
self.fw_major = fw_major
self.fw_minor = fw_minor
self.fw_patch = fw_patch
self.fw_vendor = fw_vendor
self.fw_vendor_keys = fw_vendor_keys
self.unfinished_backup = unfinished_backup

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.length = length

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.offset = offset
self.length = length

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.payload = payload
self.hash = hash

View File

@ -1,9 +1,15 @@
# Automatically generated by pb2py
from .. 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,4 +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[int] = None,
coin_name: str = None,
show_display: bool = None,
multisig: MultisigRedeemScriptType = None,
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

View File

@ -4,9 +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
) -> None:
self.identity = identity
self.peer_public_key = peer_public_key
self.ecdsa_curve_name = ecdsa_curve_name

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.size = size

View File

@ -1,12 +1,29 @@
# Automatically generated by pb2py
from .. 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[int] = None,
ecdsa_curve_name: str = None,
show_display: bool = None,
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

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
from .HDNodeType import HDNodeType
@ -8,3 +13,11 @@ class HDNodePathType(p.MessageType):
1: ('node', HDNodeType, 0), # required
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
}
def __init__(
self,
node: HDNodeType = None,
address_n: List[int] = None
) -> None:
self.node = node
self.address_n = address_n if address_n is not None else []

View File

@ -11,3 +11,19 @@ class HDNodeType(p.MessageType):
5: ('private_key', p.BytesType, 0),
6: ('public_key', p.BytesType, 0),
}
def __init__(
self,
depth: int = None,
fingerprint: int = None,
child_num: int = None,
chain_code: bytes = None,
private_key: bytes = None,
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

View File

@ -11,3 +11,19 @@ class IdentityType(p.MessageType):
5: ('path', p.UnicodeType, 0),
6: ('index', p.UVarintType, 0), # default=0
}
def __init__(
self,
proto: str = None,
user: str = None,
host: str = None,
port: str = None,
path: str = None,
index: int = None
) -> None:
self.proto = proto
self.user = user
self.host = host
self.port = port
self.path = path
self.index = index

View File

@ -3,7 +3,13 @@ from .. import protobuf as p
class Initialize(p.MessageType):
MESSAGE_WIRE_TYPE = 0
FIELDS = {
1: ('state', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 0
def __init__(
self,
state: bytes = None
) -> None:
self.state = state

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.address = address

View File

@ -6,3 +6,9 @@ class LiskDelegateType(p.MessageType):
FIELDS = {
1: ('username', p.UnicodeType, 0),
}
def __init__(
self,
username: str = None
) -> None:
self.username = username

View File

@ -1,10 +1,23 @@
# Automatically generated by pb2py
from .. 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[int] = None,
show_display: bool = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.show_display = show_display

View File

@ -1,10 +1,23 @@
# Automatically generated by pb2py
from .. 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[int] = None,
show_display: bool = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.show_display = show_display

View File

@ -3,8 +3,16 @@ from .. import protobuf as p
class LiskMessageSignature(p.MessageType):
MESSAGE_WIRE_TYPE = 119
FIELDS = {
1: ('address', p.UnicodeType, 0),
2: ('signature', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 119
def __init__(
self,
address: str = None,
signature: bytes = None
) -> None:
self.address = address
self.signature = signature

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
class LiskMultisignatureType(p.MessageType):
@ -8,3 +13,13 @@ class LiskMultisignatureType(p.MessageType):
2: ('life_time', p.UVarintType, 0),
3: ('keys_group', p.UnicodeType, p.FLAG_REPEATED),
}
def __init__(
self,
min: int = None,
life_time: int = None,
keys_group: List[str] = None
) -> None:
self.min = min
self.life_time = life_time
self.keys_group = keys_group if keys_group is not None else []

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.public_key = public_key

View File

@ -1,10 +1,23 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
class LiskSignMessage(p.MessageType):
MESSAGE_WIRE_TYPE = 118
FIELDS = {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('message', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 118
def __init__(
self,
address_n: List[int] = None,
message: bytes = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.message = message

View File

@ -1,11 +1,24 @@
# Automatically generated by pb2py
from .. 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[int] = None,
transaction: LiskTransactionCommon = None
) -> None:
self.address_n = address_n if address_n is not None else []
self.transaction = transaction

View File

@ -6,3 +6,9 @@ class LiskSignatureType(p.MessageType):
FIELDS = {
1: ('public_key', p.BytesType, 0),
}
def __init__(
self,
public_key: bytes = None
) -> None:
self.public_key = public_key

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.signature = signature

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. 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
@ -13,3 +18,17 @@ class LiskTransactionAsset(p.MessageType):
4: ('multisignature', LiskMultisignatureType, 0),
5: ('data', p.UnicodeType, 0),
}
def __init__(
self,
signature: LiskSignatureType = None,
delegate: LiskDelegateType = None,
votes: List[str] = None,
multisignature: LiskMultisignatureType = None,
data: str = None
) -> None:
self.signature = signature
self.delegate = delegate
self.votes = votes if votes is not None else []
self.multisignature = multisignature
self.data = data

View File

@ -15,3 +15,25 @@ class LiskTransactionCommon(p.MessageType):
8: ('timestamp', p.UVarintType, 0),
9: ('asset', LiskTransactionAsset, 0),
}
def __init__(
self,
type: int = None,
amount: int = None,
fee: int = None,
recipient_id: str = None,
sender_public_key: bytes = None,
requester_public_key: bytes = None,
signature: bytes = None,
timestamp: int = None,
asset: LiskTransactionAsset = None
) -> None:
self.type = type
self.amount = amount
self.fee = fee
self.recipient_id = recipient_id
self.sender_public_key = sender_public_key
self.requester_public_key = requester_public_key
self.signature = signature
self.timestamp = timestamp
self.asset = asset

View File

@ -3,9 +3,19 @@ from .. import protobuf as p
class LiskVerifyMessage(p.MessageType):
MESSAGE_WIRE_TYPE = 120
FIELDS = {
1: ('signature', p.BytesType, 0),
2: ('public_key', p.BytesType, 0),
3: ('message', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 120
def __init__(
self,
signature: bytes = None,
public_key: bytes = None,
message: bytes = None
) -> None:
self.signature = signature
self.public_key = public_key
self.message = message

View File

@ -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,4 +15,23 @@ class LoadDevice(p.MessageType):
7: ('skip_checksum', p.BoolType, 0),
8: ('u2f_counter', p.UVarintType, 0),
}
MESSAGE_WIRE_TYPE = 13
def __init__(
self,
mnemonic: str = None,
node: HDNodeType = None,
pin: str = None,
passphrase_protection: bool = None,
language: str = None,
label: str = None,
skip_checksum: bool = None,
u2f_counter: int = None
) -> None:
self.mnemonic = mnemonic
self.node = node
self.pin = pin
self.passphrase_protection = passphrase_protection
self.language = language
self.label = label
self.skip_checksum = skip_checksum
self.u2f_counter = u2f_counter

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.address = address
self.signature = signature

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
from .HDNodePathType import HDNodePathType
@ -9,3 +14,13 @@ class MultisigRedeemScriptType(p.MessageType):
2: ('signatures', p.BytesType, p.FLAG_REPEATED),
3: ('m', p.UVarintType, 0),
}
def __init__(
self,
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

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.address = address

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
from .NEMCosignatoryModification import NEMCosignatoryModification
@ -8,3 +13,11 @@ class NEMAggregateModification(p.MessageType):
1: ('modifications', NEMCosignatoryModification, p.FLAG_REPEATED),
2: ('relative_change', p.SVarintType, 0),
}
def __init__(
self,
modifications: List[NEMCosignatoryModification] = None,
relative_change: int = None
) -> None:
self.modifications = modifications if modifications is not None else []
self.relative_change = relative_change

View File

@ -7,3 +7,11 @@ class NEMCosignatoryModification(p.MessageType):
1: ('type', p.UVarintType, 0),
2: ('public_key', p.BytesType, 0),
}
def __init__(
self,
type: int = None,
public_key: bytes = None
) -> None:
self.type = type
self.public_key = public_key

View File

@ -1,12 +1,29 @@
# Automatically generated by pb2py
from .. 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[int] = None,
network: int = None,
public_key: bytes = None,
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

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.payload = payload

View File

@ -1,11 +1,26 @@
# Automatically generated by pb2py
from .. 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[int] = None,
network: int = None,
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

View File

@ -7,3 +7,11 @@ class NEMImportanceTransfer(p.MessageType):
1: ('mode', p.UVarintType, 0),
2: ('public_key', p.BytesType, 0),
}
def __init__(
self,
mode: int = None,
public_key: bytes = None
) -> None:
self.mode = mode
self.public_key = public_key

View File

@ -8,3 +8,13 @@ class NEMMosaic(p.MessageType):
2: ('mosaic', p.UnicodeType, 0),
3: ('quantity', p.UVarintType, 0),
}
def __init__(
self,
namespace: str = None,
mosaic: str = None,
quantity: int = None
) -> None:
self.namespace = namespace
self.mosaic = mosaic
self.quantity = quantity

View File

@ -9,3 +9,13 @@ class NEMMosaicCreation(p.MessageType):
2: ('sink', p.UnicodeType, 0),
3: ('fee', p.UVarintType, 0),
}
def __init__(
self,
definition: NEMMosaicDefinition = None,
sink: str = None,
fee: int = None
) -> None:
self.definition = definition
self.sink = sink
self.fee = fee

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
class NEMMosaicDefinition(p.MessageType):
@ -20,3 +25,37 @@ class NEMMosaicDefinition(p.MessageType):
14: ('description', p.UnicodeType, 0),
15: ('networks', p.UVarintType, p.FLAG_REPEATED),
}
def __init__(
self,
name: str = None,
ticker: str = None,
namespace: str = None,
mosaic: str = None,
divisibility: int = None,
levy: int = None,
fee: int = None,
levy_address: str = None,
levy_namespace: str = None,
levy_mosaic: str = None,
supply: int = None,
mutable_supply: bool = None,
transferable: bool = None,
description: str = None,
networks: List[int] = None
) -> None:
self.name = name
self.ticker = ticker
self.namespace = namespace
self.mosaic = mosaic
self.divisibility = divisibility
self.levy = levy
self.fee = fee
self.levy_address = levy_address
self.levy_namespace = levy_namespace
self.levy_mosaic = levy_mosaic
self.supply = supply
self.mutable_supply = mutable_supply
self.transferable = transferable
self.description = description
self.networks = networks if networks is not None else []

View File

@ -9,3 +9,15 @@ class NEMMosaicSupplyChange(p.MessageType):
3: ('type', p.UVarintType, 0),
4: ('delta', p.UVarintType, 0),
}
def __init__(
self,
namespace: str = None,
mosaic: str = None,
type: int = None,
delta: int = None
) -> None:
self.namespace = namespace
self.mosaic = mosaic
self.type = type
self.delta = delta

View File

@ -9,3 +9,15 @@ class NEMProvisionNamespace(p.MessageType):
3: ('sink', p.UnicodeType, 0),
4: ('fee', p.UVarintType, 0),
}
def __init__(
self,
namespace: str = None,
parent: str = None,
sink: str = None,
fee: int = None
) -> None:
self.namespace = namespace
self.parent = parent
self.sink = sink
self.fee = fee

View File

@ -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,4 +22,25 @@ class NEMSignTx(p.MessageType):
8: ('aggregate_modification', NEMAggregateModification, 0),
9: ('importance_transfer', NEMImportanceTransfer, 0),
}
MESSAGE_WIRE_TYPE = 69
def __init__(
self,
transaction: NEMTransactionCommon = None,
multisig: NEMTransactionCommon = None,
transfer: NEMTransfer = None,
cosigning: bool = None,
provision_namespace: NEMProvisionNamespace = None,
mosaic_creation: NEMMosaicCreation = None,
supply_change: NEMMosaicSupplyChange = None,
aggregate_modification: NEMAggregateModification = None,
importance_transfer: NEMImportanceTransfer = None
) -> None:
self.transaction = transaction
self.multisig = multisig
self.transfer = transfer
self.cosigning = cosigning
self.provision_namespace = provision_namespace
self.mosaic_creation = mosaic_creation
self.supply_change = supply_change
self.aggregate_modification = aggregate_modification
self.importance_transfer = importance_transfer

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.data = data
self.signature = signature

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
class NEMTransactionCommon(p.MessageType):
@ -11,3 +16,19 @@ class NEMTransactionCommon(p.MessageType):
5: ('deadline', p.UVarintType, 0),
6: ('signer', p.BytesType, 0),
}
def __init__(
self,
address_n: List[int] = None,
network: int = None,
timestamp: int = None,
fee: int = None,
deadline: int = None,
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

View File

@ -1,5 +1,10 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
from .NEMMosaic import NEMMosaic
@ -11,3 +16,17 @@ class NEMTransfer(p.MessageType):
4: ('public_key', p.BytesType, 0),
5: ('mosaics', NEMMosaic, p.FLAG_REPEATED),
}
def __init__(
self,
recipient: str = None,
amount: int = None,
payload: bytes = None,
public_key: bytes = None,
mosaics: List[NEMMosaic] = None
) -> None:
self.recipient = recipient
self.amount = amount
self.payload = payload
self.public_key = public_key
self.mosaics = mosaics if mosaics is not None else []

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.passphrase = passphrase
self.state = state

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.on_device = on_device

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.state = state

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.pin = pin

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.type = type

View File

@ -3,10 +3,22 @@ from .. 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
) -> None:
self.message = message
self.button_protection = button_protection
self.pin_protection = pin_protection
self.passphrase_protection = passphrase_protection

View File

@ -4,8 +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
) -> None:
self.node = node
self.xpub = xpub

View File

@ -3,6 +3,7 @@ from .. 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,4 +15,25 @@ class RecoveryDevice(p.MessageType):
9: ('u2f_counter', p.UVarintType, 0),
10: ('dry_run', p.BoolType, 0),
}
MESSAGE_WIRE_TYPE = 45
def __init__(
self,
word_count: int = None,
passphrase_protection: bool = None,
pin_protection: bool = None,
language: str = None,
label: str = None,
enforce_wordlist: bool = None,
type: int = None,
u2f_counter: int = None,
dry_run: bool = None
) -> None:
self.word_count = word_count
self.passphrase_protection = passphrase_protection
self.pin_protection = pin_protection
self.language = language
self.label = label
self.enforce_wordlist = enforce_wordlist
self.type = type
self.u2f_counter = u2f_counter
self.dry_run = dry_run

View File

@ -3,6 +3,7 @@ from .. 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,4 +14,23 @@ class ResetDevice(p.MessageType):
7: ('u2f_counter', p.UVarintType, 0),
8: ('skip_backup', p.BoolType, 0),
}
MESSAGE_WIRE_TYPE = 14
def __init__(
self,
display_random: bool = None,
strength: int = None,
passphrase_protection: bool = None,
pin_protection: bool = None,
language: str = None,
label: str = None,
u2f_counter: int = None,
skip_backup: bool = None
) -> None:
self.display_random = display_random
self.strength = strength
self.passphrase_protection = passphrase_protection
self.pin_protection = pin_protection
self.language = language
self.label = label
self.u2f_counter = u2f_counter
self.skip_backup = skip_backup

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.payload = payload

View File

@ -3,7 +3,13 @@ from .. 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
) -> None:
self.u2f_counter = u2f_counter

View File

@ -4,10 +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
) -> None:
self.identity = identity
self.challenge_hidden = challenge_hidden
self.challenge_visual = challenge_visual
self.ecdsa_curve_name = ecdsa_curve_name

View File

@ -1,12 +1,29 @@
# Automatically generated by pb2py
from .. 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[int] = None,
message: bytes = None,
coin_name: str = None,
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

View File

@ -3,6 +3,7 @@ from .. 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,4 +12,19 @@ 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,
outputs_count: int = None,
inputs_count: int = None,
coin_name: str = None,
version: int = None,
lock_time: int = None,
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

View File

@ -3,9 +3,19 @@ from .. 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
) -> None:
self.address = address
self.public_key = public_key
self.signature = signature

View File

@ -1,11 +1,17 @@
# Automatically generated by pb2py
from .. 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,4 +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[TxInputType] = None,
outputs: List[TxOutputType] = None,
transactions: List[TransactionType] = None,
coin_name: str = None,
version: int = None,
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

View File

@ -3,8 +3,16 @@ from .. 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
) -> None:
self.source_account = source_account
self.destination_account = destination_account

Some files were not shown because too many files have changed in this diff Show More