/** * Resolve the source-file path where a Solidity library is defined, by * inspecting the compilation metadata `sources` map. * * Etherscan (and the Solidity standard-json input spec) keys the * `settings.libraries` block by the source file that DEFINES each library, * not by the file of the consuming contract. This helper is the FALLBACK * resolution path: prefer `findLibrarySourcePathFromLinkReferences`, which * reads the source path straight from the compiler `linkReferences` map, and * only reach for this heuristic scan when no usable `linkReferences` is * available on the deployment. * * Resolution order: * 1. Structured AST (`source.ast.nodes`) if present: the compiler emits a * `ContractDefinition` node with `contractKind: 'library'` and `name`. * 2. Fallback: regex over `source.content` for a `library ` * declaration. * * Each pass takes the FIRST source it matches. That is a GUESS whenever more * than one source matches, so the scan collects every candidate and warns * (naming the library, all candidates, the chosen one, and which pass produced * them) before returning the first. It does not change which one wins. * * Returns the source path (e.g. `contracts/Math.sol`) or `undefined` if the * library cannot be located in any of the sources. */ export declare function findLibrarySourcePath(libraryName: string, metadataSources: Record | undefined): string | undefined; /** * Solidity `linkReferences` map, keyed by the DEFINING source file of each * library (exactly the shape Etherscan wants for `settings.libraries`): * * { "contracts/Math.sol": { "Math": [{start, length}, ...] }, ... } * * The compiler emits this for both creation-time (`linkReferences`) and * runtime (`deployedLinkReferences`) bytecode, and rocketh already persists * both on the deployment. Because the source path is the map KEY, resolving a * library's defining source is a direct lookup with no AST-walking or regex. */ export type LinkReferences = { [sourcePath: string]: { [libraryName: string]: unknown; }; }; /** * Resolve a library's defining source path from a compiler `linkReferences` * map. This is the authoritative, most robust resolution path: the source * path is the map key, so no heuristics are involved. * * Accepts one or more `linkReferences`-shaped maps (e.g. creation-time and * runtime) and returns the first match. Returns `undefined` when none of the * provided maps reference `libraryName`. */ export declare function findLibrarySourcePathFromLinkReferences(libraryName: string, ...linkReferencesMaps: Array): string | undefined; //# sourceMappingURL=library-source.d.ts.map