/** * Merkle tree service for whitelist proof generation. * * Builds a Merkle tree from verified addresses in whitelist.json and * generates proofs that can be submitted to the smart contract's * `mintWhitelist(name, endpoint, capHash, proof[])` function. * * This is the missing bridge between: * whitelist.json → Merkle tree → on-chain mintWhitelist() * * The contract stores a `merkleRoot()` and verifies each mint against * a proof derived from the caller's address. * * Standard: leaves = keccak256(abi.encodePacked(address)) * sorted pairs to ensure deterministic tree construction. * * @see drop-service.ts — mintWithWhitelist() consumer * @see twitter-verify.ts — one source of whitelist addresses * @see nft-verify.ts — another source of whitelist addresses */ export interface MerkleProofResult { /** The proof array (bytes32[]) to submit to mintWhitelist(). */ proof: string[]; /** The leaf hash for this address. */ leaf: string; /** The root of the current tree. */ root: string; /** Whether this address is in the tree. */ isWhitelisted: boolean; } export interface MerkleTreeInfo { /** The root hash of the current tree. */ root: string; /** Total number of addresses in the tree. */ addressCount: number; /** All leaf hashes (sorted). */ leaves: string[]; } /** * Hash an address into a Merkle leaf. * * Uses `keccak256(abi.encodePacked(address))` — the standard Solidity * pattern for OpenZeppelin MerkleProof verification. */ export declare function hashLeaf(address: string): string; /** * Build a Merkle tree from an array of leaf hashes. * * Returns the tree as a 2D array where: * tree[0] = leaves (sorted) * tree[1] = first level of internal nodes * ... * tree[tree.length - 1] = [root] * * Leaves are sorted before building to ensure determinism. */ export declare function buildTree(leaves: string[]): string[][]; /** * Get the proof (sibling path) for a leaf in the tree. */ export declare function getProof(tree: string[][], leaf: string): string[]; /** * Get the root of the tree. */ export declare function getRoot(tree: string[][]): string; /** * Verify a proof against a root. * * Recomputes the root from the leaf + proof path and checks * if it matches the expected root. */ export declare function verifyProof(leaf: string, proof: string[], expectedRoot: string): boolean; /** * Build a Merkle tree from the current whitelist. * * Reads all verified addresses from whitelist.json, hashes them into * leaves, and builds the tree. */ export declare function buildWhitelistTree(): { tree: string[][]; info: MerkleTreeInfo; }; /** * Generate a Merkle proof for a specific address. * * Returns the proof, leaf, root, and whether the address is whitelisted. * The proof can be passed directly to `mintWhitelist()` on the contract. */ export declare function generateProof(walletAddress: string): MerkleProofResult; //# sourceMappingURL=merkle-tree.d.ts.map