How to use the protobuf.MessageType function in protobuf

To help you get started, we’ve selected a few protobuf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trezor / trezor-firmware / src / trezor / messages / OntologySignOntIdRegister.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p

from .OntologyOntIdRegister import OntologyOntIdRegister
from .OntologyTransaction import OntologyTransaction

if __debug__:
    try:
        from typing import List
    except ImportError:
        List = None  # type: ignore


class OntologySignOntIdRegister(p.MessageType):
    MESSAGE_WIRE_TYPE = 358

    def __init__(
        self,
        address_n: List[int] = None,
        transaction: OntologyTransaction = None,
        ont_id_register: OntologyOntIdRegister = None,
    ) -> None:
        self.address_n = address_n if address_n is not None else []
        self.transaction = transaction
        self.ont_id_register = ont_id_register

    @classmethod
    def get_fields(cls):
        return {
            1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
github trezor / trezor-firmware / core / src / trezor / messages / MoneroTransactionAllOutSetAck.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p

from .MoneroRingCtSig import MoneroRingCtSig

if __debug__:
    try:
        from typing import Dict, List  # noqa: F401
        from typing_extensions import Literal  # noqa: F401
    except ImportError:
        pass


class MoneroTransactionAllOutSetAck(p.MessageType):
    MESSAGE_WIRE_TYPE = 514

    def __init__(
        self,
        extra: bytes = None,
        tx_prefix_hash: bytes = None,
        rv: MoneroRingCtSig = None,
        full_message_hash: bytes = None,
    ) -> None:
        self.extra = extra
        self.tx_prefix_hash = tx_prefix_hash
        self.rv = rv
        self.full_message_hash = full_message_hash

    @classmethod
    def get_fields(cls) -> Dict:
github trezor / trezor-core / src / trezor / messages / OntologyTxAttribute.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p


class OntologyTxAttribute(p.MessageType):

    def __init__(
        self,
        usage: int = None,
        data: bytes = None,
    ) -> None:
        self.usage = usage
        self.data = data

    @classmethod
    def get_fields(cls):
        return {
            1: ('usage', p.UVarintType, 0),
            2: ('data', p.BytesType, 0),
        }
github trezor / trezor-firmware / src / trezor / messages / MoneroRingCtSig.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p


class MoneroRingCtSig(p.MessageType):

    def __init__(
        self,
        txn_fee: int = None,
        message: bytes = None,
        rv_type: int = None,
    ) -> None:
        self.txn_fee = txn_fee
        self.message = message
        self.rv_type = rv_type

    @classmethod
    def get_fields(cls):
        return {
            1: ('txn_fee', p.UVarintType, 0),
            2: ('message', p.BytesType, 0),
github trezor / trezor-firmware / src / trezor / messages / SignIdentity.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p

from .IdentityType import IdentityType


class SignIdentity(p.MessageType):
    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

    @classmethod
    def get_fields(cls):
github trezor / trezor-firmware / src / trezor / messages / CipheredKeyValue.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p


class CipheredKeyValue(p.MessageType):
    MESSAGE_WIRE_TYPE = 48

    def __init__(
        self,
        value: bytes = None,
    ) -> None:
        self.value = value

    @classmethod
    def get_fields(cls):
        return {
            1: ('value', p.BytesType, 0),
        }
github trezor / trezor-firmware / core / src / trezor / wire / __init__.py View on Github external
def register(mtype: int, handler: Handler, *args: Any) -> None:
    """Register `handler` to get scheduled after `mtype` message is received."""
    if isinstance(mtype, type) and issubclass(mtype, protobuf.MessageType):
        mtype = mtype.MESSAGE_WIRE_TYPE
    if mtype in workflow_handlers:
        raise KeyError
    workflow_handlers[mtype] = (handler, args)
github trezor / trezor-firmware / src / trezor / messages / MoneroOutputEntry.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p

from .MoneroRctKeyPublic import MoneroRctKeyPublic


class MoneroOutputEntry(p.MessageType):

    def __init__(
        self,
        idx: int = None,
        key: MoneroRctKeyPublic = None,
    ) -> None:
        self.idx = idx
        self.key = key

    @classmethod
    def get_fields(cls):
        return {
            1: ('idx', p.UVarintType, 0),
            2: ('key', MoneroRctKeyPublic, 0),
        }
github trezor / trezor-core / src / trezor / messages / MoneroTransactionMlsagDoneAck.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p


class MoneroTransactionMlsagDoneAck(p.MessageType):
    MESSAGE_WIRE_TYPE = 516

    def __init__(
        self,
        full_message_hash: bytes = None,
    ) -> None:
        self.full_message_hash = full_message_hash

    @classmethod
    def get_fields(cls):
        return {
            1: ('full_message_hash', p.BytesType, 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / PassphraseStateRequest.py View on Github external
# Automatically generated by pb2py
# fmt: off
import protobuf as p

if __debug__:
    try:
        from typing import Dict, List  # noqa: F401
        from typing_extensions import Literal  # noqa: F401
    except ImportError:
        pass


class PassphraseStateRequest(p.MessageType):
    MESSAGE_WIRE_TYPE = 77

    def __init__(
        self,
        state: bytes = None,
    ) -> None:
        self.state = state

    @classmethod
    def get_fields(cls) -> Dict:
        return {
            1: ('state', p.BytesType, 0),
        }