hardhat 3.0.0-next.4 → 3.0.0-next.6

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 (117) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/src/internal/builtin-plugins/coverage/index.d.ts +1 -0
  3. package/dist/src/internal/builtin-plugins/coverage/index.d.ts.map +1 -1
  4. package/dist/src/internal/builtin-plugins/coverage/index.js +12 -6
  5. package/dist/src/internal/builtin-plugins/coverage/index.js.map +1 -1
  6. package/dist/src/internal/builtin-plugins/coverage/type-extensions.d.ts +7 -0
  7. package/dist/src/internal/builtin-plugins/coverage/type-extensions.d.ts.map +1 -0
  8. package/dist/src/internal/builtin-plugins/coverage/type-extensions.js +2 -0
  9. package/dist/src/internal/builtin-plugins/coverage/type-extensions.js.map +1 -0
  10. package/dist/src/internal/builtin-plugins/index.d.ts +1 -0
  11. package/dist/src/internal/builtin-plugins/index.d.ts.map +1 -1
  12. package/dist/src/internal/builtin-plugins/index.js +2 -0
  13. package/dist/src/internal/builtin-plugins/index.js.map +1 -1
  14. package/dist/src/internal/builtin-plugins/network-manager/base-provider.d.ts.map +1 -1
  15. package/dist/src/internal/builtin-plugins/network-manager/base-provider.js +2 -5
  16. package/dist/src/internal/builtin-plugins/network-manager/base-provider.js.map +1 -1
  17. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.d.ts +2 -1
  18. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.d.ts.map +1 -1
  19. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +76 -75
  20. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
  21. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-context.js +2 -2
  22. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-context.js.map +1 -1
  23. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +2 -1
  24. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
  25. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +6 -7
  26. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  27. package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts +18 -3
  28. package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts.map +1 -1
  29. package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js +78 -25
  30. package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js.map +1 -1
  31. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +3 -5
  32. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
  33. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +71 -81
  34. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
  35. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.d.ts +3 -2
  36. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.d.ts.map +1 -1
  37. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.js +9 -4
  38. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.js.map +1 -1
  39. package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.d.ts.map +1 -1
  40. package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js +5 -3
  41. package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js.map +1 -1
  42. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts +2 -0
  43. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts.map +1 -1
  44. package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
  45. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +60 -26
  46. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js.map +1 -1
  47. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
  48. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +2 -2
  49. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
  50. package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.d.ts.map +1 -1
  51. package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.js +4 -2
  52. package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.js.map +1 -1
  53. package/dist/src/internal/builtin-plugins/telemetry/index.d.ts +4 -0
  54. package/dist/src/internal/builtin-plugins/telemetry/index.d.ts.map +1 -0
  55. package/dist/src/internal/builtin-plugins/telemetry/index.js +20 -0
  56. package/dist/src/internal/builtin-plugins/telemetry/index.js.map +1 -0
  57. package/dist/src/internal/builtin-plugins/telemetry/task-action.d.ts +8 -0
  58. package/dist/src/internal/builtin-plugins/telemetry/task-action.d.ts.map +1 -0
  59. package/dist/src/internal/builtin-plugins/telemetry/task-action.js +25 -0
  60. package/dist/src/internal/builtin-plugins/telemetry/task-action.js.map +1 -0
  61. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  62. package/dist/src/internal/cli/init/init.js +0 -4
  63. package/dist/src/internal/cli/init/init.js.map +1 -1
  64. package/dist/src/internal/cli/main.d.ts.map +1 -1
  65. package/dist/src/internal/cli/main.js +0 -3
  66. package/dist/src/internal/cli/main.js.map +1 -1
  67. package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts +1 -1
  68. package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts.map +1 -1
  69. package/dist/src/internal/cli/telemetry/analytics/analytics.js +7 -7
  70. package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
  71. package/dist/src/internal/cli/telemetry/analytics/types.d.ts +3 -3
  72. package/dist/src/internal/cli/telemetry/analytics/types.d.ts.map +1 -1
  73. package/dist/src/internal/cli/telemetry/sentry/subprocess.js +1 -0
  74. package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
  75. package/dist/src/internal/cli/telemetry/telemetry-permissions.d.ts +5 -15
  76. package/dist/src/internal/cli/telemetry/telemetry-permissions.d.ts.map +1 -1
  77. package/dist/src/internal/cli/telemetry/telemetry-permissions.js +29 -65
  78. package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
  79. package/dist/src/types/utils.d.ts +6 -0
  80. package/dist/src/types/utils.d.ts.map +1 -1
  81. package/package.json +8 -8
  82. package/src/internal/builtin-plugins/coverage/index.ts +13 -6
  83. package/src/internal/builtin-plugins/coverage/type-extensions.ts +6 -0
  84. package/src/internal/builtin-plugins/index.ts +3 -0
  85. package/src/internal/builtin-plugins/network-manager/base-provider.ts +2 -7
  86. package/src/internal/builtin-plugins/network-manager/config-resolution.ts +86 -73
  87. package/src/internal/builtin-plugins/network-manager/edr/edr-context.ts +4 -4
  88. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +17 -17
  89. package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +75 -8
  90. package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +98 -91
  91. package/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.ts +19 -5
  92. package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.ts +44 -33
  93. package/src/internal/builtin-plugins/network-manager/type-extensions/config.ts +2 -0
  94. package/src/internal/builtin-plugins/network-manager/type-validation.ts +79 -37
  95. package/src/internal/builtin-plugins/solidity-test/reporter.ts +4 -3
  96. package/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.ts +4 -2
  97. package/src/internal/builtin-plugins/telemetry/index.ts +23 -0
  98. package/src/internal/builtin-plugins/telemetry/task-action.ts +45 -0
  99. package/src/internal/cli/init/init.ts +0 -5
  100. package/src/internal/cli/main.ts +0 -5
  101. package/src/internal/cli/telemetry/analytics/analytics.ts +11 -11
  102. package/src/internal/cli/telemetry/analytics/types.ts +3 -3
  103. package/src/internal/cli/telemetry/sentry/subprocess.ts +1 -0
  104. package/src/internal/cli/telemetry/telemetry-permissions.ts +35 -84
  105. package/src/types/utils.ts +7 -0
  106. package/templates/01-node-test-runner-viem/package.json +2 -2
  107. package/templates/02-mocha-ethers/package.json +2 -2
  108. package/dist/src/internal/builtin-plugins/coverage/task-action.d.ts +0 -2
  109. package/dist/src/internal/builtin-plugins/coverage/task-action.d.ts.map +0 -1
  110. package/dist/src/internal/builtin-plugins/coverage/task-action.js +0 -5
  111. package/dist/src/internal/builtin-plugins/coverage/task-action.js.map +0 -1
  112. package/dist/src/internal/cli/prompt/prompt.d.ts +0 -9
  113. package/dist/src/internal/cli/prompt/prompt.d.ts.map +0 -1
  114. package/dist/src/internal/cli/prompt/prompt.js +0 -43
  115. package/dist/src/internal/cli/prompt/prompt.js.map +0 -1
  116. package/src/internal/builtin-plugins/coverage/task-action.ts +0 -9
  117. package/src/internal/cli/prompt/prompt.ts +0 -53
@@ -23,7 +23,6 @@ import * as semver from "semver";
23
23
  import { findClosestHardhatConfig } from "../../config-loading.js";
24
24
  import { HARDHAT_NAME } from "../../constants.js";
25
25
  import { getHardhatVersion } from "../../utils/package.js";
26
- import { ensureTelemetryConsent } from "../telemetry/telemetry-permissions.js";
27
26
 
28
27
  import {
29
28
  getDevDependenciesInstallationCommand,
@@ -101,10 +100,6 @@ export async function initHardhat(options?: InitHardhatOptions): Promise<void> {
101
100
  // Overwrite existing files only if the user opts-in to it
102
101
  await copyProjectFiles(workspace, template, options?.force);
103
102
 
104
- // Ensure telemetry consent first so that we are allowed to also track
105
- // the unfinished init flows
106
- await ensureTelemetryConsent();
107
-
108
103
  // Print the commands to install the project dependencies
109
104
  // Run them only if the user opts-in to it
110
105
  await installProjectDependencies(workspace, template, options?.install);
@@ -38,7 +38,6 @@ import { getGlobalHelpString } from "./help/get-global-help-string.js";
38
38
  import { getHelpString } from "./help/get-help-string.js";
39
39
  import { sendTaskAnalytics } from "./telemetry/analytics/analytics.js";
40
40
  import { sendErrorTelemetry } from "./telemetry/sentry/reporter.js";
41
- import { ensureTelemetryConsent } from "./telemetry/telemetry-permissions.js";
42
41
  import { printVersionMessage } from "./version.js";
43
42
 
44
43
  export interface MainOptions {
@@ -81,10 +80,6 @@ export async function main(
81
80
  return await initHardhat();
82
81
  }
83
82
 
84
- await ensureTelemetryConsent();
85
-
86
- log("Retrieved telemetry consent");
87
-
88
83
  configPath = await resolveHardhatConfigPath(
89
84
  builtinGlobalOptions.configPath,
90
85
  );
@@ -2,7 +2,7 @@ import type {
2
2
  EventNames,
3
3
  Payload,
4
4
  TaskParams,
5
- TelemetryConsentPayload,
5
+ TelemetryConfigPayload,
6
6
  } from "./types.js";
7
7
 
8
8
  import os from "node:os";
@@ -24,25 +24,25 @@ const SESSION_ID = Math.random().toString();
24
24
  const ENGAGEMENT_TIME_MSEC = "10000";
25
25
 
26
26
  // Return a boolean for testing purposes to verify that analytics are not sent in CI environments
27
- export async function sendTelemetryConsentAnalytics(
28
- consent: boolean,
27
+ export async function sendTelemetryConfigAnalytics(
28
+ enabled: boolean,
29
29
  ): Promise<boolean> {
30
- // This is a special scenario where only the consent is sent, all the other analytics info
31
- // (like node version, hardhat version, etc.) are stripped.
30
+ // This is a special scenario where only the telemetry config is sent,
31
+ // all the other analytics info (like node version, hardhat version, etc.) are stripped.
32
32
 
33
33
  if (!isTelemetryAllowedInEnvironment()) {
34
34
  return false;
35
35
  }
36
36
 
37
- const payload: TelemetryConsentPayload = {
38
- client_id: "hardhat_telemetry_consent",
39
- user_id: "hardhat_telemetry_consent",
37
+ const payload: TelemetryConfigPayload = {
38
+ client_id: "hardhat_telemetry_config",
39
+ user_id: "hardhat_telemetry_config",
40
40
  user_properties: {},
41
41
  events: [
42
42
  {
43
- name: "TelemetryConsentResponse",
43
+ name: "TelemetryConfig",
44
44
  params: {
45
- userConsent: consent ? "yes" : "no",
45
+ enabled,
46
46
  },
47
47
  },
48
48
  ],
@@ -78,7 +78,7 @@ async function sendAnalytics(
78
78
  }
79
79
 
80
80
  async function createSubprocessToSendAnalytics(
81
- payload: TelemetryConsentPayload | Payload,
81
+ payload: TelemetryConfigPayload | Payload,
82
82
  ): Promise<void> {
83
83
  log(
84
84
  `Sending analytics for '${payload.events[0].name}'. Payload: ${JSON.stringify(payload)}`,
@@ -22,11 +22,11 @@ export interface BasePayload {
22
22
  }>;
23
23
  }
24
24
 
25
- export interface TelemetryConsentPayload extends BasePayload {
25
+ export interface TelemetryConfigPayload extends BasePayload {
26
26
  events: Array<{
27
- name: "TelemetryConsentResponse";
27
+ name: "TelemetryConfig";
28
28
  params: {
29
- userConsent: "yes" | "no";
29
+ enabled: boolean;
30
30
  session_id?: string;
31
31
  };
32
32
  }>;
@@ -11,6 +11,7 @@ import { SENTRY_DSN } from "./reporter.js";
11
11
  try {
12
12
  init({
13
13
  dsn: SENTRY_DSN,
14
+ serverName: "<user-server>",
14
15
  });
15
16
  } catch (error) {
16
17
  process.exit(1);
@@ -9,68 +9,33 @@ import {
9
9
  import { getTelemetryDir } from "@nomicfoundation/hardhat-utils/global-dir";
10
10
  import debug from "debug";
11
11
 
12
- import { confirmationPromptWithTimeout } from "../prompt/prompt.js";
13
-
14
- import { sendTelemetryConsentAnalytics } from "./analytics/analytics.js";
12
+ import { sendTelemetryConfigAnalytics } from "./analytics/analytics.js";
15
13
 
16
14
  const log = debug("hardhat:cli:telemetry:telemetry-permissions");
17
15
 
18
- interface TelemetryConsent {
19
- consent: boolean;
16
+ interface TelemetryConfig {
17
+ enabled: boolean;
20
18
  }
21
19
 
22
20
  /**
23
- * Ensure that the user's telemetry consent is set. If the consent is already provided, returns the answer.
24
- * If not, prompts the user to provide it.
25
- * Consent is only asked in interactive environments.
21
+ * Checks whether telemetry is supported in the current environment and whether the user did not explicitly disable it.
26
22
  *
27
- * @param telemetryConsentFilePath - The path to the telemetry consent file,
28
- * which should only be provided in tests.
29
- * @returns True if the user consents to telemetry and if current environment supports telemetry, false otherwise.
30
- */
31
- export async function ensureTelemetryConsent(
32
- telemetryConsentFilePath?: string,
33
- ): Promise<boolean> {
34
- log("Ensuring that user has provided telemetry consent");
35
-
36
- if (!isTelemetryAllowedInEnvironment()) {
37
- return false;
38
- }
39
-
40
- const consent = await getTelemetryConsent(telemetryConsentFilePath);
41
- if (consent !== undefined) {
42
- return consent;
43
- }
44
-
45
- // Telemetry consent not provided yet, ask for it
46
- return requestTelemetryConsent();
47
- }
48
-
49
- /**
50
- * Checks whether telemetry is supported in the current environment and whether the user has provided consent.
51
- *
52
- * @param telemetryConsentFilePath - The path to the telemetry consent file,
53
- * which should only be provided in tests.
54
- * @returns True if the user consents to telemetry and if current environment supports telemetry, false otherwise.
23
+ * @param telemetryConfigFilePath - The path to the telemetry config file, which should only be provided in tests.
24
+ * @returns True if the user did not explicitly disable telemetry and if current environment supports it, false otherwise.
55
25
  */
56
26
  export async function isTelemetryAllowed(
57
- telemetryConsentFilePath?: string,
27
+ telemetryConfigFilePath?: string,
58
28
  ): Promise<boolean> {
59
29
  if (!isTelemetryAllowedInEnvironment()) {
60
30
  return false;
61
31
  }
62
32
 
63
33
  // ATTENTION: only for testing
64
- if (process.env.HARDHAT_TEST_TELEMETRY_CONSENT_VALUE !== undefined) {
65
- return process.env.HARDHAT_TEST_TELEMETRY_CONSENT_VALUE === "true"
66
- ? true
67
- : false;
34
+ if (process.env.HARDHAT_TEST_TELEMETRY_ENABLED !== undefined) {
35
+ return process.env.HARDHAT_TEST_TELEMETRY_ENABLED === "true" ? true : false;
68
36
  }
69
37
 
70
- const consent = await getTelemetryConsent(telemetryConsentFilePath);
71
- log(`Telemetry consent value: ${consent}`);
72
-
73
- return consent !== undefined ? consent : false;
38
+ return isTelemetryEnabled(telemetryConfigFilePath);
74
39
  }
75
40
 
76
41
  /**
@@ -85,7 +50,7 @@ export function isTelemetryAllowedInEnvironment(): boolean {
85
50
  const allowed =
86
51
  (!isCi() &&
87
52
  process.stdout.isTTY === true &&
88
- process.env.HARDHAT_DISABLE_TELEMETRY_PROMPT !== "true") ||
53
+ process.env.HARDHAT_DISABLE_TELEMETRY !== "true") ||
89
54
  // ATTENTION: used in tests to force telemetry execution
90
55
  process.env.HARDHAT_TEST_INTERACTIVE_ENV === "true";
91
56
 
@@ -95,58 +60,44 @@ export function isTelemetryAllowedInEnvironment(): boolean {
95
60
  }
96
61
 
97
62
  /**
98
- * Retrieves the user's telemetry consent status from the consent file.
63
+ * Retrieves the user's telemetry enabled status from the config file.
99
64
  *
100
- * @param telemetryConsentFilePath - The path to the telemetry consent file,
101
- * which should only be provided in tests.
102
- * @returns True if the user consents to telemetry, false if they do not consent,
103
- * and undefined if no consent has been provided.
65
+ * @param telemetryConfigFilePath - The path to the telemetry config file, which should only be provided in tests.
66
+ * @returns True if the user did not explicitly disable telemetry, false otherwise.
104
67
  */
105
- async function getTelemetryConsent(telemetryConsentFilePath?: string) {
106
- telemetryConsentFilePath ??= await getTelemetryConsentFilePath();
107
-
108
- log(`Looking for telemetry consent file at ${telemetryConsentFilePath}`);
68
+ async function isTelemetryEnabled(
69
+ telemetryConfigFilePath?: string,
70
+ ): Promise<boolean> {
71
+ telemetryConfigFilePath ??= await getTelemetryConfigFilePath();
109
72
 
110
- if (await exists(telemetryConsentFilePath)) {
111
- // Telemetry consent was already provided, hence return the answer
112
- const consent = (
113
- await readJsonFile<TelemetryConsent>(telemetryConsentFilePath)
114
- ).consent;
73
+ log(`Looking for telemetry config file at ${telemetryConfigFilePath}`);
115
74
 
116
- log(`Telemetry consent value: ${consent}`);
75
+ if (await exists(telemetryConfigFilePath)) {
76
+ // Telemetry enabled value was explicitly set, hence return the answer
77
+ const { enabled } = await readJsonFile<TelemetryConfig>(
78
+ telemetryConfigFilePath,
79
+ );
80
+ log(`Telemetry enabled value: ${enabled}`);
117
81
 
118
- return consent;
82
+ return enabled;
119
83
  }
120
84
 
121
- log("No telemetry consent file found");
85
+ log("No telemetry config file found, assuming telemetry is enabled");
122
86
 
123
- return undefined;
87
+ return true;
124
88
  }
125
89
 
126
- async function getTelemetryConsentFilePath() {
90
+ async function getTelemetryConfigFilePath() {
127
91
  const configDir = await getTelemetryDir();
128
- return path.join(configDir, "telemetry-consent.json");
92
+ return path.join(configDir, "telemetry-config.json");
129
93
  }
130
94
 
131
- async function requestTelemetryConsent(): Promise<boolean> {
132
- const consent = await confirmTelemetryConsent();
95
+ export async function setTelemetryEnabled(value: boolean): Promise<boolean> {
96
+ log(`Storing telemetry enabled value: ${value}`);
133
97
 
134
- if (consent === undefined) {
135
- return false;
136
- }
137
-
138
- log(`Storing telemetry consent with value: ${consent}`);
139
-
140
- await writeJsonFile(await getTelemetryConsentFilePath(), { consent });
98
+ await writeJsonFile(await getTelemetryConfigFilePath(), { enabled: value });
141
99
 
142
- await sendTelemetryConsentAnalytics(consent);
143
-
144
- return consent;
145
- }
100
+ await sendTelemetryConfigAnalytics(value);
146
101
 
147
- async function confirmTelemetryConsent(): Promise<boolean | undefined> {
148
- return confirmationPromptWithTimeout(
149
- "telemetryConsent",
150
- "Help us improve Hardhat with anonymous crash reports & basic usage data?",
151
- );
102
+ return value;
152
103
  }
@@ -43,3 +43,10 @@ export type Params<T> = T extends (...args: infer P) => any ? P : never;
43
43
  * The return type of a function.
44
44
  */
45
45
  export type Return<T> = T extends (...args: any[]) => infer Ret ? Ret : never;
46
+
47
+ /**
48
+ * The same type as T, but with the specified keys required.
49
+ */
50
+ export type RequireField<T, K extends keyof T> = T & {
51
+ [P in K]-?: T[P];
52
+ };
@@ -5,8 +5,8 @@
5
5
  "description": "A TypeScript Hardhat project using Node Test Runner and Viem",
6
6
  "type": "module",
7
7
  "devDependencies": {
8
- "hardhat": "workspace:^3.0.0-next.4",
9
- "@nomicfoundation/hardhat-toolbox-viem": "workspace:^4.0.0-next.4",
8
+ "hardhat": "workspace:^3.0.0-next.6",
9
+ "@nomicfoundation/hardhat-toolbox-viem": "workspace:^4.0.0-next.6",
10
10
  "@types/node": "^22.8.5",
11
11
  "forge-std": "foundry-rs/forge-std#v1.9.4",
12
12
  "typescript": "~5.5.0",
@@ -5,8 +5,8 @@
5
5
  "description": "A TypeScript Hardhat project using Mocha and Ethers.js",
6
6
  "type": "module",
7
7
  "devDependencies": {
8
- "hardhat": "workspace:^3.0.0-next.4",
9
- "@nomicfoundation/hardhat-toolbox-mocha-ethers": "workspace:^3.0.0-next.4",
8
+ "hardhat": "workspace:^3.0.0-next.6",
9
+ "@nomicfoundation/hardhat-toolbox-mocha-ethers": "workspace:^3.0.0-next.6",
10
10
  "@types/chai": "^4.2.0",
11
11
  "@types/chai-as-promised": "^8.0.1",
12
12
  "@types/mocha": ">=10.0.10",
@@ -1,2 +0,0 @@
1
- export default function (): Promise<void>;
2
- //# sourceMappingURL=task-action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-action.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/task-action.ts"],"names":[],"mappings":"AAEA,4BAAkC,OAAO,CAAC,IAAI,CAAC,CAM9C"}
@@ -1,5 +0,0 @@
1
- import chalk from "chalk";
2
- export default async function () {
3
- console.log(chalk.yellow("This task will be implemented soon. Check back soon for more updates."));
4
- }
5
- //# sourceMappingURL=task-action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-action.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/task-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,OAAO,CAAC,KAAK;IAClB,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CACV,uEAAuE,CACxE,CACF,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Display a confirmation prompt to the user. The prompt will be canceled if no response is given within a specified time limit.
3
- * @param name Used as the key for the answer on the returned values (answers) object.
4
- * @param message The message to display when the prompt is rendered in the terminal.
5
- * @param timeoutMilliseconds After how much time the prompt will be cancelled if no answer is given.
6
- * @returns True or false based on the user input, or undefined if the prompt times out.
7
- */
8
- export declare function confirmationPromptWithTimeout(name: string, message: string, timeoutMilliseconds?: number): Promise<boolean | undefined>;
9
- //# sourceMappingURL=prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../src/internal/cli/prompt/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,mBAAmB,GAAE,MAAe,GACnC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CA+B9B"}
@@ -1,43 +0,0 @@
1
- /**
2
- * Display a confirmation prompt to the user. The prompt will be canceled if no response is given within a specified time limit.
3
- * @param name Used as the key for the answer on the returned values (answers) object.
4
- * @param message The message to display when the prompt is rendered in the terminal.
5
- * @param timeoutMilliseconds After how much time the prompt will be cancelled if no answer is given.
6
- * @returns True or false based on the user input, or undefined if the prompt times out.
7
- */
8
- export async function confirmationPromptWithTimeout(name, message, timeoutMilliseconds = 10_000) {
9
- let timeout;
10
- try {
11
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- The types in the module "enquirer" are not properly defined
12
- const { default: enquirer } = (await import("enquirer"));
13
- const prompt = new enquirer.prompts.Confirm(createConfirmationPrompt(name, message));
14
- // The timeout is a safety measure in case Hardhat is executed in a CI or another non-interactive environment and we do not detect it.
15
- // Instead of blocking the process indefinitely, we abort the prompt after a while.
16
- const timeoutPromise = new Promise((resolve) => {
17
- timeout = setTimeout(resolve, timeoutMilliseconds);
18
- });
19
- const result = await Promise.race([
20
- prompt.run(),
21
- timeoutPromise,
22
- ]);
23
- if (result === undefined) {
24
- await prompt.cancel();
25
- }
26
- return result;
27
- }
28
- finally {
29
- // We can always clear the timeout, even if not set, this API is safe to
30
- // call with invalid values.
31
- clearTimeout(timeout);
32
- }
33
- }
34
- function createConfirmationPrompt(name, message) {
35
- return {
36
- type: "confirm",
37
- name,
38
- message,
39
- initial: "y",
40
- default: "(Y/n)",
41
- };
42
- }
43
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../src/internal/cli/prompt/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,IAAY,EACZ,OAAe,EACf,sBAA8B,MAAM;IAEpC,IAAI,OAAO,CAAC;IACZ,IAAI,CAAC;QACH,wIAAwI;QACxI,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAQ,CAAC;QAEhE,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,CACzC,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,CACxC,CAAC;QAEF,sIAAsI;QACtI,mFAAmF;QACnF,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7C,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAwB,MAAM,OAAO,CAAC,IAAI,CAAC;YACrD,MAAM,CAAC,GAAG,EAAE;YACZ,cAAc;SACf,CAAC,CAAC;QAEH,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,wEAAwE;QACxE,4BAA4B;QAC5B,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAY,EAAE,OAAe;IAC7D,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI;QACJ,OAAO;QACP,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- import chalk from "chalk";
2
-
3
- export default async function (): Promise<void> {
4
- console.log(
5
- chalk.yellow(
6
- "This task will be implemented soon. Check back soon for more updates.",
7
- ),
8
- );
9
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * Display a confirmation prompt to the user. The prompt will be canceled if no response is given within a specified time limit.
3
- * @param name Used as the key for the answer on the returned values (answers) object.
4
- * @param message The message to display when the prompt is rendered in the terminal.
5
- * @param timeoutMilliseconds After how much time the prompt will be cancelled if no answer is given.
6
- * @returns True or false based on the user input, or undefined if the prompt times out.
7
- */
8
- export async function confirmationPromptWithTimeout(
9
- name: string,
10
- message: string,
11
- timeoutMilliseconds: number = 10_000,
12
- ): Promise<boolean | undefined> {
13
- let timeout;
14
- try {
15
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- The types in the module "enquirer" are not properly defined
16
- const { default: enquirer } = (await import("enquirer")) as any;
17
-
18
- const prompt = new enquirer.prompts.Confirm(
19
- createConfirmationPrompt(name, message),
20
- );
21
-
22
- // The timeout is a safety measure in case Hardhat is executed in a CI or another non-interactive environment and we do not detect it.
23
- // Instead of blocking the process indefinitely, we abort the prompt after a while.
24
- const timeoutPromise = new Promise((resolve) => {
25
- timeout = setTimeout(resolve, timeoutMilliseconds);
26
- });
27
-
28
- const result: boolean | undefined = await Promise.race([
29
- prompt.run(),
30
- timeoutPromise,
31
- ]);
32
-
33
- if (result === undefined) {
34
- await prompt.cancel();
35
- }
36
-
37
- return result;
38
- } finally {
39
- // We can always clear the timeout, even if not set, this API is safe to
40
- // call with invalid values.
41
- clearTimeout(timeout);
42
- }
43
- }
44
-
45
- function createConfirmationPrompt(name: string, message: string) {
46
- return {
47
- type: "confirm",
48
- name,
49
- message,
50
- initial: "y",
51
- default: "(Y/n)",
52
- };
53
- }