Created
May 1, 2021 16:43
-
-
Save OrderAndCh4oS/dc732a6e546e3fa735b3ee6d33b40da5 to your computer and use it in GitHub Desktop.
hicetnunc update _block_levels lookup obj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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¶meter.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