@neo-one/node-protocol
Version:
NEO•ONE NEO node and consensus protocol.
37 lines (35 loc) • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterLoadPayload = void 0;
const client_common_1 = require("@neo-one/client-common");
const node_core_1 = require("@neo-one/node-core");
class FilterLoadPayload {
constructor({ filter, k, tweak }) {
this.serializeWire = client_common_1.createSerializeWire(this.serializeWireBase.bind(this));
this.filter = filter;
this.k = k;
this.tweak = tweak;
}
static deserializeWireBase({ reader }) {
const filter = reader.readVarBytesLE(36000);
const k = reader.readUInt8();
const tweak = reader.readUInt32LE();
if (k > 50) {
throw new client_common_1.InvalidFormatError(`Expected BinaryReader\'s readUInt8(0) to be less than 50. Received: ${k}`);
}
return new this({ filter, k, tweak });
}
static deserializeWire(options) {
return this.deserializeWireBase({
context: options.context,
reader: new node_core_1.BinaryReader(options.buffer),
});
}
serializeWireBase(writer) {
writer.writeVarBytesLE(this.filter);
writer.writeUInt8(this.k);
writer.writeUInt32LE(this.tweak);
}
}
exports.FilterLoadPayload = FilterLoadPayload;
//# sourceMappingURL=FilterLoadPayload.js.map