const pushtxScript = { processedSchedTxs: new Set(), initPage: function() { // Refresh PushTx status setInterval(() => {this.refreshPushTxStatus()}, 60000) // Refresh ScheduledTxs list setInterval(() => {this.refreshScheduledTxsList()}, 60000) }, preparePage: function() { this.refreshPushTxStatus() this.refreshScheduledTxsList() }, refreshPushTxStatus: function() { lib_msg.displayMessage('Loading PushTx status info...'); lib_api.getPushtxStatus().then(pushTxStatus => { if (pushTxStatus) { const data = pushTxStatus['data'] const uptime = lib_cmn.timePeriod(data['uptime']) $('#pushed-uptime').text(uptime) $('#pushed-count').text(data['push']['count']) $('#pushed-amount').text(data['push']['amount']) lib_msg.cleanMessagesUi() } }).catch(e => { $('#pushed-uptime').text('-') $('#pushed-count').text('-') $('#pushed-amount').text('-') lib_msg.displayErrors(lib_msg.extractJqxhrErrorMsg(e)) console.log(e) }) }, refreshScheduledTxsList: function() { lib_msg.displayMessage('Loading PushTx orchestrator status info...'); lib_api.getOrchestratorStatus().then(orchestrStatus => { if(orchestrStatus) { const data = orchestrStatus['data'] for (let tx of data['txs']) { if (!this.processedSchedTxs.has(tx['schTxid'])) { this.displayScheduledTx(tx) this.processedSchedTxs.add(tx['schTxid']) } } lib_msg.cleanMessagesUi() } }).catch(e => { lib_msg.displayErrors(lib_msg.extractJqxhrErrorMsg(e)) console.log(e) }) }, displayScheduledTx: function(tx) { const newRow = `
${tx['schRaw']}