"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cWrappedRespVersion = void 0;
exports.serializeWrappedResp = serializeWrappedResp;
exports.deserializeWrappedResp = deserializeWrappedResp;
const TypeIdentifierEnum_1 = require("./enum/TypeIdentifierEnum");
exports.cWrappedRespVersion = 1;
function serializeWrappedResp(stream, obj, root = false) {
    if (root) {
        stream.writeUInt16(TypeIdentifierEnum_1.TypeIdentifierEnum.cWrappedResp);
    }
    stream.writeUInt8(exports.cWrappedRespVersion);
    stream.writeBuffer(obj.payload);
}
function deserializeWrappedResp(stream) {
    const version = stream.readUInt8();
    if (version > exports.cWrappedRespVersion) {
        throw new Error('WrappedResp version mismatch');
    }
    const payload = stream.readBuffer();
    const obj = {
        payload,
    };
    return obj;
}
//# sourceMappingURL=WrappedResp.js.map