static Serialize(msg, isTest = false) {
        const buf = new util_1.default.Writer();
        // Write OP_RETURN op code
        buf.uint8(OP_RETURN);
        const protocolId = isTest ? OpReturnMessage.TestProtocolID : OpReturnMessage.ProtocolID;
        // Write protocol Id push op code
        buf.write(PushDataScript(protocolId.length));
        // Write protocol Id
        buf.write(Buffer.from(protocolId, 'ascii'));
        const payload = msg.Serialize();
        // Write push op code for payload length + 3 for version and message type code
        buf.write(PushDataScript(payload.length + 3));
        // Write version
        buf.uint8(OpReturnMessage.Version);
        // Write message type code
        buf.write(Buffer.from(msg.Type(), 'ascii'));
        // Write payload
        buf.write(payload);
        return buf.buf;
    }
// Serialize returns a complete op return script including the specified payload.
Serialize returns a complete op return script including the specified payload.
Serialize returns a complete op return script including the specified payload .
static Serialize(msg, isTest = false) {
        const buf = new util_1.default.Writer();
        buf.uint8(OP_RETURN);
        const protocolId = isTest ? OpReturnMessage.TestProtocolID : OpReturnMessage.ProtocolID;
        buf.write(PushDataScript(protocolId.length));
        buf.write(Buffer.from(protocolId, 'ascii'));
        const payload = msg.Serialize();
        buf.write(PushDataScript(payload.length + 3));
        buf.uint8(OpReturnMessage.Version);
        buf.write(Buffer.from(msg.Type(), 'ascii'));
        buf.write(payload);
        return buf.buf;
    }
static Serialize ( msg , isTest = false ) { const buf = new util_1 . default . Writer ( ) ; buf . uint8 ( OP_RETURN ) ; const protocolId = isTest ? OpReturnMessage . TestProtocolID : OpReturnMessage . ProtocolID ; buf . write ( PushDataScript ( protocolId . length ) ) ; buf . write ( Buffer . from ( protocolId , 'ascii' ) ) ; const payload = msg . Serialize ( ) ; buf . write ( PushDataScript ( payload . length + 3 ) ) ; buf . uint8 ( OpReturnMessage . Version ) ; buf . write ( Buffer . from ( msg . Type ( ) , 'ascii' ) ) ; buf . write ( payload ) ; return buf . buf ; }
Serialize returns a complete op return script including the specified payload.
Serialize returns a complete op return script including the specified payload .
// Write OP_RETURN op code // Write protocol Id push op code // Write protocol Id // Write push op code for payload length + 3 for version and message type code // Write version // Write message type code // Write payload