Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const configPort = networkConfig.url.split(':')[2];
// Warn: port conflicts
if (api.port !== api.defaultPort && api.port !== configPort){
ui.report('port-clash', [ configPort ])
}
// Prefer network port
api.port = parseInt(configPort);
}
networkConfig.url = `http://${api.host}:${api.port}`;
networkConfig.gas = api.gasLimit;
networkConfig.gasPrice = api.gasPrice;
const provider = createProvider(networkName, networkConfig);
env.config.networks[networkName] = networkConfig;
env.config.defaultNetwork = networkName;
env.network = {
name: networkName,
config: networkConfig,
provider: provider,
}
env.ethereum = provider;
// Return a reference so we can set the from account
return env.network;
}