How to use the @nomiclabs/buidler/internal/core/providers/construction.createProvider function in @nomiclabs/buidler

To help you get started, we’ve selected a few @nomiclabs/buidler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sc-forks / solidity-coverage / plugins / resources / buidler.utils.js View on Github external
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;
}