You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

6 years ago
import 'babel-polyfill'; // eslint-disable-line import/no-unassigned-import
import escapeHTML from 'escape-html';
import {version} from '../package';
import getCoinData from './get-coin-data';
import getCoinName from './get-coin-name';
import formatSeconds from './format-seconds';
6 years ago
document.querySelector('.version').textContent = `v${version}`;
6 years ago
getCoinData().then(coins => {
const table = document.querySelector('table.results');
if(coins.length) {
table.innerHTML = `
<thead>
<td>Name</td>
<td>Market Cap</td>
<td>Proof-of-Work</td>
<td>Equivalent Confs</td>
<td>Estimated Time</td>
<td>Difference</td>
</thead>
<tbody>
${coins.map(coin => `
<tr>
<td>${escapeHTML(`${getCoinName(coin)} (${coin.symbol})`)}</td>
6 years ago
<td>${escapeHTML(coin.marketCapFormatted || 'Unknown')}</td>
<td>${escapeHTML(`${coin.algorithm} @ ${coin.hashRateFormatted}`)}</td>
6 years ago
<td>${escapeHTML(coin.confirmations.toLocaleString())} confs</td>
<td>${escapeHTML(formatSeconds(coin.estimatedTimeForConfs))}</td>
<td>${escapeHTML(coin.symbol === 'BTC' ? '-' : `${Math.round(coin.multiplier)}x slower`)}</td>
</tr>
`).join('')}
</tbody>
`;
}
});