chainid.js 364 B

123456789101112
  1. const hre = require('hardhat');
  2. async function getChainId() {
  3. const chainIdHex = await hre.network.provider.send('eth_chainId', []);
  4. return new hre.web3.utils.BN(chainIdHex, 'hex');
  5. }
  6. module.exports = {
  7. getChainId,
  8. // TODO: when tests are ready to support bigint chainId
  9. // getChainId: ethers.provider.getNetwork().then(network => network.chainId),
  10. };