import { Artifact, Artifacts as IArtifacts, BuildInfo, CompilerInput, CompilerOutput } from "hardhat/types"; import { ForgeArtifact, BuildInfoArtifact } from "./types"; export declare class ForgeArtifacts implements IArtifacts { private _root; private _out; private _artifacts; private _buildInfo; private _useBuildInfo?; private _buildInfos; constructor(_root: string, _out: string, _artifacts: string, _buildInfo: string, _useBuildInfo?: boolean | undefined); /** * Public getter for the build info files that caches * reads. This assumes that no additional build info files * are generated while this is running. */ get buildInfos(): BuildInfoArtifact[]; readArtifact(name: string): Promise; readArtifactSync(name: string): Artifact; /** * Noop so that runSuper can be called */ addValidArtifacts(_validArtifacts: Array<{ sourceName: string; artifacts: string[]; }>): void; /** * Noop so that runSuper can be called */ removeObsoleteArtifacts(): Promise; /** * Converts a forge artifact to a hardhat style `Artifact` * @param artifact * @param artifactPath * @param name */ convertForgeArtifact(artifact: ForgeArtifact, name: string): Artifact; artifactExists(name: string): Promise; getAllFullyQualifiedNames(): Promise; /** * Dynamically generate a build artifact for a contract. * In practice, hardhat build artifacts are decorated * with additional fields on top of the `BuildInfo` * type. Fields that foundry cannot fill in are currently * left blank. `extra_output` must be configured for some * fields to be populated */ getBuildInfo(fullyQualifiedName: string): Promise; getArtifactPaths(): Promise; getBuildInfoPaths(): Promise; getBuildInfoPathsSync(): string[]; getDebugFilePaths(): Promise; saveArtifactAndDebugFile(_artifact: Artifact, _pathToBuildInfo?: string): Promise; saveBuildInfo(_solcVersion: string, _solcLongVersion: string, _input: CompilerInput, _output: CompilerOutput): Promise; /** * Returns the absolute path to the artifact that corresponds to the given * name. * * If the name is fully qualified, the path is computed from it. If not, an * artifact that matches the given name is searched in the existing artifacts. * If there is an ambiguity, an error is thrown. */ private _getArtifactPath; private _getArtifactPathsSync; /** * Sync version of _getArtifactPath */ private _getArtifactPathSync; /** * Same signature as imported function, but abstracted to handle the only error we consistently care about */ private _trueCasePath; /** * Same signature as imported function, but abstracted to handle the only error we consistently care about * and synchronous */ private _trueCasePathSync; /** * Returns the absolute path to the given artifact */ formArtifactPathFromFullyQualifiedName(fullyQualifiedName: string): string; private _getValidArtifactPathFromFullyQualifiedName; /** * DO NOT DELETE OR CHANGE * * use this.formArtifactPathFromFullyQualifiedName instead * @deprecated until typechain migrates to public version * @see https://github.com/dethcrypto/TypeChain/issues/544 */ private _getArtifactPathFromFullyQualifiedName; private _getAllContractNamesFromFiles; private _getAllFullyQualifiedNamesSync; private _formatSuggestions; private _handleWrongArtifactForFullyQualifiedName; private _handleWrongArtifactForContractName; /** * If the project has these contracts: * - 'contracts/Greeter.sol:Greeter' * - 'contracts/Meeter.sol:Greeter' * - 'contracts/Greater.sol:Greater' * And the user tries to get an artifact with the name 'Greeter', then * the suggestions will be 'Greeter', 'Greeter', and 'Greater'. * * We don't want to show duplicates here, so we use FQNs for those. The * suggestions will then be: * - 'contracts/Greeter.sol:Greeter' * - 'contracts/Meeter.sol:Greeter' * - 'Greater' */ private _filterDuplicatesAsFullyQualifiedNames; /** * * @param givenName can be FQN or contract name * @param names MUST match type of givenName (i.e. array of FQN's if givenName is FQN) * @returns */ private _getSimilarContractNames; private _getValidArtifactPathFromFullyQualifiedNameSync; private _getDebugFilePath; private _getArtifactPathFromFiles; /** * Returns the FQN of a contract giving the absolute path to its artifact. * * For example, given a path like * `/path/to/project/artifacts/contracts/Foo.sol/Bar.json`, it'll return the * FQN `contracts/Foo.sol:Bar` */ private _getFullyQualifiedNameFromPath; /** * Remove the artifact file, its debug file and, if it exists, its build * info file. */ private _removeArtifactFiles; /** * Given the path to a debug file, returns the absolute path to its * corresponding build info file if it exists, or undefined otherwise. */ private _getBuildInfoFromDebugFile; /** * Write hardhat style artifacts to disk */ writeArtifactsSync(): void; /** * Writes a debug file to disk. The debug file contains * the path to the build info artifact corresponding * to the hardhat artifact */ private _writeDebugFile; /** * Converts a foundry artifact path to a hardhat artifact path */ private _getHardhatArtifactPathFromForgePath; } /** * Retrieves an artifact for the given `contractName` from the compilation output. * * @param sourceName The contract's source name. * @param contractName the contract's name. * @param contractOutput the contract's compilation output as emitted by `solc`. */ export declare function getArtifactFromContractOutput(sourceName: string, contractName: string, contractOutput: any): Artifact; //# sourceMappingURL=artifacts.d.ts.map