Last active
December 9, 2022 03:25
-
-
Save CoolCatsNFTPublic/4a4fc8502dc892ca695edd5de371b3ba to your computer and use it in GitHub Desktop.
Combine all snapshots
This file contains hidden or 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
// THE GIST CONTAINS A DELIBERATE ERROR FOR THE PURPOSES | |
// OF THE ARTICLE - DO NOT BLINDLY COPY AND PASTE | |
// Combine snapshots. | |
async function combineSnapShots() { | |
// Step 1 - Gathering addresses | |
const l1 = JSON.parse(fs.readFileSync('./snapshots/cxllabsHolders.json', 'utf8')); | |
const l2 = JSON.parse(fs.readFileSync('./snapshots/ghxstHolders.json', 'utf8')); | |
const l3 = JSON.parse(fs.readFileSync('./snapshots/ghxstsCxltureHolders.json', 'utf8')); | |
const l4 = JSON.parse(fs.readFileSync('./snapshots/holders.json', 'utf8')); | |
const l5 = JSON.parse(fs.readFileSync('./snapshots/pxinGxngHolders.json', 'utf8')); | |
const arr = [l1, l2, l3, l4, l5]; | |
const allHolders = {} | |
// Step 2 - combining and filtering | |
for (const obj of arr) { | |
const keys = Object.keys(obj); | |
for (let key of keys) { | |
if (!allHolders[key]) { | |
allHolders[key] = 1; | |
} else { | |
allHolders[key]++; | |
} | |
} | |
} | |
// Step 3 - saving final addresses list | |
fs.writeFile('allHolders.json', JSON.stringify(allHolders), {flag: 'w'}, function(err) { | |
if (err) return console.log(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// THE GIST CONTAINS A DELIBERATE ERROR FOR THE PURPOSES
// OF THE ARTICLE - DO NOT BLINDLY COPY AND PASTE