From e3222c853aecb41f77e1a5bf4aecef9aa3e044c4 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 13 Apr 2017 14:57:12 -0400 Subject: [PATCH] fix merge --- ui/js/lbry.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ui/js/lbry.js b/ui/js/lbry.js index ef6f6a67c..e7ca23c23 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -198,24 +198,26 @@ lbry.getPeersForBlobHash = function(blobHash, callback) { }); } +/** + * Takes a LBRY URI; will first try and calculate a total cost using + * Lighthouse. If Lighthouse can't be reached, it just retrives the + * key fee. + * + * Returns an object with members: + * - cost: Number; the calculated cost of the name + * - includes_data: Boolean; indicates whether or not the data fee info + * from Lighthouse is included. + */ lbry.getCostInfo = function(lbryUri) { - /** - * Takes a LBRY URI; will first try and calculate a total cost using - * Lighthouse. If Lighthouse can't be reached, it just retrives the - * key fee. - * - * Returns an object with members: - * - cost: Number; the calculated cost of the name - * - includes_data: Boolean; indicates whether or not the data fee info - * from Lighthouse is included. - */ - if (!lbryUri) { - throw new Error(`URI required.`); - } return new Promise((resolve, reject) => { + + if (!lbryUri) { + reject(new Error(`URI required.`)); + } + function getCost(lbryUri, size) { lbry.stream_cost_estimate({uri: lbryUri, ... size !== null ? {size} : {}}).then((cost) => { - callback({ + resolve({ cost: cost, includesData: size !== null, });