1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-26 20:38:56 +01:00
js-bigchaindb-driver/dist/node/transaction/makeOutput.js
Tim Daubenschütz d6f6667552 Rebuild
2017-05-11 11:45:08 +02:00

24 lines
812 B
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = makeOutput;
/**
* @public
* Create an Output from a Condition.
* Note: Assumes the given Condition was generated from a single public key (e.g. a Ed25519 Condition)
* @param {object} condition Condition (e.g. a Ed25519 Condition from `makeEd25519Condition()`)
* @param {number} amount Amount of the output
* @returns {object} An Output usable in a Transaction
*/
function makeOutput(condition) {
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
return {
amount: amount,
condition: condition,
'public_keys': condition.details.hasOwnProperty('public_key') ? [condition.details.public_key] : []
};
}
module.exports = exports['default'];