diff --git a/explorer/htm/BeamExplorer.htm b/explorer/htm/BeamExplorer.htm index da83c10aa7..fce509e88f 100644 --- a/explorer/htm/BeamExplorer.htm +++ b/explorer/htm/BeamExplorer.htm @@ -827,7 +827,7 @@ vertical-align: bottom; margin: 5px 10px 0px 0px; } - .nodeURL { /* General style for URLs */ + .nodeURL { /* General style for node URLs */ font-family: "Lucida Console", ui-monospace, monospace; font-size: 1.2rem; color: var(--color_node_url); @@ -835,6 +835,9 @@ white-space: nowrap; cursor: text; } + .dataTable .nodeURL { /* Special case of node URLs in tables */ + color: unset; + } label.nodeURL { /* To show it's clickable */ cursor: pointer; } @@ -1896,6 +1899,8 @@

Beam Smart Explorer v0.8.3

| Smart Contracts | + Atomic Swaps + | Historical blocks
@@ -2089,7 +2094,7 @@

Loading.. let d = new Date(); // Get current local date and time const diff = (zone == 'local') ? d.getTimezoneOffset() : 0 ; // If needed, get difference between local time and UTC d = new Date((time - diff * 60) * 1000); // Get date object from miliseconds - const iso = d.toISOString(); // Convert to ISO format YYYY-MM-DDTHH:MM:SS.OOOZ + const iso = d.toISOString(); // Convert to ISO format YYYY-MM-DDTHH:MM:SS.OOOZ const txt = g_IsPos ? iso.replace(/(.*)T(.*)\.([0-9]+)Z/, '$1 $2.$3') : // Convert to simple format YYYY-MM-DD HH:MM:SS.ZZZ iso.replace(/(.*)T(.*)\..*/,'$1 $2'); // Convert to simple format YYYY-MM-DD HH:MM:SS @@ -2790,7 +2795,7 @@

About

const peer = peers[i]; text += ''; text += MakeCellRA(i + 1); - text += MakeCell(peer.ip || (typeof peer === 'string' ? peer : String(peer))); + text += MakeCell(AddClass(peer.ip || (typeof peer === 'string' ? peer : String(peer)), "nodeURL")); text += ''; } } @@ -2799,6 +2804,38 @@

About

SetContent(text); } + function DisplayAtomicSwaps() { + const jData = JSON.parse(this.responseText); + + let text = '

Atomic Swaps

'; + if (jData.length === 0) { + text += '

There are currently no offers for Atomic Swaps.

'; + } else { + text += MakeCollapsibleBegin('Offers (' + jData.length + ')'); + text += '
' + Obj2Html(jData) + '
'; + text += MakeCollapsibleEnd(); + text += MakeCollapsibleBegin('Totals'); + text += '

Loading...

'; + text += MakeCollapsibleEnd(); + } + + SetContent(text); + + // Get Atomic Swap totals (new node request) + if (jData.length !== 0) { + const xmlhttp = new XMLHttpRequest(); + xmlhttp.onload = DisplayAtomicSwapTotals; + xmlhttp.open('GET', urlPrefix + 'swap_totals' + '?exp_am=1'); + xmlhttp.send(); + } + } + + function DisplayAtomicSwapTotals() { // Query node for Atomic Swap totals and display them in existing 'div' + const jData = JSON.parse(this.responseText); + let text = Obj2Html(jData); + document.getElementById('divSwapTotals').innerHTML = text; + } + function DisplayHistoricalBlocks() { let text = `

Special historical blocks in Beam's mainnet

`; text += ` @@ -3206,15 +3243,14 @@

About

g_height = 0; urlSuffix += '&height=' + g_height; xmlhttp.onload = DisplayBlock; - } + // Option to query and display the details of multiple blocks (NOT USED HERE) - // else if (g_type == 'blocks') // Arguments for 'blocks': height, n - // { - // if (!g_n) { g_n = 5 } - // urlSuffix += '&height=' + g_height + '&n=' + g_n; - // xmlhttp.onload = DisplayBlocks; // Display function to be done... - // } - else if (g_type == 'contract') { // Arguments for 'contract': id, hMin, hMax, nMaxTxs + //} else if (g_type == 'blocks') { // Arguments for 'blocks': height, n + // if (!g_n) { g_n = 5 } + // urlSuffix += '&height=' + g_height + '&n=' + g_n; + // xmlhttp.onload = DisplayBlocks; // Display function to be done... + + } else if (g_type == 'contract') { // Arguments for 'contract': id, hMin, hMax, nMaxTxs urlSuffix += '&id=' + g_id + '&nMaxTxs=' + g_nMaxTxs; if (g_hMin) { urlSuffix += '&hMin=' + g_hMin } if (g_hMax) { urlSuffix += '&hMax=' + g_hMax } @@ -3237,6 +3273,10 @@

About

} else if (g_type == 'peers') { // Arguments for 'peers': (none) xmlhttp.onload = DisplayPeers; + } else if (g_type == 'swap_offers') { // Arguments for 'swap_offers': (none) + xmlhttp.onload = DisplayAtomicSwaps; + // Remark: The query for 'swap_totals' is made from within the 'DisplayAtomicSwaps' function. + } else { g_type = 'status'; // Arguments for 'status': (none) xmlhttp.onload = DisplayStatus;