import { readFileSync , writeFileSync } from "fs" ; import { generateMerkleTree , getProof } from "../lib/proof" ; const addresses = JSON . parse ( readFileSync ( `${ __dirname }/../snapshot.json` , "utf-8" ) ) ; const tree = generateMerkleTree ( addresses ) ; const rootValue = tree . getHexRoot ( ) ; console . log ( "Merkle root:" , rootValue ) ; const sampleAddr = "0xB2Ebc9b3a788aFB1E942eD65B59E9E49A1eE500D" ; console . log ( "Sample proof:" , getProof ( tree , sampleAddr ) ) ; const addressProofMap = Object . fromEntries ( addresses . map ( ( addr ) => [ addr , getProof ( tree , addr ) ] ) ) ; writeFileSync ( "proofs.json" , JSON . stringify ( addressProofMap ) ) ;