hardhat/types#HttpNetworkUserConfig TypeScript Examples

The following examples show how to use hardhat/types#HttpNetworkUserConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts    From hardhat-kms-signer with MIT License 6 votes vote down vote up
extendEnvironment((hre) => {
  if (hre.network.config.kmsKeyId) {
    const httpNetConfig = hre.network.config as HttpNetworkUserConfig;
    const eip1193Provider = new HttpProvider(
      httpNetConfig.url!,
      hre.network.name,
      httpNetConfig.httpHeaders,
      httpNetConfig.timeout
    );
    let wrappedProvider: EIP1193Provider;
    wrappedProvider = new KMSSigner(
      eip1193Provider,
      hre.network.config.kmsKeyId
    );
    wrappedProvider = new AutomaticGasProvider(
      wrappedProvider,
      hre.network.config.gasMultiplier
    );
    wrappedProvider = new AutomaticGasPriceProvider(wrappedProvider);
    hre.network.provider = new BackwardsCompatibilityProviderAdapter(
      wrappedProvider
    );
  }
});
Example #2
Source File: hardhat.config.ts    From safe-tasks with GNU Lesser General Public License v3.0 5 votes vote down vote up
sharedNetworkConfig: HttpNetworkUserConfig = {}
Example #3
Source File: hardhat.config.ts    From zodiac with GNU Lesser General Public License v3.0 5 votes vote down vote up
sharedNetworkConfig: HttpNetworkUserConfig = {}
Example #4
Source File: hardhat.config.ts    From hoprnet with GNU General Public License v3.0 5 votes vote down vote up
// For reference on how the configuration is structured refer to:
//
// https://hardhat.org/hardhat-network/reference/#config
// https://github.com/wighawag/hardhat-deploy/blob/master/README.md
function networkToHardhatNetwork(name: String, input: ResolvedEnvironment['network']): NetworkUserConfig {
  let cfg: NetworkUserConfig = {
    chainId: input.chain_id,
    live: input.live,
    tags: input.tags,
    // used by hardhat-deploy
    saveDeployments: true
  }

  if (name !== 'hardhat') {
    try {
      ;(cfg as HttpNetworkUserConfig).url = expandVars(input.default_provider, process.env)
    } catch (_) {
      ;(cfg as HttpNetworkUserConfig).url = 'invalid_url'
    }
  } else {
    ;(cfg as HardhatNetworkUserConfig).initialDate = '2021-07-26'
  }

  if (input.live) {
    cfg.accounts = DEPLOYER_WALLET_PRIVATE_KEY ? [DEPLOYER_WALLET_PRIVATE_KEY] : []
    cfg.companionNetworks = {}
  }

  // we enable auto-mine only in development networks
  if (HOPR_HARDHAT_TAG) {
    cfg.tags = [HOPR_HARDHAT_TAG]
  }
  if (cfg.tags && cfg.tags.indexOf('development') >= 0) {
    ;(cfg as HardhatNetworkUserConfig).mining = {
      auto: true, // every transaction will trigger a new block (without this deployments fail)
      interval: [1000, 3000] // mine new block every 1 - 3s
    }
  }
  if (input.etherscan_api_url) {
    ;(cfg as HardhatNetworkUserConfig).verify = {
      etherscan: {
        apiUrl: input.etherscan_api_url
      }
    }
  }
  return cfg
}