import { type Address, type Hex } from "viem"; /** * A single allowed call, expressed as the tuple the on-chain * ManagerWithMerkleVerification hashes into a leaf: * * leaf = keccak256(abi.encodePacked( * decoderAndSanitizer, target, valueIsNonZero, selector, packedArgumentAddresses * )) * * `packedArgumentAddresses` is the tight concatenation of the address arguments the * DecoderAndSanitizer returns for this call (e.g. the asset and, where relevant, the * recipient — which decoders force to the vault). */ export interface LeafTuple { decoder: Address; target: Address; /** true if the manage call sends ETH (value > 0). Defaults to false. */ valueIsNonZero?: boolean; /** 4-byte function selector (0x-prefixed). */ selector: Hex; /** Address arguments the decoder constrains, in order. Packed tight (20 bytes each). */ argumentAddresses?: Address[]; } /** Tight-pack address arguments into a single hex blob (matches abi.encodePacked(addr0, addr1, ...)). */ export declare function packArgumentAddresses(addrs?: Address[]): Hex; /** Compute a leaf hash exactly as the on-chain verifier does. */ export declare function leafHash(t: LeafTuple): Hex; /** * Leaf hash where the packed argument addresses are already the raw bytes the decoder returns * (as obtained by eth_call-ing the DecoderAndSanitizer with the call's targetData). This is the * production path — the bytes match exactly what ManagerWithMerkleVerification verifies. */ export declare function leafHashWithPacked(t: { decoder: Address; target: Address; valueIsNonZero?: boolean; selector: Hex; packedArgs: Hex; }): Hex; /** Sorted-pair (commutative) hash of two 32-byte nodes — matches solmate MerkleProofLib.verify. */ export declare function hashPair(a: Hex, b: Hex): Hex; export interface MerkleTree { root: Hex; /** layers[0] = leaves, last layer = [root]. */ layers: Hex[][]; leaves: Hex[]; } /** * Build a sorted-pair Merkle tree with odd-node promotion. Self-consistent with * MerkleProofLib.verify: any proof from {@link proofFor} reconstructs `root`. */ export declare function buildTree(leaves: Hex[]): MerkleTree; /** Build a tree directly from tuples. */ export declare function buildRootFromTuples(tuples: LeafTuple[]): MerkleTree; /** Merkle proof (bytes32[]) for the leaf at `index` in the tree. */ export declare function proofFor(tree: MerkleTree, index: number): Hex[]; /** Proof for a specific leaf hash (looked up by value). */ export declare function proofForLeaf(tree: MerkleTree, leaf: Hex): Hex[]; /** Local mirror of MerkleProofLib.verify (sorted-pair). Useful for self-checks/tests. */ export declare function verify(proof: Hex[], root: Hex, leaf: Hex): boolean;