import { MerkleTree } from "merkletreejs" ; import keccak256 from "keccak256" ; const hashStringAddress = ( address ) : string => keccak256 ( Buffer . from ( address . substring ( 2 ) , "hex" ) ) ; export function generateMerkleTree ( addresses ) { const leaves = addresses . map ( ( v ) => hashStringAddress ( v ) ) ; return new MerkleTree ( leaves , keccak256 , { sort : true } ) ; } export const getProof = ( tree , address ) : string [ ] => tree . getHexProof ( hashStringAddress ( address ) ) ;