forked from MyEtherWallet/ethereum-lists
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkMissingLinks.js
37 lines (35 loc) · 903 Bytes
/
checkMissingLinks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fs = require('fs');
const {
getAddress,
excludeMasterFileTokens,
excludeIcons
} = require('./utils');
const masterFile = fs.readFileSync('./dist/master-file.json');
const iconsDir = fs.readdirSync('./src/icons', { encoding: 'utf-8' });
const master = JSON.parse(masterFile);
const nets = ['eth', 'matic', 'bsc'];
console.log('Missing Links:');
master.forEach(i => {
if (
!i.icon &&
!i.icon_png &&
nets.find(n => n === i.network) &&
!excludeMasterFileTokens.filter(
e => i.network === e.network && i.contract_address === e.address
)
) {
console.log(`network: ${i.network}`);
console.log(`${i.contract_address}\n`);
}
});
console.log('Unused Icons:');
iconsDir.forEach(i => {
i = getAddress(i);
if (!i) return;
if (
!master.find(m => i === m.contract_address) &&
!excludeIcons.find(e => e === i)
) {
console.log(`${i}\n`);
}
});