@node-lightning/wire
Version:
Lightning Network Wire Protocol
31 lines • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReplyShortChannelIdsEndMessage = void 0;
const bufio_1 = require("@node-lightning/bufio");
const MessageType_1 = require("../MessageType");
class ReplyShortChannelIdsEndMessage {
constructor() {
this.type = MessageType_1.MessageType.ReplyShortChannelIdsEnd;
}
static deserialize(payload) {
const instance = new ReplyShortChannelIdsEndMessage();
const reader = new bufio_1.BufferReader(payload);
// read type bytes
reader.readUInt16BE();
instance.chainHash = reader.readBytes(32);
instance.complete = reader.readUInt8() === 1;
return instance;
}
serialize() {
const len = 2 + // type
32 + // chain_hash
1; // complete
const writer = new bufio_1.BufferWriter(Buffer.alloc(len));
writer.writeUInt16BE(this.type);
writer.writeBytes(this.chainHash);
writer.writeUInt8(this.complete ? 1 : 0);
return writer.toBuffer();
}
}
exports.ReplyShortChannelIdsEndMessage = ReplyShortChannelIdsEndMessage;
//# sourceMappingURL=ReplyShortChannelIdsEndMessage.js.map