UNPKG

@signumjs/core

Version:

Principal package with functions and models for building Signum Network applications.

34 lines 1.19 kB
"use strict"; /** @ignore */ /** @internal */ Object.defineProperty(exports, "__esModule", { value: true }); exports.createParametersFromAttachment = void 0; const attachment_1 = require("../typings/attachment"); /** * Creates send parameters for a transaction from attachment data * * @internal * @param attachment The attachment * @param params Any object * @return HttpParams */ const createParametersFromAttachment = (attachment, params) => { if (attachment instanceof attachment_1.AttachmentEncryptedMessage) { return { encryptedMessageData: attachment.data, encryptedMessageNonce: attachment.nonce, messageToEncryptIsText: String(attachment.isText), ...params }; } if (attachment instanceof attachment_1.AttachmentMessage) { return { message: attachment.message, messageIsText: String(attachment.messageIsText), ...params }; } throw new Error(`Unknown attachment type: ${JSON.stringify(attachment)}`); }; exports.createParametersFromAttachment = createParametersFromAttachment; //# sourceMappingURL=createParametersFromAttachment.js.map