This commit is contained in:
sairajzero 2021-06-07 14:25:06 +05:30
parent d0af4cb396
commit a00bdbda99

View File

@ -7433,19 +7433,18 @@ Bitcoin.Util = {
} }
} }
</script> </script>
<script id="floBlockchainAPI" version="2.0.1b"> <script id="floBlockchainAPI" version="2.0.1e">
/* FLO Blockchain Operator to send/receive data from blockchain using API calls*/ /* FLO Blockchain Operator to send/receive data from blockchain using API calls*/
const floBlockchainAPI = { const floBlockchainAPI = {
util: { util: {
serverList: floGlobals.apiURL[floGlobals.blockchain].slice(0), serverList: floGlobals.apiURL[floGlobals.blockchain].slice(0),
curPos: floCrypto.randInt(0, floGlobals.apiURL[floGlobals.blockchain].length), curPos: floCrypto.randInt(0, floGlobals.apiURL[floGlobals.blockchain].length - 1),
fetch_retry: function(apicall, rm_flosight) { fetch_retry: function(apicall, rm_flosight) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let i = this.serverList.indexOf(rm_flosight) let i = this.serverList.indexOf(rm_flosight)
if(i != -1) if (i != -1) this.serverList.splice(i, 1);
this.serverList.splice(i, 1); this.curPos = floCrypto.randInt(0, this.serverList.length - 1)
this.curPos = floCrypto.randInt(0, this.serverList.length)
this.fetch_api(apicall) this.fetch_api(apicall)
.then(result => resolve(result)) .then(result => resolve(result))
.catch(error => reject(error)); .catch(error => reject(error));
@ -7457,7 +7456,7 @@ Bitcoin.Util = {
reject("No floSight server working") reject("No floSight server working")
else { else {
let flosight = this.serverList[this.curPos]; let flosight = this.serverList[this.curPos];
fetch(flosight + apicall).then(response => { fetch(flosight + apicall).then(response => {
if (response.ok) if (response.ok)
response.json().then(data => resolve(data)); response.json().then(data => resolve(data));
else { else {
@ -7472,6 +7471,10 @@ Bitcoin.Util = {
}) })
} }
}) })
},
current: function() {
return this.serverList[this.curPos];
} }
}, },
@ -10094,7 +10097,7 @@ Bitcoin.Util = {
b.netValue = calcNetValue(b.BTC_base, b.startDate, b.minIpa, b.maxPeriod, b.cut, b.amount, b.USD_base) b.netValue = calcNetValue(b.BTC_base, b.startDate, b.minIpa, b.maxPeriod, b.cut, b.amount, b.USD_base)
console.info(b); console.info(b);
const obj = { const obj = {
href: `https://livenet.flocha.in/tx/${i}`, href: `${floBlockchainAPI.util.current()}tx/${i}`,
floId: b.floID, floId: b.floID,
bondStartDate: dateFormat(b.startDate), bondStartDate: dateFormat(b.startDate),
amountInvested : { amountInvested : {