import { BufferReader , BufferWriter } from "@node-lightning/bufio" ; import { MessageType } from "../MessageType" ; import { IWireMessage } from "./IWireMessage" ; export class ReplyShortChannelIdsEndMessage implements IWireMessage { public static deserialize ( payload ) { const instance = new ReplyShortChannelIdsEndMessage ( ) ; const reader = new BufferReader ( payload ) ; reader . readUInt16BE ( ) ; instance . chainHash = reader . readBytes ( 32 ) ; instance . complete = reader . readUInt8 ( ) === 1 ; return instance ; } public type : MessageType = MessageType . ReplyShortChannelIdsEnd ; public chainHash : Buffer ; public complete : boolean ; public serialize ( ) { const len = 2 + 32 + 1 ; const writer = new BufferWriter ( Buffer . alloc ( len ) ) ; writer . writeUInt16BE ( this . type ) ; writer . writeBytes ( this . chainHash ) ; writer . writeUInt8 ( this . complete ? 1 : 0 ) ; return writer . toBuffer ( ) ; } }