Skip to content

Instantly share code, notes, and snippets.

@OrderAndCh4oS
Created May 1, 2021 16:43
Show Gist options
  • Save OrderAndCh4oS/dc732a6e546e3fa735b3ee6d33b40da5 to your computer and use it in GitHub Desktop.
Save OrderAndCh4oS/dc732a6e546e3fa735b3ee6d33b40da5 to your computer and use it in GitHub Desktop.
hicetnunc update _block_levels lookup obj
import fetch from 'node-fetch';
import fs from 'fs';
const blockLevels = {
0: 1365242
};
let tokenId = 1000;
while(true) {
const response = await fetch(`https://api.tzkt.io/v1/operations/transactions?target=KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton&entrypoint=mint&status=applied&parameter.token_id=${tokenId}`);
const data = await response.json();
if(!data.length) break;
blockLevels[tokenId] = data[0].level
tokenId += 1000;
}
fs.writeFileSync('./block-levels.json', JSON.stringify(blockLevels));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment