How to use the protobuf.EnumType 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 / core / src / trezor / messages / TxInputType.py View on Github external
def get_fields(cls) -> Dict:
        return {
            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.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0),  # default=SPENDADDRESS
            7: ('multisig', MultisigRedeemScriptType, 0),
            8: ('amount', p.UVarintType, 0),
            9: ('decred_tree', p.UVarintType, 0),
            10: ('decred_script_version', p.UVarintType, 0),
            11: ('prev_block_hash_bip115', p.BytesType, 0),
            12: ('prev_block_height_bip115', p.UVarintType, 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / RecoveryDevice.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('word_count', p.UVarintType, 0),
            2: ('passphrase_protection', p.BoolType, 0),
            3: ('pin_protection', p.BoolType, 0),
            4: ('language', p.UnicodeType, 0),  # default=en-US
            5: ('label', p.UnicodeType, 0),
            6: ('enforce_wordlist', p.BoolType, 0),
            8: ('type', p.EnumType("RecoveryDeviceType", (0, 1)), 0),
            9: ('u2f_counter', p.UVarintType, 0),
            10: ('dry_run', p.BoolType, 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / SignMessage.py View on Github external
def get_fields(cls) -> Dict:
        return {
            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.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0),  # default=SPENDADDRESS
        }
github trezor / trezor-firmware / core / src / trezor / messages / TezosBallotOp.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('source', p.BytesType, 0),
            2: ('period', p.UVarintType, 0),
            3: ('proposal', p.BytesType, 0),
            4: ('ballot', p.EnumType("TezosBallotType", (0, 1, 2)), 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / SdProtect.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('operation', p.EnumType("SdProtectOperationType", (0, 1, 2)), 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / GetAddress.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
            2: ('coin_name', p.UnicodeType, 0),  # default=Bitcoin
            3: ('show_display', p.BoolType, 0),
            4: ('multisig', MultisigRedeemScriptType, 0),
            5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0),  # default=SPENDADDRESS
        }
github trezor / trezor-firmware / core / src / trezor / messages / TxOutputType.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('address', p.UnicodeType, 0),
            2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
            3: ('amount', p.UVarintType, 0),  # required
            4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0),  # required
            5: ('multisig', MultisigRedeemScriptType, 0),
            6: ('op_return_data', p.BytesType, 0),
            7: ('decred_script_version', p.UVarintType, 0),
            8: ('block_hash_bip115', p.BytesType, 0),
            9: ('block_height_bip115', p.UVarintType, 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / ApplySettings.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('language', p.UnicodeType, 0),
            2: ('label', p.UnicodeType, 0),
            3: ('use_passphrase', p.BoolType, 0),
            4: ('homescreen', p.BytesType, 0),
            5: ('passphrase_source', p.EnumType("PassphraseSourceType", (0, 1, 2)), 0),
            6: ('auto_lock_delay_ms', p.UVarintType, 0),
            7: ('display_rotation', p.UVarintType, 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / OntologyTransfer.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('asset', p.EnumType("OntologyAsset", (1, 2)), 0),
            2: ('amount', p.UVarintType, 0),
            3: ('from_address', p.UnicodeType, 0),
            4: ('to_address', p.UnicodeType, 0),
        }
github trezor / trezor-firmware / core / src / trezor / messages / NEMMosaicSupplyChange.py View on Github external
def get_fields(cls) -> Dict:
        return {
            1: ('namespace', p.UnicodeType, 0),
            2: ('mosaic', p.UnicodeType, 0),
            3: ('type', p.EnumType("NEMSupplyChangeType", (1, 2)), 0),
            4: ('delta', p.UVarintType, 0),
        }