Minor fix

- Fix bug in exchange API module
This commit is contained in:
sairajzero 2022-10-30 02:23:14 +05:30
parent e3f48405c5
commit cb523b107e
2 changed files with 17 additions and 4 deletions

View File

@ -25,7 +25,6 @@
<script>
function onLoadStartUp() {
floExchangeAPI.init().then(result => {
console.debug(result)
compactIDB.initDB(floGlobals.application, {
bonds: {},
closings: {},
@ -2125,7 +2124,19 @@
async function renderBondClosingData(data){
for(let i in data){
let b = blockchainBond.parse.end(data[i]);
//TODO render bond closing (should be mapped with bond details that were rendered)
/*TODO: UI: render bond closing
Note: should be mapped with bond details that were rendered
if closed, netVal shoud not be displayed
b -> Object {
bondID: id of the bond closed (map to var i in renderBondData's loop)
BTC_net: BTC value at closing date
endDate: closing date
amountFinal: amount at closing
payment_refRef: if amount if withdrawn by token system, txid of token transfer
USD_net: USD value at closing date
refSign: user signature for closing (hidden)
}
*/
}
}
@ -2142,7 +2153,6 @@
compactIDB.readAllData("bonds").then(result => {
renderBondData(result);
compactIDB.readAllData('closings').then(result => {
//TODO:
renderBondClosingData(result);
showPage('home_page')
}).catch(error => console.error(error))

View File

@ -473,6 +473,9 @@
adminID: {
get: () => DEFAULT.marketID
},
application: {
get: () => DEFAULT.marketApp
},
nodeList: {
get: () => {
if (Array.isArray(nodeList))
@ -488,7 +491,7 @@
let curPos = fetch_api.curPos || 0;
if (curPos >= nodeList.length)
return reject(ExchangeError(ExchangeError.NODES_OFFLINE_CODE, 'No Node online! Refresh the page or try again later', errorCode.NODES_OFFLINE));
let url = "http://" + nodeURL[nodeList[curPos]];
let url = "https://" + nodeURL[nodeList[curPos]];
(options ? fetch(url + api, options) : fetch(url + api))
.then(result => resolve(result)).catch(error => {
console.warn(nodeList[curPos], 'is offline');