update and relocate script files

This commit is contained in:
sairajzero 2023-07-06 17:51:50 +05:30
parent fe627c59b7
commit c092273808
10 changed files with 11 additions and 14759 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
'use strict';
(function (EXPORTS) { //floExchangeAPI v1.2.0
(function (EXPORTS) { //floExchangeAPI v1.2.0a
const exchangeAPI = EXPORTS;
const DEFAULT = {
@ -1731,19 +1731,20 @@
if (typeof nodes !== 'object' || nodes === null)
throw Error('nodes must be an object')
else
lastTx = parseInt(localStorage.getItem(_l('lastTx'))) || 0;
lastTx = localStorage.getItem(_l('lastTx'));
} catch (error) {
nodes = {};
trusted = new Set();
assets = new Set();
tags = new Set();
lastTx = 0;
}
floBlockchainAPI.readData(DEFAULT.marketID, {
ignoreOld: lastTx,
sentOnly: true,
pattern: DEFAULT.marketApp
}).then(result => {
var query_options = { sentOnly: true, pattern: DEFAULT.marketApp };
if (typeof lastTx == 'string' && /^[0-9a-f]{64}/i.test(lastTx))//lastTx is txid of last tx
query_options.after = lastTx;
else if (!isNaN(lastTx))//lastTx is tx count (*backward support)
query_options.ignoreOld = parseInt(lastTx);
floBlockchainAPI.readData(DEFAULT.marketID, query_options).then(result => {
result.data.reverse().forEach(data => {
var content = JSON.parse(data)[DEFAULT.marketApp];
//Node List
@ -1782,7 +1783,7 @@
tags.add(t);
}
});
localStorage.setItem(_l('lastTx'), result.totalTxs);
localStorage.setItem(_l('lastTx'), result.lastItem);
localStorage.setItem(_l('nodes'), JSON.stringify(nodes));
localStorage.setItem(_l('trusted'), Array.from(trusted).join(","));
localStorage.setItem(_l('assets'), Array.from(assets).join(","));
@ -1910,4 +1911,4 @@
}
}
})('object' === typeof module ? module.exports : window.floExchangeAPI = {});
})('object' === typeof module ? module.exports : window.floExchangeAPI = {});