UNPKG

hardhat

Version:

Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.

29 lines 1.48 kB
import type { CollectedStruct } from "./ast-walker.js"; /** * Produces the flat list of canonical EIP-712 type strings expected by EDR. * * Each encodable struct contributes one entry, built like this: * 1. Start with the struct's own head: `Name(type1 name1,type2 name2,...)`. * 2. If the struct has fields that reference other structs, append those * structs' heads after it, sorted alphabetically. * * Examples: * - `Person` has only primitive fields (address, string), so its entry is * just its own head: * `Person(address wallet,string name)` * - `Mail` has a `Person` field, so its entry is its head plus `Person`'s * head appended: * `Mail(Person from,Person to,string contents)Person(address wallet,string name)` * * Structs that contain members whose type cannot be EIP-712 encoded (mappings, * function types, etc.) are dropped entirely, along with any structs that * depend on them transitively. This matches `forge bind-json`'s behavior: * `resolve_struct_eip712` returns `None` for any struct containing unsupported * constructs and propagates `None` through the dep graph so dependents are * also dropped. * * Only names in `selectedNames` are emitted; non-selected structs still * participate in dep resolution so cross-file deps inline correctly. */ export declare function canonicalizeStructs(structs: CollectedStruct[], selectedNames: Set<string>): string[]; //# sourceMappingURL=canonicalize.d.ts.map