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.
 
 
 
 
 
 

30 lines
721 B

getchain();
function getchain() {
let promised = fetch(api_url + 'getchain').
then(resp => resp.json()).
then(obj => {
let elem = document.getElementById('json');
elem.innerText = JSON.stringify(obj);
let list = '<pre>';
for (let bh of obj.chain) {
console.log('getchain.bh:',bh);
let blk_url = api_url + `getblock?hash=${bh}`;
list += `<a href="${blk_url}">${bh}</a>\n`
}
list += '</pre>';
elem = document.getElementById('list');
elem.innerHTML = list;
return obj;
}).
catch(console.error);
promised.then(obj => { console.log('obj:',obj); return obj; });
}
// ----------------------------------------------------
console.log('chain.js loaded');