Skip to content

Commit

Permalink
filtering out incorrect data during build script
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin-phantom committed Dec 12, 2023
1 parent 6e2d926 commit 120a39e
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,27 @@ const yaml = require('js-yaml');
const fs = require('fs');
const { SHA3 } = require('sha3');

// Filter functions to ensure correct data types
const filterUrls = (entry) => {
if (!entry || typeof entry.url !== "string") {
return false;
}

return true;
};
const filterNfts = (entry) => {
if (!entry || typeof entry.mint !== "string") {
return false;
}

return true;
};

// Read local yaml files for blocklists
const solBlocklist = yaml.load(fs.readFileSync('./blocklist.yaml', 'utf8'));
const ethBlocklist = yaml.load(fs.readFileSync('./eth-blocklist.yaml', 'utf8'));
const nftBlocklist = yaml.load(fs.readFileSync('./nft-blocklist.yaml', 'utf8'));
const whitelist = yaml.load(fs.readFileSync('./whitelist.yaml', 'utf8'));
const solBlocklist = yaml.load(fs.readFileSync('./blocklist.yaml', 'utf8')).filter(filterUrls);
const ethBlocklist = yaml.load(fs.readFileSync('./eth-blocklist.yaml', 'utf8')).filter(filterUrls);
const nftBlocklist = yaml.load(fs.readFileSync('./nft-blocklist.yaml', 'utf8')).filter(filterNfts);
const whitelist = yaml.load(fs.readFileSync('./whitelist.yaml', 'utf8')).filter(filterUrls);
const fuzzylist = yaml.load(fs.readFileSync('./fuzzylist.yaml', 'utf8'));

// Multichain blocklist concatenates each blockchains blocklist
Expand Down

0 comments on commit 120a39e

Please sign in to comment.