From dc19a4e56570d6fc3e372f61b63382757a2b5690 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Tue, 16 Aug 2022 17:30:46 +0530 Subject: [PATCH] Bug fixes: floBlockchainAPI and lib.js --- floBlockchainAPI.js | 14 +++++++------- lib.js | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/floBlockchainAPI.js b/floBlockchainAPI.js index 8cf3a79..d250f86 100644 --- a/floBlockchainAPI.js +++ b/floBlockchainAPI.js @@ -1,4 +1,4 @@ -(function(EXPORTS) { //floBlockchainAPI v2.3.3a +(function(EXPORTS) { //floBlockchainAPI v2.3.3b /* FLO Blockchain Operator to send/receive data from blockchain using API calls*/ 'use strict'; const floBlockchainAPI = EXPORTS; @@ -6,7 +6,7 @@ const DEFAULT = { blockchain: floGlobals.blockchain, apiURL: { - FLO: ['https://livenet.flocha.in/', 'https://flosight.duckdns.org/'], + FLO: ['https://flosight.duckdns.org/'], FLO_TEST: ['https://testnet-flosight.duckdns.org', 'https://testnet.flocha.in/'] }, sendAmt: 0.001, @@ -49,7 +49,7 @@ const allServerList = new Set(floGlobals.apiURL && floGlobals.apiURL[DEFAULT.blockchain] ? floGlobals.apiURL[DEFAULT.blockchain] : DEFAULT.apiURL[DEFAULT.blockchain]); var serverList = Array.from(allServerList); - var curPos = floCrypto.randInt(0, serverList - 1); + var curPos = floCrypto.randInt(0, serverList.length - 1); function fetch_retry(apicall, rm_flosight) { return new Promise((resolve, reject) => { @@ -371,18 +371,18 @@ }) //Calculate totalSentAmount and check if totalBalance is sufficient let totalSendAmt = totalFee; - for (floID in receivers) + for (let floID in receivers) totalSendAmt += receivers[floID]; if (totalBalance < totalSendAmt) return reject("Insufficient total Balance"); //Get the UTXOs of the senders let promises = []; - for (floID in senders) + for (let floID in senders) promises.push(promisedAPI(`api/addr/${floID}/utxo`)); Promise.all(promises).then(results => { let wifSeq = []; var trx = bitjs.transaction(); - for (floID in senders) { + for (let floID in senders) { let utxos = results.shift(); let sendAmt; if (preserveRatio) { @@ -406,7 +406,7 @@ if (change > 0) trx.addoutput(floID, change); } - for (floID in receivers) + for (let floID in receivers) trx.addoutput(floID, receivers[floID]); trx.addflodata(floData.replace(/\n/g, ' ')); for (let i = 0; i < wifSeq.length; i++) diff --git a/lib.js b/lib.js index 1ae4ca2..6fc8af8 100644 --- a/lib.js +++ b/lib.js @@ -1,4 +1,4 @@ -(function(GLOBAL) { //lib v1.3.0c +(function(GLOBAL) { //lib v1.3.0d 'use strict'; /* Utility Libraries required for Standard operations * All credits for these codes belong to their respective creators, moderators and owners. @@ -4782,8 +4782,8 @@ } else if (floDataCount < 253) { floDataCountString = floDataCount.toString(16); } else if (floDataCount <= 1040) { - floDataCountAdjusted = (floDataCount - 253) + parseInt("0xfd00fd"); - floDataCountStringAdjusted = floDataCountAdjusted.toString(16); + let floDataCountAdjusted = (floDataCount - 253) + parseInt("0xfd00fd"); + let floDataCountStringAdjusted = floDataCountAdjusted.toString(16); floDataCountString = floDataCountStringAdjusted.substr(0, 2) + floDataCountStringAdjusted.substr(4, 2) + floDataCountStringAdjusted.substr(2, 2); } else { floDataCountString = "Character Limit Exceeded";