UNPKG

@signumjs/core

Version:

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

38 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.distributeToAssetHolders = void 0; const constants_1 = require("../../../constants"); const createParametersFromAttachment_1 = require("../../../internal/createParametersFromAttachment"); const signIfPrivateKey_1 = require("../../../internal/signIfPrivateKey"); /** * * Use with {@link ApiComposer} and belongs to {@link AssetApi}. * * See details at {@link AssetApi.distributeToAssetHolders} * * * @category factories */ const distributeToAssetHolders = (service) => (args) => (0, signIfPrivateKey_1.signIfPrivateKey)(service, args, async (a) => { if ((a.additionalAssetId && !a.additionalAssetQuantity) || (!a.additionalAssetId && a.additionalAssetQuantity)) { throw new Error('When given "additionalAssetId", you need to provide "additionalAssetQuantity" also, and vice-versa'); } let parameters = { asset: a.assetId, quantityMinimumQNT: a.minimumHoldQuantity || '0', amountNQT: a.totalAmountPlanck || undefined, assetToDistribute: a.additionalAssetId || undefined, quantityQNT: a.additionalAssetQuantity || undefined, feeNQT: a.feePlanck, deadline: a.deadline || constants_1.DefaultDeadline, publicKey: a.senderPublicKey, referencedTransactionFullHash: a.referencedTransactionFullHash || undefined }; if (a.attachment) { parameters = (0, createParametersFromAttachment_1.createParametersFromAttachment)(a.attachment, parameters); } return service.send('distributeToAssetHolders', parameters); }); exports.distributeToAssetHolders = distributeToAssetHolders; //# sourceMappingURL=distributeToAssetHolders.js.map