floExchangeAPI v1.2.0a

- Minor fix in reading stored lastTx
This commit is contained in:
sairajzero 2023-07-05 16:24:23 +05:30
parent c1bbac92ea
commit 419c1b5b3c

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
(function (EXPORTS) { //floExchangeAPI v1.2.0 (function (EXPORTS) { //floExchangeAPI v1.2.0a
const exchangeAPI = EXPORTS; const exchangeAPI = EXPORTS;
const DEFAULT = { const DEFAULT = {
@ -1731,13 +1731,12 @@
if (typeof nodes !== 'object' || nodes === null) if (typeof nodes !== 'object' || nodes === null)
throw Error('nodes must be an object') throw Error('nodes must be an object')
else else
lastTx = parseInt(localStorage.getItem(_l('lastTx'))) || 0; lastTx = localStorage.getItem(_l('lastTx'));
} catch (error) { } catch (error) {
nodes = {}; nodes = {};
trusted = new Set(); trusted = new Set();
assets = new Set(); assets = new Set();
tags = new Set(); tags = new Set();
lastTx = undefined;
} }
var query_options = { sentOnly: true, pattern: DEFAULT.marketApp }; var query_options = { sentOnly: true, pattern: DEFAULT.marketApp };
@ -1784,7 +1783,7 @@
tags.add(t); 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('nodes'), JSON.stringify(nodes));
localStorage.setItem(_l('trusted'), Array.from(trusted).join(",")); localStorage.setItem(_l('trusted'), Array.from(trusted).join(","));
localStorage.setItem(_l('assets'), Array.from(assets).join(",")); localStorage.setItem(_l('assets'), Array.from(assets).join(","));