UNPKG

@neo-one/node-protocol

Version:

NEO•ONE NEO node and consensus protocol.

34 lines (32 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InvPayload = void 0; const client_common_1 = require("@neo-one/client-common"); const node_core_1 = require("@neo-one/node-core"); const InventoryType_1 = require("./InventoryType"); class InvPayload { constructor({ type, hashes }) { this.serializeWire = client_common_1.createSerializeWire(this.serializeWireBase.bind(this)); this.type = type; this.hashes = hashes; } static deserializeWireBase({ reader }) { const type = InventoryType_1.assertInventoryType(reader.readUInt8()); const hashes = reader.readArray(() => reader.readUInt256()); return new this({ type, hashes }); } static deserializeWire(options) { return this.deserializeWireBase({ context: options.context, reader: new node_core_1.BinaryReader(options.buffer), }); } serializeWireBase(writer) { writer.writeUInt8(this.type); writer.writeArray(this.hashes, (value) => { writer.writeUInt256(value); }); } } exports.InvPayload = InvPayload; //# sourceMappingURL=InvPayload.js.map