public TransactionPayloadLCS GetTransactionPayload(byte[] source, ref int cursor)
        {
            var retVal = new TransactionPayloadLCS();

            retVal.PayloadType = (TransactionPayloadType)Read_u32(source, ref cursor);

            if (retVal.PayloadType == TransactionPayloadType.Program)
            {
                retVal.Program = source.LCSerialization <ProgramLCS>(ref cursor);
            }
            else if (retVal.PayloadType == TransactionPayloadType.WriteSet)
            {
                retVal.WriteSet = source.LCSerialization <WriteSetLCS>(ref cursor);
            }
            else if (retVal.PayloadType == TransactionPayloadType.Script)
            {
                retVal.Script = source.LCSerialization <ScriptLCS>(ref cursor);
            }
            else if (retVal.PayloadType == TransactionPayloadType.Module)
            {
                retVal.Module = source.LCSerialization <ModuleLCS>(ref cursor);
            }

            return(retVal);
        }
        public byte[] TransactionPayloadToByte(TransactionPayloadLCS source)
        {
            var result = U32ToByte((uint)source.PayloadType);

            switch (source.PayloadType)
            {
            case TransactionPayloadType.Program:
                var pro = LCSCore.LCSDeserialization(source.Program);
                result = result.Concat(pro).ToArray();
                break;

            case TransactionPayloadType.WriteSet:
                var writeSet = LCSCore.LCSDeserialization(source.WriteSet);
                result = result.Concat(writeSet).ToArray();
                break;
            }
            return(result);
        }