Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dull-knives-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Add `defineConfig` in `hardhat/config`
20 changes: 20 additions & 0 deletions .changeset/tender-spoons-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@nomicfoundation/hardhat-ethers-chai-matchers": patch
"@nomicfoundation/hardhat-toolbox-mocha-ethers": patch
"@nomicfoundation/hardhat-node-test-runner": patch
"@nomicfoundation/hardhat-ignition-ethers": patch
"@nomicfoundation/hardhat-network-helpers": patch
"@nomicfoundation/hardhat-viem-assertions": patch
"@nomicfoundation/hardhat-ignition-viem": patch
"@nomicfoundation/hardhat-toolbox-viem": patch
"@nomicfoundation/hardhat-typechain": patch
"@nomicfoundation/hardhat-ignition": patch
"@nomicfoundation/hardhat-keystore": patch
"@nomicfoundation/hardhat-ethers": patch
"@nomicfoundation/hardhat-ledger": patch
"@nomicfoundation/hardhat-verify": patch
"@nomicfoundation/hardhat-mocha": patch
"@nomicfoundation/hardhat-viem": patch
---

Update installation and config instructions
8 changes: 3 additions & 5 deletions v-next/example-project/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { HardhatUserConfig } from "hardhat/config";
import { defineConfig } from "hardhat/config";

import { HardhatPluginError } from "hardhat/plugins";

Expand Down Expand Up @@ -125,7 +125,7 @@ const pluginExample = {
],
};

const config: HardhatUserConfig = {
export default defineConfig({
networks: {
op: {
type: "http",
Expand Down Expand Up @@ -233,6 +233,4 @@ const config: HardhatUserConfig = {
timeout: 1000,
},
},
};

export default config;
});
5 changes: 3 additions & 2 deletions v-next/hardhat-ethers-chai-matchers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-ethers-chai-matchers
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatEthersChaiMatchers from "@nomicfoundation/hardhat-ethers-chai-matchers";

export default {
export default defineConfig({
plugins: [hardhatEthersChaiMatchers],
};
});
```

## Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-ethers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-ethers
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatEthers from "@nomicfoundation/hardhat-ethers";

export default {
export default defineConfig({
plugins: [hardhatEthers],
};
});
```

## Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-ignition-ethers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-ignition-ethers
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatIgnitionEthers from "@nomicfoundation/hardhat-ignition-ethers";

export default {
export default defineConfig({
plugins: [hardhatIgnitionEthers],
};
});
```

## Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-ignition-viem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-ignition-viem
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatIgnitionViem from "@nomicfoundation/hardhat-ignition-viem";

export default {
export default defineConfig({
plugins: [hardhatIgnitionViem],
};
});
```

## Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-ignition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-ignition
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```typescript
import { defineConfig } from "hardhat/config";
import hardhatIgnition from "@nomicfoundation/hardhat-ignition";

export default {
export default defineConfig({
plugins: [hardhatIgnition],
};
});
```

## Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-keystore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-keystore
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatKeystore from "@nomicfoundation/hardhat-keystore";

export default {
export default defineConfig({
plugins: [hardhatKeystore],
};
});
```

## Usage
Expand Down
17 changes: 11 additions & 6 deletions v-next/hardhat-ledger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,31 @@ npm install --save-dev @nomicfoundation/hardhat-ledger
and add the following statements to your `hardhat.config.ts` file:

```typescript
import { defineConfig } from "hardhat/config";
// ...
import hardhatLedgerPlugin from "@nomicfoundation/hardhat-ledger";

// ...

export default {
export default defineConfig({
// ...
plugins: [
// ...
hardhatLedgerPlugin,
],

// ...
};
});
```

## Configuring your Ledger accounts

In your `hardhat.config.ts` file, also add the following property to list the accounts you control via your Ledger device:

```typescript
export default {
import { defineConfig } from "hardhat/config";

export default defineConfig({
// ...
networks: {
yourNetworkName: {
Expand All @@ -48,15 +51,17 @@ export default {
},

// ...
};
});
```

This will make those three accounts available to the Hardhat. If you try to send a transaction or sign something using any of those accounts, the plugin will try to connect to the Ledger wallet and find a derivation path for that address. By default, the derivation paths that are tried start from `m/44'/60'/0'/0'/0` and go up to `m/44'/60'/20'/0'/0`.

An optional `derivationFunction configuration allows setting the derivation path, supporting 'legacy' or otherwise non-standard addresses:

```typescript
export default {
import { defineConfig } from "hardhat/config";

export default defineConfig({
// ...
networks: {
yourNetworkName: {
Expand All @@ -69,7 +74,7 @@ export default {
},

// ...
};
});
```

## Usage
Expand Down
11 changes: 7 additions & 4 deletions v-next/hardhat-mocha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-mocha
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatMocha from "@nomicfoundation/hardhat-mocha";

export default {
export default defineConfig({
plugins: [hardhatMocha],
};
});
```

## Usage
Expand All @@ -31,11 +32,13 @@ This plugin defines a new task called `test mocha` that runs your tests using Mo
You can use the `test.mocha` entry in the Hardhat configuration to customize the Mocha options. For example:

```ts
export default {
import { defineConfig } from "hardhat/config";

export default defineConfig({
test: {
mocha: {
timeout: 20_000, // set the timeout for tests to 20 seconds
},
},
};
});
```
5 changes: 3 additions & 2 deletions v-next/hardhat-network-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-network-helpers
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatNetworkHelpers from "@nomicfoundation/hardhat-network-helpers";

export default {
export default defineConfig({
plugins: [hardhatNetworkHelpers],
};
});
```

### Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-node-test-runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-node-test-runner
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatNodeTestRunner from "@nomicfoundation/hardhat-node-test-runner";

export default {
export default defineConfig({
plugins: [hardhatNodeTestRunner],
};
});
```

## Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-toolbox-mocha-ethers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ npm install --save-dev @nomicfoundation/hardhat-toolbox-mocha-ethers
Then add it to your Hardhat configuration:

```typescript
import { defineConfig } from "hardhat/config";
import hardhatToolboxMochaEthers from "@nomicfoundation/hardhat-toolbox-mocha-ethers";

export default {
export default defineConfig({
plugins: [hardhatToolboxMochaEthers],
};
});
```

## Included functionality
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-toolbox-viem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ npm install --save-dev @nomicfoundation/hardhat-toolbox-viem
Then add it to your Hardhat configuration:

```typescript
import { defineConfig } from "hardhat/config";
import hardhatToolboxViem from "@nomicfoundation/hardhat-toolbox-viem";

export default {
export default defineConfig({
plugins: [hardhatToolboxViem],
};
});
```

## Included functionality
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-typechain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-typechain
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatTypechain from "@nomicfoundation/hardhat-typechain";

export default {
export default defineConfig({
plugins: [hardhatTypechain],
};
});
```

## Usage
Expand Down
17 changes: 10 additions & 7 deletions v-next/hardhat-verify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-verify
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatVerify from "@nomicfoundation/hardhat-verify";

export default {
export default defineConfig({
plugins: [hardhatVerify],
};
});
```

## Usage
Expand All @@ -29,31 +30,33 @@ export default {
You need to add the following Etherscan config in your `hardhat.config.ts` file

```typescript
export default {
import { defineConfig } from "hardhat/config";

export default defineConfig({
verify: {
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: "<ETHERSCAN_API_KEY>",
},
},
};
});
```

We recommend using a [configuration variable](https://hardhat.org/docs/learn-more/configuration-variables) to set sensitive information like API keys.

```typescript
import { configVariable } from "hardhat/config";
import { configVariable, defineConfig } from "hardhat/config";

export default {
export default defineConfig({
verify: {
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: configVariable("ETHERSCAN_API_KEY"),
},
},
};
});
```

Run the `verify` task passing the network where it's deployed, the address of the contract, and the constructor arguments that were used to deploy it (if any):
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-viem-assertions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-viem-assertions
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```ts
import { defineConfig } from "hardhat/config";
import hardhatViemAssertions from "@nomicfoundation/hardhat-viem-assertions";

export default {
export default defineConfig({
plugins: [hardhatViemAssertions],
};
});
```

## Usage
Expand Down
5 changes: 3 additions & 2 deletions v-next/hardhat-viem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ npm install --save-dev @nomicfoundation/hardhat-viem
In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:

```typescript
import { defineConfig } from "hardhat/config";
import hardhatViem from "@nomicfoundation/hardhat-viem";

export default {
export default defineConfig({
plugins: [hardhatViem],
};
});
```

## Usage
Expand Down
Loading