Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
install: async function(options, callback) {
expect.options(options, ["working_directory", "ethpm"]);
expect.options(options.ethpm, ["registry", "ipfs_host"]);
expect.one(options.ethpm, ["provider", "install_provider_uri"]);
// ipfs_port and ipfs_protocol are optinal.
const provider =
options.ethpm.provider ||
new Web3.providers.HttpProvider(options.ethpm.install_provider_uri, {
keepAlive: false
});
let host = options.ethpm.ipfs_host;
if (host instanceof EthPM.hosts.IPFS === false) {
host = new EthPM.hosts.IPFSWithLocalReader(
options.ethpm.ipfs_host,
options.ethpm.ipfs_port,
options.ethpm.ipfs_protocol
);
function prepareConfig(options) {
expect.options(options, ["contracts_build_directory"]);
expect.one(options, ["contracts_directory", "files"]);
// Use a config object to ensure we get the default sources.
const config = Config.default().merge(options);
config.compilersInfo = {};
if (!config.resolver) config.resolver = new Resolver(config);
if (!config.artifactor) {
config.artifactor = new Artifactor(config.contracts_build_directory);
}
return config;
}