UNPKG

hardhat

Version:

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

35 lines 2.33 kB
import type { CollectedStruct } from "./ast-walker.js"; export declare const SELECTED_CONFLICT_REMEDIATION = "Rename one of the structs, or scope your `test.solidity.eip712Types.include` / `exclude` globs in `hardhat.config.ts` so that only one of them is selected."; export declare const DEPENDENCY_CONFLICT_REMEDIATION = "Rename one of the structs so the name has a single definition. The clashing name is pulled in as a dependency of a selected struct, so if you don't need that selected struct, deselecting it with your `test.solidity.eip712Types.include` / `exclude` globs in `hardhat.config.ts` also resolves the conflict."; /** * 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. * * Selection is scoped by source, not by struct name: `selectedSources` holds * the project-relative paths matched by the user's include/exclude globs. Only * structs from those sources are emitted, but structs elsewhere still feed dep * resolution so cross-file deps inline correctly. Scoping by source is what * lets a non-selected file define a same-named struct without it being mistaken * for selected. */ export declare function canonicalizeStructs(structs: CollectedStruct[], selectedSources: Set<string>): string[]; //# sourceMappingURL=canonicalize.d.ts.map