Skip to content

Commit ca49ea4

Browse files
committed
Merge branch 'main' into accept-Typed-matcher
2 parents bb172a2 + 2f5c30c commit ca49ea4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+787
-106
lines changed

.github/workflows/autoassign-issues.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
script: |
1616
// each user has a chance of (p - (previousP ?? 0)) to be assigned
1717
const potentialAssignees = [
18-
["fvictorio", 0.5],
19-
["schaable", 0.75],
18+
["fvictorio", 1/3],
19+
["schaable", 2/3],
2020
["ChristopherDedominici", 1.0],
2121
];
2222

.github/workflows/release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
release:
1010
name: Release
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
1215
steps:
1316
- name: Checkout Repo
1417
uses: actions/checkout@v2

.github/workflows/test-slow-imports-rule.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install
3333
run: pnpm install --frozen-lockfile --prefer-offline
3434
- name: Add slow import
35-
run: echo 'import "lodash";' >> src/internal/constants.ts
35+
run: echo 'import "lodash";' >> src/internal/core/config/config-resolution.ts
3636
- name: Build
3737
run: pnpm build
3838
- name: Run eslint

config/eslint/constants.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports.slowImportsCommonIgnoredModules = [
77
"source-map-support/register",
88
"@nomicfoundation/hardhat-ethers",
99
"hardhat/common",
10+
"hardhat/common/bigInt",
1011
"hardhat/config",
1112
"hardhat/plugins",
1213
"hardhat/types",

docs/.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
ignore-workspace-root-check=true
2+
enable-pre-post-scripts=true

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ Landing pages don't support themes.
200200

201201
## Creating new landings
202202

203-
Landing pages contains special "blocks" see src/components/landingBlocks. To create a new landing page start from copying `/pages/index.tsx` and `src/content/home.ts`. You can create another page by reodering existing blocks and passing another content to them. If necessary create new landing blocks.
203+
Landing pages contains special "blocks" see src/components/landingBlocks. To create a new landing page start from copying `/pages/index.tsx` and `src/content/home.ts`. You can create another page by reordering existing blocks and passing another content to them. If necessary create new landing blocks.
204204

205205
## CI/CD
206206

docs/redirects.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ const customRedirects = [
309309
destination: "/hardhat-runner/plugins/nomicfoundation-hardhat-ethers",
310310
permanent: false,
311311
},
312+
{
313+
source: "/release/:version",
314+
destination:
315+
"https://github.com/NomicFoundation/hardhat/releases/tag/hardhat%40:version",
316+
permanent: false,
317+
},
312318
...loadErrorRedirects(),
313319
];
314320

docs/src/content/hardhat-runner/docs/advanced/create-task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ npm install --save-dev @nomicfoundation/hardhat-toolbox
6363
:::tab{value="npm 6"}
6464

6565
```
66-
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
66+
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
6767
```
6868

6969
:::
7070

7171
:::tab{value="yarn"}
7272

7373
```
74-
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
74+
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
7575
```
7676

7777
:::

docs/src/content/hardhat-runner/docs/advanced/migrating-from-hardhat-waffle.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Follow these steps to migrate your project to Hardhat Toolbox.
1717
:::tab{value="npm 7+"}
1818

1919
```
20-
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
20+
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
2121
```
2222

2323
:::
2424

2525
:::tab{value="npm 6"}
2626

2727
```
28-
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
28+
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
2929
```
3030

3131
:::
@@ -55,15 +55,15 @@ Follow these steps to migrate your project to Hardhat Toolbox.
5555
:::tab{value="npm 6"}
5656

5757
```
58-
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
58+
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
5959
```
6060

6161
:::
6262

6363
:::tab{value="yarn"}
6464

6565
```
66-
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers@1 @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers@5 hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
66+
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers@1 @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai@4 ethers@5 hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
6767
```
6868

6969
:::

docs/src/content/hardhat-runner/docs/advanced/using-viem.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Use the `hre.viem` object to get these helpers, similar to how clients are used.
105105
const initialSupply = await myToken.read.getCurrentSupply();
106106
console.log(`Initial supply of MyToken: ${initialSupply}`);
107107

108-
await myToken.write.increaseSupply([500_000n]);
108+
const hash = await myToken.write.increaseSupply([500_000n]);
109109
// increaseSupply sends a tx, so we need to wait for it to be mined
110110
const publicClient = await hre.viem.getPublicClient();
111111
await publicClient.waitForTransactionReceipt({ hash });

docs/src/content/hardhat-runner/docs/getting-started/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ You can run it using `npx hardhat run`:
273273

274274
```
275275
$ npx hardhat run scripts/deploy.ts
276-
Lock with 1 ETH deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
276+
Lock with 0.001ETH deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
277277
```
278278

279279
:::
@@ -282,7 +282,7 @@ Lock with 1 ETH deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
282282

283283
```
284284
$ npx hardhat run scripts/deploy.js
285-
Lock with 1 ETH deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
285+
Lock with 0.001ETH deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
286286
```
287287

288288
:::

docs/src/content/hardhat-runner/docs/guides/typescript.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ To be able to write your tests in TypeScript, you also need these packages:
5353
:::tab{value="npm 7+"}
5454

5555
```
56-
npm install --save-dev chai @types/node @types/mocha @types/chai
56+
npm install --save-dev chai@4 @types/node @types/mocha @types/chai@4
5757
```
5858

5959
:::
6060

6161
:::tab{value="npm 6"}
6262

6363
```
64-
npm install --save-dev chai @types/node @types/mocha @types/chai
64+
npm install --save-dev chai@4 @types/node @types/mocha @types/chai@4
6565
```
6666

6767
:::
6868

6969
:::tab{value=yarn}
7070

7171
```
72-
yarn add --dev chai @types/node @types/mocha @types/chai
72+
yarn add --dev chai@4 @types/node @types/mocha @types/chai@4
7373
```
7474

7575
:::

docs/src/content/hardhat-runner/docs/other-guides/waffle-testing.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ Then install [`chai`](https://www.chaijs.com/), the `@nomiclabs/hardhat-waffle`
5252
:::tab{value="npm 7+"}
5353

5454
```
55-
npm install --save-dev chai @nomiclabs/hardhat-waffle
55+
npm install --save-dev chai@4 @nomiclabs/hardhat-waffle
5656
```
5757

5858
:::
5959

6060
:::tab{value="npm 6"}
6161

6262
```
63-
npm install --save-dev chai @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers ethers@5
63+
npm install --save-dev chai@4 @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers ethers@5
6464
```
6565

6666
:::
6767

6868
:::tab{value="yarn"}
6969

7070
```
71-
yarn add --dev chai @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers ethers@5
71+
yarn add --dev chai@4 @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers ethers@5
7272
```
7373

7474
:::

docs/src/content/hardhat-runner/plugins/plugins.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ const communityPlugins: IPlugin[] = [
748748
tags: ["transaction", "gasPrice", "retry", "helper"],
749749
},
750750
{
751-
name: "hardhat-fireblocks",
751+
name: "@fireblocks/hardhat-fireblocks",
752752
author: "Fireblocks",
753753
authorUrl: "https://github.com/fireblocks",
754754
description: "Hardhat plugin for integrating with Fireblocks",
@@ -863,6 +863,13 @@ const communityPlugins: IPlugin[] = [
863863
"Display different signatures that have the methods, events and errors of your contracts by console",
864864
tags: ["functions", "errors", "events", "tooling", "selectorss"],
865865
},
866+
{
867+
name: "@dgma/hardhat-sol-bundler",
868+
author: "Dogma Labs",
869+
authorUrl: "https://github.com/dgma",
870+
description: "Build and deploy only changed smartcontracts",
871+
tags: ["deployment", "diff deployment", "ethers.js", "proxy"],
872+
},
866873
];
867874

868875
const officialPlugins: IPlugin[] = [

docs/src/content/ignition/docs/guides/creating-modules.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ m.call(myContract, "receivesEth" [], {
122122

123123
### Reading a value from a contract
124124

125-
If you need to call a `view` or `pure` function in a contract to retreive a value, you can do it with `m.staticCall`:
125+
If you need to call a `view` or `pure` function in a contract to retrieve a value, you can do it with `m.staticCall`:
126126

127127
```js
128128
const balance = m.staticCall(token, "balanceOf", [address]);
@@ -165,7 +165,7 @@ Calling `m.send` will create a `Future` representing the sending action. The fir
165165

166166
The second argument is the address of the account where you want to send the ETH or data to.
167167

168-
The third and forth parameters are both optional. They represent the amount of ETH and the data to be sent.
168+
The third and fourth parameters are both optional. They represent the amount of ETH and the data to be sent.
169169

170170
### Deploying a library
171171

@@ -179,7 +179,7 @@ If you need to link libraries take a look at the [Linking Libraries](#linking-li
179179

180180
## `Future` IDs
181181

182-
Each `Future` that is created should have a unique ID. In most cases, Hardhat Ignition will automatically generate an ID for the every `Future` you create, based on the creation parameters.
182+
Each `Future` that is created should have a unique ID. In most cases, Hardhat Ignition will automatically generate an ID for every `Future` you create, based on the creation parameters.
183183

184184
In some cases, this automatic process may lead to an ID clash with an existing `Future`. If that happens, Hardhat Ignition won't try to resolve the clash, and you will need to define an ID manually to resolve the issue. Every method of `ModuleBuilder` accepts an options object as last argument, which has an `id` field that can be used like this:
185185

docs/src/content/tutorial/creating-a-new-hardhat-project.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ npm install --save-dev @nomicfoundation/hardhat-toolbox
143143
:::tab{value="npm 6"}
144144

145145
```
146-
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
146+
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
147147
```
148148

149149
:::
150150

151151
:::tab{value=yarn}
152152

153153
```
154-
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
154+
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
155155
```
156156

157157
:::

packages/eslint-plugin-slow-imports/lib/rules/no-top-level-external-import.js

+19-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"use strict";
66
const fs = require("node:fs");
77
const { isBuiltin } = require("node:module");
8-
const resolve = require("eslint-module-utils/resolve").default;
8+
const { relative } = require("eslint-module-utils/resolve");
99
const parse = require("eslint-module-utils/parse").default;
1010
const visit = require("eslint-module-utils/visit").default;
1111
const { visitModules } = require("../helpers/module-visitor");
@@ -45,6 +45,8 @@ module.exports = {
4545
messages: {
4646
ENFORCE_DYNAMIC_IMPORT:
4747
"This import transitively imports the slow dependency '{{dependency}}' in file '{{filename}}' at line {{line}}",
48+
CANNOT_RESOLVE_MODULE:
49+
"Unable to resolve the absolute module path. This is likely an error in the rule configuration or the file paths.",
4850
},
4951
},
5052

@@ -55,7 +57,7 @@ module.exports = {
5557
function visitor(filename, originalNode, node) {
5658
const modulePath = node.value;
5759
if (ignoreModules.has(modulePath) || isBuiltin(modulePath)) {
58-
return {};
60+
return;
5961
}
6062

6163
function detectTopLevelExternalDependency(path) {
@@ -80,10 +82,22 @@ module.exports = {
8082
}
8183

8284
if (!isExternalModule(modulePath)) {
83-
const absoluteModulePath = resolve(modulePath, context);
85+
const absoluteModulePath = relative(
86+
modulePath,
87+
filename,
88+
context.settings
89+
);
90+
91+
if (!absoluteModulePath) {
92+
context.report({
93+
node: originalNode,
94+
messageId: "CANNOT_RESOLVE_MODULE",
95+
});
96+
return;
97+
}
8498

85-
if (!absoluteModulePath || traversed.has(absoluteModulePath)) {
86-
return {};
99+
if (traversed.has(absoluteModulePath)) {
100+
return;
87101
}
88102

89103
traversed.add(absoluteModulePath);

packages/hardhat-chai-matchers/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @nomicfoundation/hardhat-chai-matchers
22

3+
## 2.0.4
4+
5+
### Patch Changes
6+
7+
- ffb301f14: Improved loading performance
8+
39
## 2.0.3
410

511
### Patch Changes

packages/hardhat-chai-matchers/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ npm install --save-dev @nomicfoundation/hardhat-chai-matchers
1717
If you are using an older version of npm, you'll also need to install all the packages used by the plugin.
1818

1919
```bash
20-
npm install --save-dev @nomicfoundation/hardhat-chai-matchers chai @nomicfoundation/hardhat-ethers ethers
20+
npm install --save-dev @nomicfoundation/hardhat-chai-matchers chai@4 @nomicfoundation/hardhat-ethers ethers
2121
```
2222

2323
That's also the case if you are using yarn:
2424

2525
```bash
26-
yarn add --dev @nomicfoundation/hardhat-chai-matchers chai @nomicfoundation/hardhat-ethers ethers
26+
yarn add --dev @nomicfoundation/hardhat-chai-matchers chai@4 @nomicfoundation/hardhat-ethers ethers
2727
```
2828

2929
### Usage

packages/hardhat-chai-matchers/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nomicfoundation/hardhat-chai-matchers",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Hardhat utils for testing",
55
"homepage": "https://github.com/nomicfoundation/hardhat/tree/main/packages/hardhat-chai-matchers",
66
"repository": "github:nomicfoundation/hardhat",

packages/hardhat-chai-matchers/src/internal/addressable.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { isAddress, isAddressable } from "ethers";
1+
import type EthersT from "ethers";
2+
23
import { tryDereference } from "./typed";
34

45
export function supportAddressable(
@@ -27,6 +28,8 @@ function override(
2728
// so we are looking for a sync way of getting the address. If an address was recovered, it is returned as a string,
2829
// otherwise undefined is returned.
2930
function tryGetAddressSync(value: any): string | undefined {
31+
const { isAddress, isAddressable } = require("ethers") as typeof EthersT;
32+
3033
value = tryDereference(value, "address");
3134
if (isAddressable(value)) {
3235
value = (value as any).address ?? (value as any).target;

packages/hardhat-chai-matchers/src/internal/changeEtherBalances.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type EthersT from "ethers";
22
import type { Addressable, BigNumberish, TransactionResponse } from "ethers";
33
import type { BalanceChangeOptions } from "./misc/balance";
4-
5-
import ordinal from "ordinal";
4+
import type OrdinalT from "ordinal";
65

76
import { buildAssert } from "../utils";
87
import { getAddressOf } from "./misc/account";
@@ -23,6 +22,7 @@ export function supportChangeEtherBalances(
2322
options?: BalanceChangeOptions
2423
) {
2524
const { toBigInt } = require("ethers") as typeof EthersT;
25+
const ordinal = require("ordinal") as typeof OrdinalT;
2626
// capture negated flag before async code executes; see buildAssert's jsdoc
2727
const negated = this.__flags.negate;
2828

0 commit comments

Comments
 (0)