コード例 #1
0
    def FromByteArray(data):
        stream = StreamManager.GetStream(data=data)
        reader = BinaryReader(stream)

        etype = reader.ReadVarString().decode('utf-8')
        reader.stream.seek(0)

        if etype == SmartContractEvent.RUNTIME_NOTIFY:
            event = NotifyEvent(None, None, None, None, None)
        else:
            event = SmartContractEvent(None, None, None, None, None)

        event.Deserialize(reader)
        StreamManager.ReleaseStream(stream)
        return event
コード例 #2
0
    def Deserialize(self, reader: BinaryReader):
        """
        Deserialize full object.

        Args:
            reader (neocore.IO.BinaryReader):
        """

        self.Type = StateType(reader.ReadByte())

        self.Key = reader.ReadVarBytes(max=100)
        self.Field = reader.ReadVarString(max=32).decode('utf-8')
        self.Value = reader.ReadVarBytes(max=65535)

        if self.Type == StateType.Account:
            self.CheckAccountState()
        elif self.Type == StateType.Validator:
            self.CheckValidatorState()