hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
33 lines • 1.46 kB
JavaScript
import { isSolcSolidityCompilerConfig } from "./build-system/build-system.js";
import { downloadSolcCompilers, getCompiler, } from "./build-system/compiler/index.js";
/**
* Downloads solc compilers for the given configs, filtering out non-solc types.
* This is the default implementation of the `downloadCompilers` hook handler.
*/
export async function downloadSolcCompilersHandler(compilerConfigs, quiet) {
const solcVersions = new Set(compilerConfigs.filter(isSolcSolidityCompilerConfig).map((c) => c.version));
if (solcVersions.size > 0) {
await downloadSolcCompilers(solcVersions, quiet);
}
}
/**
* Resolves the preferWasm setting for a given compiler config, falling back
* to the build profile's preferWasm if not set on the compiler.
*/
export function resolvePreferWasm(compilerConfig, buildProfilePreferWasm) {
if (isSolcSolidityCompilerConfig(compilerConfig)) {
return compilerConfig.preferWasm ?? buildProfilePreferWasm;
}
return false;
}
/**
* Creates a solc Compiler for the given config. This is the default
* implementation used as the fallback in the `getCompiler` hook chain.
*/
export async function getSolcCompilerForConfig(compilerConfig, buildProfilePreferWasm) {
return getCompiler(compilerConfig.version, {
preferWasm: resolvePreferWasm(compilerConfig, buildProfilePreferWasm),
compilerPath: compilerConfig.path,
});
}
//# sourceMappingURL=solidity-hooks.js.map