|
|
@@ -6,6 +6,7 @@ const API_PREFIX = "https://blockstream.info/api"; |
|
|
|
|
|
|
|
const IRON_BLOCK = "https://gamepedia.cursecdn.com/minecraft_gamepedia/7/7e/Block_of_Iron_JE4_BE3.png?version=692673bafa1e94785ab6012d7a3c8dc4"; |
|
|
|
const GOLD_BLOCK = "https://gamepedia.cursecdn.com/minecraft_gamepedia/7/72/Block_of_Gold_JE6_BE3.png?version=9d1a63c717df80feffa9ec93ebceb014"; |
|
|
|
const DIAMOND_BLOCK = "https://gamepedia.cursecdn.com/minecraft_gamepedia/6/6b/Block_of_Diamond_JE6_BE3.png?version=117daf438c2ddfff59bab05d5715f6d2"; |
|
|
|
|
|
|
|
var nextHalvingHeight = 630000; |
|
|
|
|
|
|
@@ -52,11 +53,11 @@ function calcRenderedSatQty(sats, decimals) { |
|
|
|
let btc = (sats - subBtc) / 100000000; |
|
|
|
|
|
|
|
let maskModulus = 10 ** (8 - decimals); |
|
|
|
let subDecimalRem = subBtc % maskModulus; |
|
|
|
let decimal = (subBtc - subDecimalRem) / maskModulus; |
|
|
|
let subDecimal = (subBtc - (subBtc % maskModulus)) / maskModulus; |
|
|
|
let decimal = "0".repeat(decimals) + subDecimal.toString(); |
|
|
|
|
|
|
|
if (decimal != 0) { |
|
|
|
return btc.toString() + "." + decimal.toString(); |
|
|
|
return btc.toString() + "." + decimal.substr(decimals * -1); |
|
|
|
} else { |
|
|
|
return btc.toString(); |
|
|
|
} |
|
|
@@ -127,9 +128,9 @@ function makeBlockElem(block, prevBlock) { |
|
|
|
iconElem.classList.add("blbicon"); |
|
|
|
iconCtr.appendChild(iconElem); |
|
|
|
if (block.height % HALVING_PERIOD == 0) { |
|
|
|
iconElem.src = GOLD_BLOCK; |
|
|
|
iconElem.src = DIAMOND_BLOCK; |
|
|
|
} else { |
|
|
|
iconElem.src = IRON_BLOCK; |
|
|
|
iconElem.src = GOLD_BLOCK; |
|
|
|
} |
|
|
|
|
|
|
|
// Element for all the data. |