UNPKG

@fruitsjs/core

Version:

Principal package with functions and models for building Fruits Eco-Blockchain applications.

17 lines 936 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createParametersFromAttachment = void 0; const attachment_1 = require("../typings/attachment"); const createParametersFromAttachment = (attachment, params) => { if (attachment instanceof attachment_1.AttachmentEncryptedMessage) { const em = attachment; return Object.assign({ encryptedMessageData: em.data, encryptedMessageNonce: em.nonce, messageToEncryptIsText: String(em.isText) }, params); } if (attachment instanceof attachment_1.AttachmentMessage) { const m = attachment; return Object.assign({ message: m.message, messageIsText: String(m.messageIsText) }, params); } throw new Error(`Unknown attachment type: ${JSON.stringify(attachment)}`); }; exports.createParametersFromAttachment = createParametersFromAttachment; //# sourceMappingURL=createParametersFromAttachment.js.map