src/encoder.js
function encodeAttachmentAssetIssue(buffer, offset, attachment_data) {
    offset = buffer.writeUInt32LE(attachment_data.status, offset);
    //Encode symbol
    offset += encodeString(buffer, attachment_data.symbol, offset);
    //Encode maximum supply
    offset = bufferutils.writeUInt64LE(buffer, attachment_data.max_supply, offset);
    //Encode precision
    offset = buffer.writeUInt8(attachment_data.precision, offset);
    //Encode secondary issue threshold
    offset = buffer.writeUInt8((attachment_data.secondaryissue_threshold) ? attachment_data.secondaryissue_threshold : 0, offset);
    offset += buffer.write("0000", offset, 2, 'hex');
    //Encode issuer
    offset += encodeString(buffer, attachment_data.issuer, offset);
    //Encode recipient address
    offset += encodeString(buffer, attachment_data.address, offset);
    //Encode description
    offset += encodeString(buffer, attachment_data.description, offset);
    return offset;
}
function encodeAttachmentAssetIssue(buffer, offset, attachment_data) {
    offset = buffer.writeUInt32LE(attachment_data.status, offset);
    //Encode symbol
    offset += encodeString(buffer, attachment_data.symbol, offset);
    //Encode maximum supply
    offset = bufferutils.writeUInt64LE(buffer, attachment_data.max_supply, offset);
    //Encode precision
    offset = buffer.writeUInt8(attachment_data.precision, offset);
    //Encode secondary issue threshold
    offset = buffer.writeUInt8((attachment_data.secondaryissue_threshold) ? attachment_data.secondaryissue_threshold : 0, offset);
    offset += buffer.write("0000", offset, 2, 'hex');
    //Encode issuer
    offset += encodeString(buffer, attachment_data.issuer, offset);
    //Encode recipient address
    offset += encodeString(buffer, attachment_data.address, offset);
    //Encode description
    offset += encodeString(buffer, attachment_data.description, offset);
    return offset;
}
function encodeAttachmentAssetIssue ( buffer , offset , attachment_data ) { offset = buffer . writeUInt32LE ( attachment_data . status , offset ) ; //Encode symbol offset += encodeString ( buffer , attachment_data . symbol , offset ) ; //Encode maximum supply offset = bufferutils . writeUInt64LE ( buffer , attachment_data . max_supply , offset ) ; //Encode precision offset = buffer . writeUInt8 ( attachment_data . precision , offset ) ; //Encode secondary issue threshold offset = buffer . writeUInt8 ( ( attachment_data . secondaryissue_threshold ) ? attachment_data . secondaryissue_threshold : 0 , offset ) ; offset += buffer . write ( "0000" , offset , 2 , 'hex' ) ; //Encode issuer offset += encodeString ( buffer , attachment_data . issuer , offset ) ; //Encode recipient address offset += encodeString ( buffer , attachment_data . address , offset ) ; //Encode description offset += encodeString ( buffer , attachment_data . description , offset ) ; return offset ; }
Helper function to encode the attachment for a new asset.
@param {Buffer} buffer
@param {Number} offset
@param {Number} attachment_data
@returns {Number} New offset
@throws {Error}
Helper function to encode the attachment for a new asset .