Skip to content

Instantly share code, notes, and snippets.

@cryptcoin-junkey
Created September 23, 2020 09:39
Show Gist options
  • Save cryptcoin-junkey/3975861f6e605a00f231d7cbec39d00c to your computer and use it in GitHub Desktop.
Save cryptcoin-junkey/3975861f6e605a00f231d7cbec39d00c to your computer and use it in GitHub Desktop.
const axiosBase = require('axios');
const BURN_START_MAINNET = 1165699
const BURN_END_MAINNET = 1179440
const axios = axiosBase.create({
baseURL: 'https://mpchain.info/api/burns',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
},
responseType: 'json'
});
const wait = async (msec) => new Promise(resolve => setTimeout(resolve, msec));
const main = async () => {
for(let i = 1158657; i <= 1158694; i++) {
await show(i);
}
for(let i = BURN_START_MAINNET; i < BURN_END_MAINNET; i++) {
await show(i);
}
};
const show = async (i) => {
let res;
do {
res = await axios.get('/' + i);
} while (res === undefined || res.data === undefined || res.data.data == undefined);
const data = res.data;
if (data.total === 0) return;
data.data.forEach(o => console.log(
[ o.tx_index,
o.tx_hash,
o.block_index,
o.source,
o.burned,
o.status === 'valid' ? o.burned : 0,
o.earned
].join(',')))
};
console.log('tx_index,tx_hash,block_index,source,sent,burned,earned');
main().then().catch(console.error);
{
"name": "burns",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.20.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment