Skip to content

packages.valory.skills.abstract_round_abci.serializer

Serialize nested dictionaries to bytes using google.protobuf.Struct.

Prerequisites: - All keys must be of type: str - Values must be of type: bool, int, float, str, bytes, dict - Strings must be unicode, as google.protobuf.Struct does not support bytes

The following encoding is required and performed, and sentinel values are added for decoding: - bytes to string - integer to string

to_bytes

def to_bytes(data: Dict[str, Any]) -> bytes

Serialize to bytes using protobuf. Adds extra data for type-casting.

from_bytes

def from_bytes(buffer: bytes) -> Dict[str, Any]

Deserialize patched-up python dict from protobuf bytes.

patch

def patch(data: Dict[str, Any]) -> Dict[str, Any]

Patch for protobuf serialization. In-place operation.

unpatch

def unpatch(data: Dict[str, Any]) -> Dict[str, Any]

Unpatch for protobuf deserialization. In-place operation.

DictProtobufStructSerializer Objects

class DictProtobufStructSerializer()

Class to keep backwards compatibility

Back to top