Bug fixes: floBlockchainAPI and lib.js
This commit is contained in:
parent
f0a4837222
commit
dc19a4e565
@ -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++)
|
||||
|
||||
6
lib.js
6
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";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user