Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use hardhat config from hardhat runtime environment #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xiaosongfu
Copy link
Contributor

Why not read hardhat config from hardhat-runtime-environment directly? I can't understand😭, so i create this PR

with the changes, we just need:

let client = new MetamaskClient();

@xiaosongfu
Copy link
Contributor Author

xiaosongfu commented Sep 1, 2023

And then we can do more changes for more convenient use:

In our plugin:

declare module "hardhat/types/runtime" {
  export interface HardhatRuntimeEnvironment {
    metamask: MetamaskClient;
  }
}

extendEnvironment((hre) => {
  hre.metamask = new MetamaskClient();
});

In user's deploy scripts:

const mockPoints = await ethers.deployContract("MockPoints", {
 signer: await hre.metamask.getSigner(),
});
await mockPoints.waitForDeployment();
hre.metamask.close();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant