hardhat-ethernal icon indicating copy to clipboard operation
hardhat-ethernal copied to clipboard

HardatConfig instead of HardatUserConfig

Open Jhoscy opened this issue 2 years ago • 6 comments

Hi, we've notice that in the exported module you've used the wrong type. You have to set HardhatUserConfig and not HardhatConfig in order to make the parameter enabled in hardhat.config.js, otherwhise we have a static error (using TS).

You have to set like:

declare module "hardhat/types/config" {
    interface HardhatUserConfig {
        disableEthernal?: boolean;
    }
}

and not:

declare module "hardhat/types/config" {
    interface HardhatConfig {
        disableEthernal?: boolean;
    }
}

Jhoscy avatar May 07 '22 15:05 Jhoscy

Mmmh that actually didn't work for me when using HardhatUserConfig, only HardhatConfig. I thought you said it was working in the other thread though? I'll take a look to see how to move it on UserConfig

antoinedc avatar May 07 '22 15:05 antoinedc

It was working still using my custom interface declared in hardhat.config.js (no error like really disable all the ethernal features in that case and it's fine). But trying to set the correct interface for hardhat (HardatUserConfig) we have static problem adding disableEthernal. Could you check how the guys have done for gasReporter ? https://github.com/cgewecke/hardhat-gas-reporter/blob/97258f99e9a7d6bfa1852363e7ba92beb20f64f3/src/type-extensions.ts

Jhoscy avatar May 07 '22 15:05 Jhoscy

And you are adding the flag in the object exported by hardhat.config? Can you put your config file here, please?

antoinedc avatar May 07 '22 15:05 antoinedc

import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import 'solidity-coverage';
import 'dotenv/config';
import { extendEnvironment, HardhatUserConfig } from 'hardhat/config';
import './tasks';
import 'hardhat-ethernal';
import 'hardhat-gas-reporter';

extendEnvironment((hre) => {
  hre.ethernalSync = true;
  hre.ethernalWorkspace = 'Sample';
  hre.ethernalTrace = false;
  hre.ethernalResetOnStart = 'Sample';
});

const config: HardhatUserConfig = {
  solidity: {
    version: '0.8.4',
    settings: {
      optimizer: {
        enabled: true,
        runs: 800,
      },
    },
  },
  networks: {
    hardhat: {
      chainId: 31337,
      mining: {
        auto: true,
        //interval: [3000, 6000]
      },
    },
    ropsten: {
      url: `https://eth-ropsten.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`,
      accounts: [`${process.env.ACCOUNT_PRIVATE_KEY}`],
    },
    rinkeby: {
      url: `https://eth-rinkeby.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`,
      accounts: [`${process.env.ACCOUNT_PRIVATE_KEY}`],
    },
  },
  gasReporter: {
    currency: process.env.CURRENCY,
    coinmarketcap: process.env.COINMARKETCAP,
    enabled: (process.env.GAS_REPORTER === 'true'),
  },
  disableEthernal: (process.env.ETHERNAL === 'true'),
  etherscan: {
    apiKey: process.env.ETHERSCAN,
  },
};

export default config;

The line with disableEthernal give us static Error.

Jhoscy avatar May 07 '22 16:05 Jhoscy

setting in types/estensions/ts like:

declare module "hardhat/types/config" {
    interface HardhatUserConfig {
        disableEthernal?: boolean;
    }
}

works

Jhoscy avatar May 07 '22 16:05 Jhoscy

Ok, so I've pushed v1.0.0 with quite a few changes in the config. Everything is now done in the Hardhat config object, under an ethernal key, so that's much cleaner. You can do something like:

export default {
  ethernal: {
   disabled: 'true',
   workspace: 'hardhat'
 }
}

I've updated the README with all the changes. If you were using the local keychain to login (ie you logged in with ethernal login, you'll have to set some env variables now).

Let me know how that goes

antoinedc avatar May 09 '22 16:05 antoinedc

Thank you Antoine for the big support with this product and sorry for my late response. I'll try everything soon but I think should be everything ok. I'll do more tests in the next days with your newer version. I'll let you know. Again, thanks. Best regards

Il giorno lun 9 mag 2022 alle ore 18:18 Antoine @.***> ha scritto:

Ok, so I've pushed v1.0.0 with quite a few changes in the config. Everything is now done in the Hardhat config object, under an ethernal key, so that's much cleaner. You can do something like:

export default { ethernal: { disabled: 'true', workspace: 'hardhat' }}

I've updated the README with all the changes. If you were using the local keychain to login (ie you logged in with ethernal login, you'll have to set some env variables now).

Let me know how that goes

— Reply to this email directly, view it on GitHub https://github.com/tryethernal/hardhat-ethernal/issues/23#issuecomment-1121307509, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGYK7EUHBYFSQVBLMCKP2N3VJE3GPANCNFSM5VKRWCLQ . You are receiving this because you authored the thread.Message ID: @.***>

Jhoscy avatar Sep 14 '22 03:09 Jhoscy