import { csvClaimables } from "../src/csv-claimables" ; import { jsonClaimables } from "../src/json-claimables" ; const fs = require ( "fs" ) ; const path = require ( "path" ) ; const claimableDataDir = path . resolve ( __dirname , ".." , "src" , "claimable-data" ) ; const masterData = { } ; const sanitizeAddress = ( address ) => address . toLowerCase ( ) . trim ( ) ; async function main ( ) { for ( const [ protocolName , value ] of Object . entries ( csvClaimables ) ) { const jsonContents = JSON . parse ( fs . readFileSync ( path . join ( claimableDataDir , `${ protocolName }.json` ) , "utf8" ) ) ; jsonContents . forEach ( ( drop ) => { let address ; let quantityDropped ; if ( protocolName === "tornado-cash" ) { address = sanitizeAddress ( drop [ 0 ] ) ; quantityDropped = drop [ 1 ] ; } else { address = sanitizeAddress ( drop . address ) ; quantityDropped = drop [ value . tokenNamed ] ; } if ( masterData [ address ] ) { masterData [ address ] [ protocolName ] = quantityDropped . trim ( ) ; } else { masterData [ address ] = { [ protocolName ] : quantityDropped . trim ( ) , } ; } } ) ; } for ( const [ protocolName , value ] of Object . entries ( jsonClaimables ) ) { const jsonContents = JSON . parse ( fs . readFileSync ( path . join ( claimableDataDir , `${ protocolName }.json` ) , "utf8" ) ) ; for ( const bigAddress of Object . keys ( jsonContents ) ) { const address = sanitizeAddress ( bigAddress ) ; if ( masterData [ address ] ) { masterData [ address ] [ protocolName ] = "1" ; } else { masterData [ address ] = { [ protocolName ] : "1" , } ; } } } fs . writeFileSync ( path . join ( claimableDataDir , `master-airdop-data.json` ) , JSON . stringify ( masterData , null , 2 ) ) ; } main ( ) ;