Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Nov 6, 2024
1 parent 193f20f commit 8b2d95a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"entities": "cd utils;npm i; cd ..; node utils/testInteractive entities",
"useTokenLabels": "node utils/scripts/useTokenLabels.js",
"biggest-files": "find ./projects -name '*.js' -not -path './projects/helper/*' -not -path './projects/curve/*' -not -path './projects/sigmao/*' -exec du -sh {} \\; | sort -rh | head -n 100",
"check-bitcoin-duplicates": "node utils/scripts/checkBTCDups.js",
"check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js",
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' "
},
"author": "",
Expand Down
30 changes: 30 additions & 0 deletions utils/scripts/checkBTCDupsv2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const addressBook = require('../../projects/helper/bitcoin-book/index');

console.log('project count: ', Object.keys(addressBook).length);
const addressProjectMap = {}

async function run() {

await Promise.all(Object.keys(addressBook).map(async project => {
let addresses = addressBook[project];
if (!Array.isArray(addresses)) addresses = await addresses()
for (let address of addresses) {
if (addressProjectMap[address]) {
addressProjectMap[address].push(project);
} else {
addressProjectMap[address] = [project];
}
}
}))

const duplicates = {}
for (const [address, projects] of Object.entries(addressProjectMap)) {
if (projects.length > 1) {
duplicates[address] = projects.join(', ');
}
}

console.table(Object.entries(duplicates));
}

run().catch(console.error).then(() => process.exit(0));

0 comments on commit 8b2d95a

Please sign in to comment.