tryethernal / hardhat-ethernal

Hardhat plugin for Ethernal
MIT License
102 stars 17 forks source link

HardatConfig instead of HardatUserConfig #23

Closed Jhoscy closed 2 years ago

Jhoscy commented 2 years ago

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;
    }
}
antoinedc commented 2 years ago

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

Jhoscy commented 2 years ago

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

antoinedc commented 2 years ago

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

Jhoscy commented 2 years ago
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 commented 2 years ago

setting in types/estensions/ts like:

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

works

antoinedc commented 2 years ago

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

Jhoscy commented 2 years ago

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: @.***>