hardhat 3.10.0 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  3. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +11 -7
  4. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  5. package/dist/src/internal/cli/init/init.d.ts +3 -8
  6. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  7. package/dist/src/internal/cli/init/init.js +9 -27
  8. package/dist/src/internal/cli/init/init.js.map +1 -1
  9. package/dist/src/internal/cli/init/prompt.d.ts +0 -1
  10. package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
  11. package/dist/src/internal/cli/init/prompt.js +0 -24
  12. package/dist/src/internal/cli/init/prompt.js.map +1 -1
  13. package/dist/src/internal/cli/init/template.d.ts +1 -1
  14. package/dist/src/internal/cli/init/template.d.ts.map +1 -1
  15. package/dist/src/internal/cli/init/template.js +2 -2
  16. package/dist/src/internal/cli/init/template.js.map +1 -1
  17. package/dist/src/internal/cli/main.js +1 -1
  18. package/dist/src/internal/cli/main.js.map +1 -1
  19. package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts +1 -1
  20. package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts.map +1 -1
  21. package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
  22. package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
  23. package/dist/src/internal/cli/telemetry/analytics/types.d.ts +1 -1
  24. package/dist/src/internal/cli/telemetry/analytics/types.d.ts.map +1 -1
  25. package/package.json +3 -3
  26. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +13 -6
  27. package/src/internal/cli/init/init.ts +4 -38
  28. package/src/internal/cli/init/prompt.ts +0 -31
  29. package/src/internal/cli/init/template.ts +2 -4
  30. package/src/internal/cli/main.ts +1 -1
  31. package/src/internal/cli/telemetry/analytics/analytics.ts +1 -2
  32. package/src/internal/cli/telemetry/analytics/types.ts +1 -1
  33. package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/package.json +1 -1
  34. package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/package.json +1 -1
  35. package/templates/{hardhat-3/03-minimal → 03-minimal}/package.json +1 -1
  36. package/templates/hardhat-2/01-mocha-ethers-js/README.md +0 -13
  37. package/templates/hardhat-2/01-mocha-ethers-js/contracts/Lock.sol +0 -34
  38. package/templates/hardhat-2/01-mocha-ethers-js/gitignore +0 -17
  39. package/templates/hardhat-2/01-mocha-ethers-js/hardhat.config.js +0 -6
  40. package/templates/hardhat-2/01-mocha-ethers-js/ignition/modules/Lock.js +0 -18
  41. package/templates/hardhat-2/01-mocha-ethers-js/package.json +0 -23
  42. package/templates/hardhat-2/01-mocha-ethers-js/test/Lock.js +0 -126
  43. package/templates/hardhat-2/02-mocha-ethers-js-esm/README.md +0 -13
  44. package/templates/hardhat-2/02-mocha-ethers-js-esm/contracts/Lock.sol +0 -34
  45. package/templates/hardhat-2/02-mocha-ethers-js-esm/gitignore +0 -17
  46. package/templates/hardhat-2/02-mocha-ethers-js-esm/hardhat.config.cjs +0 -6
  47. package/templates/hardhat-2/02-mocha-ethers-js-esm/ignition/modules/Lock.js +0 -18
  48. package/templates/hardhat-2/02-mocha-ethers-js-esm/package.json +0 -24
  49. package/templates/hardhat-2/02-mocha-ethers-js-esm/test/Lock.js +0 -128
  50. package/templates/hardhat-2/03-mocha-ethers-ts/README.md +0 -13
  51. package/templates/hardhat-2/03-mocha-ethers-ts/contracts/Lock.sol +0 -34
  52. package/templates/hardhat-2/03-mocha-ethers-ts/gitignore +0 -17
  53. package/templates/hardhat-2/03-mocha-ethers-ts/hardhat.config.ts +0 -8
  54. package/templates/hardhat-2/03-mocha-ethers-ts/ignition/modules/Lock.ts +0 -20
  55. package/templates/hardhat-2/03-mocha-ethers-ts/package.json +0 -28
  56. package/templates/hardhat-2/03-mocha-ethers-ts/test/Lock.ts +0 -127
  57. package/templates/hardhat-2/03-mocha-ethers-ts/tsconfig.json +0 -11
  58. package/templates/hardhat-2/04-mocha-viem-ts/README.md +0 -13
  59. package/templates/hardhat-2/04-mocha-viem-ts/contracts/Lock.sol +0 -34
  60. package/templates/hardhat-2/04-mocha-viem-ts/gitignore +0 -17
  61. package/templates/hardhat-2/04-mocha-viem-ts/hardhat.config.ts +0 -8
  62. package/templates/hardhat-2/04-mocha-viem-ts/ignition/modules/Lock.ts +0 -21
  63. package/templates/hardhat-2/04-mocha-viem-ts/package.json +0 -25
  64. package/templates/hardhat-2/04-mocha-viem-ts/test/Lock.ts +0 -134
  65. package/templates/hardhat-2/04-mocha-viem-ts/tsconfig.json +0 -11
  66. package/templates/hardhat-2/05-empty-hardhat-config-js/hardhat.config.js +0 -4
  67. package/templates/hardhat-2/05-empty-hardhat-config-js/package.json +0 -9
  68. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/AGENTS.md +0 -0
  69. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/README.md +0 -0
  70. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/contracts/Counter.sol +0 -0
  71. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/contracts/Counter.t.sol +0 -0
  72. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/gitignore +0 -0
  73. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/hardhat.config.ts +0 -0
  74. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/ignition/modules/Counter.ts +0 -0
  75. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/scripts/send-op-tx.ts +0 -0
  76. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/test/Counter.ts +0 -0
  77. /package/templates/{hardhat-3/01-node-test-runner-viem → 01-node-test-runner-viem}/tsconfig.json +0 -0
  78. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/AGENTS.md +0 -0
  79. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/README.md +0 -0
  80. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/contracts/Counter.sol +0 -0
  81. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/contracts/Counter.t.sol +0 -0
  82. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/gitignore +0 -0
  83. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/hardhat.config.ts +0 -0
  84. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/ignition/modules/Counter.ts +0 -0
  85. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/scripts/send-op-tx.ts +0 -0
  86. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/test/Counter.ts +0 -0
  87. /package/templates/{hardhat-3/02-mocha-ethers → 02-mocha-ethers}/tsconfig.json +0 -0
  88. /package/templates/{hardhat-3/03-minimal → 03-minimal}/README.md +0 -0
  89. /package/templates/{hardhat-3/03-minimal → 03-minimal}/gitignore +0 -0
  90. /package/templates/{hardhat-3/03-minimal → 03-minimal}/hardhat.config.ts +0 -0
  91. /package/templates/{hardhat-3/03-minimal → 03-minimal}/tsconfig.json +0 -0
@@ -1,134 +0,0 @@
1
- import {
2
- time,
3
- loadFixture,
4
- } from "@nomicfoundation/hardhat-toolbox-viem/network-helpers";
5
- import { expect } from "chai";
6
- import hre from "hardhat";
7
- import { getAddress, parseGwei } from "viem";
8
-
9
- describe("Lock", function () {
10
- // We define a fixture to reuse the same setup in every test.
11
- // We use loadFixture to run this setup once, snapshot that state,
12
- // and reset Hardhat Network to that snapshot in every test.
13
- async function deployOneYearLockFixture() {
14
- const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60;
15
-
16
- const lockedAmount = parseGwei("1");
17
- const unlockTime = BigInt((await time.latest()) + ONE_YEAR_IN_SECS);
18
-
19
- // Contracts are deployed using the first signer/account by default
20
- const [owner, otherAccount] = await hre.viem.getWalletClients();
21
-
22
- const lock = await hre.viem.deployContract("Lock", [unlockTime], {
23
- value: lockedAmount,
24
- });
25
-
26
- const publicClient = await hre.viem.getPublicClient();
27
-
28
- return {
29
- lock,
30
- unlockTime,
31
- lockedAmount,
32
- owner,
33
- otherAccount,
34
- publicClient,
35
- };
36
- }
37
-
38
- describe("Deployment", function () {
39
- it("Should set the right unlockTime", async function () {
40
- const { lock, unlockTime } = await loadFixture(deployOneYearLockFixture);
41
-
42
- expect(await lock.read.unlockTime()).to.equal(unlockTime);
43
- });
44
-
45
- it("Should set the right owner", async function () {
46
- const { lock, owner } = await loadFixture(deployOneYearLockFixture);
47
-
48
- expect(await lock.read.owner()).to.equal(
49
- getAddress(owner.account.address),
50
- );
51
- });
52
-
53
- it("Should receive and store the funds to lock", async function () {
54
- const { lock, lockedAmount, publicClient } = await loadFixture(
55
- deployOneYearLockFixture,
56
- );
57
-
58
- expect(
59
- await publicClient.getBalance({
60
- address: lock.address,
61
- }),
62
- ).to.equal(lockedAmount);
63
- });
64
-
65
- it("Should fail if the unlockTime is not in the future", async function () {
66
- // We don't use the fixture here because we want a different deployment
67
- const latestTime = BigInt(await time.latest());
68
- await expect(
69
- hre.viem.deployContract("Lock", [latestTime], {
70
- value: 1n,
71
- }),
72
- ).to.be.rejectedWith("Unlock time should be in the future");
73
- });
74
- });
75
-
76
- describe("Withdrawals", function () {
77
- describe("Validations", function () {
78
- it("Should revert with the right error if called too soon", async function () {
79
- const { lock } = await loadFixture(deployOneYearLockFixture);
80
-
81
- await expect(lock.write.withdraw()).to.be.rejectedWith(
82
- "You can't withdraw yet",
83
- );
84
- });
85
-
86
- it("Should revert with the right error if called from another account", async function () {
87
- const { lock, unlockTime, otherAccount } = await loadFixture(
88
- deployOneYearLockFixture,
89
- );
90
-
91
- // We can increase the time in Hardhat Network
92
- await time.increaseTo(unlockTime);
93
-
94
- // We retrieve the contract with a different account to send a transaction
95
- const lockAsOtherAccount = await hre.viem.getContractAt(
96
- "Lock",
97
- lock.address,
98
- { client: { wallet: otherAccount } },
99
- );
100
- await expect(lockAsOtherAccount.write.withdraw()).to.be.rejectedWith(
101
- "You aren't the owner",
102
- );
103
- });
104
-
105
- it("Shouldn't fail if the unlockTime has arrived and the owner calls it", async function () {
106
- const { lock, unlockTime } = await loadFixture(
107
- deployOneYearLockFixture,
108
- );
109
-
110
- // Transactions are sent using the first signer by default
111
- await time.increaseTo(unlockTime);
112
-
113
- await expect(lock.write.withdraw()).to.be.fulfilled;
114
- });
115
- });
116
-
117
- describe("Events", function () {
118
- it("Should emit an event on withdrawals", async function () {
119
- const { lock, unlockTime, lockedAmount, publicClient } =
120
- await loadFixture(deployOneYearLockFixture);
121
-
122
- await time.increaseTo(unlockTime);
123
-
124
- const hash = await lock.write.withdraw();
125
- await publicClient.waitForTransactionReceipt({ hash });
126
-
127
- // get the withdrawal events in the latest block
128
- const withdrawalEvents = await lock.getEvents.Withdrawal();
129
- expect(withdrawalEvents).to.have.lengthOf(1);
130
- expect(withdrawalEvents[0].args.amount).to.equal(lockedAmount);
131
- });
132
- });
133
- });
134
- });
@@ -1,11 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2020",
4
- "module": "commonjs",
5
- "esModuleInterop": true,
6
- "forceConsistentCasingInFileNames": true,
7
- "strict": true,
8
- "skipLibCheck": true,
9
- "resolveJsonModule": true
10
- }
11
- }
@@ -1,4 +0,0 @@
1
- /** @type import('hardhat/config').HardhatUserConfig */
2
- module.exports = {
3
- solidity: "0.8.28",
4
- };
@@ -1,9 +0,0 @@
1
- {
2
- "name": "template-v2-empty-hardhat-config-js",
3
- "private": true,
4
- "version": "0.0.1",
5
- "description": "An empty config file (hardhat.config.js)",
6
- "devDependencies": {
7
- "hardhat": "^2.14.0"
8
- }
9
- }