Socket
Socket
Sign inDemoInstall

hardhat

Package Overview
Dependencies
Maintainers
3
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardhat - npm Package Compare versions

Comparing version 2.19.2 to 2.19.4

internal/util/report-telemetry-consent.d.ts

2

internal/cli/analytics.d.ts

@@ -23,6 +23,8 @@ type AbortAnalytics = () => void;

sendTaskHit(scopeName: string | undefined, taskName: string): Promise<[AbortAnalytics, Promise<void>]>;
sendTelemetryConsentHit(userConsent: "yes" | "no"): Promise<[AbortAnalytics, Promise<void>]>;
private _buildTaskHitPayload;
private _sendHit;
}
export declare function requestTelemetryConsent(): Promise<boolean | undefined>;
export {};
//# sourceMappingURL=analytics.d.ts.map

@@ -29,5 +29,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Analytics = void 0;
exports.requestTelemetryConsent = exports.Analytics = void 0;
const debug_1 = __importDefault(require("debug"));
const os_1 = __importDefault(require("os"));
const node_os_1 = __importDefault(require("node:os"));
const node_path_1 = require("node:path");
const node_child_process_1 = require("node:child_process");
const execution_mode_1 = require("../core/execution-mode");

@@ -37,2 +39,3 @@ const ci_detection_1 = require("../util/ci-detection");

const packageInfo_1 = require("../util/packageInfo");
const prompt_1 = require("./prompt");
const log = (0, debug_1.default)("hardhat:core:analytics");

@@ -77,2 +80,18 @@ class Analytics {

}
async sendTelemetryConsentHit(userConsent) {
const telemetryConsentHitPayload = {
client_id: "hardhat_telemetry_consent",
user_id: "hardhat_telemetry_consent",
user_properties: {},
events: [
{
name: "TelemetryConsentResponse",
params: {
userConsent,
},
},
],
};
return this._sendHit(telemetryConsentHitPayload);
}
async _buildTaskHitPayload(eventParams = {}) {

@@ -86,3 +105,3 @@ return {

hardhatVersion: { value: await getHardhatVersion() },
operatingSystem: { value: os_1.default.platform() },
operatingSystem: { value: node_os_1.default.platform() },
nodeVersion: { value: process.version },

@@ -157,2 +176,17 @@ },

}
async function requestTelemetryConsent() {
const telemetryConsent = await (0, prompt_1.confirmTelemetryConsent)();
if (telemetryConsent === undefined) {
return;
}
(0, global_dir_1.writeTelemetryConsent)(telemetryConsent);
const reportTelemetryConsentPath = (0, node_path_1.join)(__dirname, "..", "util", "report-telemetry-consent.js");
const subprocess = (0, node_child_process_1.spawn)(process.execPath, [reportTelemetryConsentPath, telemetryConsent ? "yes" : "no"], {
detached: true,
stdio: "ignore",
});
subprocess.unref();
return telemetryConsent;
}
exports.requestTelemetryConsent = requestTelemetryConsent;
//# sourceMappingURL=analytics.js.map

16

internal/cli/cli.js

@@ -155,6 +155,3 @@ "use strict";

process.env.HARDHAT_DISABLE_TELEMETRY_PROMPT !== "true") {
telemetryConsent = await (0, prompt_1.confirmTelemetryConsent)();
if (telemetryConsent !== undefined) {
(0, global_dir_1.writeTelemetryConsent)(telemetryConsent);
}
telemetryConsent = await (0, analytics_1.requestTelemetryConsent)();
}

@@ -228,2 +225,9 @@ const analytics = await analytics_1.Analytics.getInstance(telemetryConsent);

await suggestInstallingHardhatVscode();
// we show the solidity survey message if the tests failed and only
// 1/3 of the time
if (process.exitCode !== 0 &&
Math.random() < 0.3333 &&
process.env.HARDHAT_HIDE_SOLIDITY_SURVEY_MESSAGE !== "true") {
(0, project_creation_1.showSoliditySurveyMessage)();
}
// we show the viaIR warning only if the tests failed

@@ -288,3 +292,5 @@ if (process.exitCode !== 0) {

process.env.HARDHAT_CREATE_JAVASCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined) {
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_VIEM_PROJECT_WITH_DEFAULTS !==
undefined) {
await (0, project_creation_1.createProject)();

@@ -291,0 +297,0 @@ return;

export declare const EMPTY_HARDHAT_CONFIG = "/** @type import('hardhat/config').HardhatUserConfig */\nmodule.exports = {\n solidity: \"0.8.19\",\n};\n";
export declare function showSoliditySurveyMessage(): void;
export declare function createProject(): Promise<void>;
//# sourceMappingURL=project-creation.d.ts.map

@@ -29,6 +29,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createProject = exports.EMPTY_HARDHAT_CONFIG = void 0;
exports.createProject = exports.showSoliditySurveyMessage = exports.EMPTY_HARDHAT_CONFIG = void 0;
const chalk_1 = __importDefault(require("chalk"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));

@@ -44,4 +43,6 @@ const constants_1 = require("../constants");

const strings_1 = require("../util/strings");
const ci_detection_1 = require("../util/ci-detection");
const prompt_1 = require("./prompt");
const emoji_1 = require("./emoji");
const analytics_1 = require("./analytics");
var Action;

@@ -207,2 +208,6 @@ (function (Action) {

}
else if (process.env.HARDHAT_CREATE_TYPESCRIPT_VIEM_PROJECT_WITH_DEFAULTS !==
undefined) {
return Action.CREATE_TYPESCRIPT_VIEM_PROJECT_ACTION;
}
const { default: enquirer } = await Promise.resolve().then(() => __importStar(require("enquirer")));

@@ -277,2 +282,11 @@ try {

}
function showSoliditySurveyMessage() {
if (new Date() > new Date("2024-01-07 23:39")) {
// the survey has finished
return;
}
console.log();
console.log(chalk_1.default.cyan("Please take a moment to complete the 2023 Solidity Survey: https://hardhat.org/solidity-survey-2023"));
}
exports.showSoliditySurveyMessage = showSoliditySurveyMessage;
async function createProject() {

@@ -311,2 +325,3 @@ printAsciiLogo();

showStarOnGitHubMessage();
showSoliditySurveyMessage();
return;

@@ -316,3 +331,5 @@ }

const useDefaultPromptResponses = process.env.HARDHAT_CREATE_JAVASCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined;
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_VIEM_PROJECT_WITH_DEFAULTS !==
undefined;
if (useDefaultPromptResponses) {

@@ -341,7 +358,5 @@ responses = {

if (process.env.HARDHAT_DISABLE_TELEMETRY_PROMPT !== "true" &&
!(0, ci_detection_1.isRunningOnCiServer)() &&
(0, global_dir_1.hasConsentedTelemetry)() === undefined) {
const telemetryConsent = await (0, prompt_1.confirmTelemetryConsent)();
if (telemetryConsent !== undefined) {
(0, global_dir_1.writeTelemetryConsent)(telemetryConsent);
}
await (0, analytics_1.requestTelemetryConsent)();
}

@@ -380,9 +395,7 @@ await copySampleProject(projectRoot, action, isEsm);

showStarOnGitHubMessage();
showSoliditySurveyMessage();
}
exports.createProject = createProject;
async function canInstallRecommendedDeps() {
return ((await fs_extra_1.default.pathExists("package.json")) &&
// TODO: Figure out why this doesn't work on Win
// cf. https://github.com/nomiclabs/hardhat/issues/1698
os_1.default.type() !== "Windows_NT");
return fs_extra_1.default.pathExists("package.json");
}

@@ -424,3 +437,3 @@ function isInstalled(dep) {

// The reason we don't quote the dependencies here is because they are going
// to be used in child_process.sapwn, which doesn't require escaping string,
// to be used in child_process.spawn, which doesn't require escaping string,
// and can actually fail if you do.

@@ -435,2 +448,3 @@ const installCmd = await getRecommendedDependenciesInstallationCommand(dependencies, false);

stdio: "inherit",
shell: true,
});

@@ -437,0 +451,0 @@ return new Promise((resolve, reject) => {

@@ -1,3 +0,3 @@

export declare const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.22";
export declare const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.23";
export declare const FIRST_SOLC_VERSION_SUPPORTED = "0.5.1";
//# sourceMappingURL=constants.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FIRST_SOLC_VERSION_SUPPORTED = exports.SUPPORTED_SOLIDITY_VERSION_RANGE = void 0;
exports.SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.22";
exports.SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.23";
exports.FIRST_SOLC_VERSION_SUPPORTED = "0.5.1";
//# sourceMappingURL=constants.js.map

@@ -240,3 +240,3 @@ "use strict";

getScriptNameOrSourceURL() {
return null;
return "";
}

@@ -267,3 +267,15 @@ getThis() {

}
getScriptHash() {
return "";
}
getEnclosingColumnNumber() {
return 0;
}
getEnclosingLineNumber() {
return 0;
}
toString() {
return "[SolidityCallSite]";
}
}
//# sourceMappingURL=solidity-errors.js.map

@@ -65,2 +65,3 @@ "use strict";

"0.8.22": "shanghai",
"0.8.23": "shanghai",
};

@@ -67,0 +68,0 @@ function getEvmVersionFromSolcVersion(solcVersion) {

{
"name": "hardhat",
"version": "2.19.2",
"version": "2.19.4",
"author": "Nomic Labs LLC",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -6,4 +6,6 @@ import {

import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs.js";
import { expect } from "chai";
import chai from "chai";
const { expect } = chai;
describe("Lock", function () {

@@ -10,0 +12,0 @@ // We define a fixture to reuse the same setup in every test.

import type { request as RequestT } from "undici";
import debug from "debug";
import os from "os";
import os from "node:os";
import { join } from "node:path";
import { spawn } from "node:child_process";

@@ -13,4 +15,6 @@ import { isLocalDev } from "../core/execution-mode";

writeAnalyticsId,
writeTelemetryConsent,
} from "../util/global-dir";
import { getPackageJson } from "../util/packageInfo";
import { confirmTelemetryConsent } from "./prompt";

@@ -23,2 +27,13 @@ const log = debug("hardhat:core:analytics");

user_id: string;
user_properties: {};
events: Array<{
name: string;
params: {
engagement_time_msec?: string;
session_id?: string;
};
}>;
}
interface TaskHitPayload extends AnalyticsPayload {
user_properties: {

@@ -42,11 +57,23 @@ projectId: {

events: Array<{
name: string;
name: "task";
params: {
engagement_time_msec: string;
session_id: string;
engagement_time_msec?: string;
session_id?: string;
scope?: string;
task?: string;
};
}>;
}
/* eslint-enable @typescript-eslint/naming-convention */
interface TelemetryConsentHitPayload extends AnalyticsPayload {
events: Array<{
name: "TelemetryConsentResponse";
params: {
engagement_time_msec?: string;
session_id?: string;
userConsent: "yes" | "no";
};
}>;
}
type AbortAnalytics = () => void;

@@ -115,2 +142,21 @@

public async sendTelemetryConsentHit(
userConsent: "yes" | "no"
): Promise<[AbortAnalytics, Promise<void>]> {
const telemetryConsentHitPayload: TelemetryConsentHitPayload = {
client_id: "hardhat_telemetry_consent",
user_id: "hardhat_telemetry_consent",
user_properties: {},
events: [
{
name: "TelemetryConsentResponse",
params: {
userConsent,
},
},
],
};
return this._sendHit(telemetryConsentHitPayload);
}
private async _buildTaskHitPayload(

@@ -121,3 +167,3 @@ eventParams: {

} = {}
): Promise<AnalyticsPayload> {
): Promise<TaskHitPayload> {
return {

@@ -215,1 +261,31 @@ client_id: this._clientId,

}
export async function requestTelemetryConsent() {
const telemetryConsent = await confirmTelemetryConsent();
if (telemetryConsent === undefined) {
return;
}
writeTelemetryConsent(telemetryConsent);
const reportTelemetryConsentPath = join(
__dirname,
"..",
"util",
"report-telemetry-consent.js"
);
const subprocess = spawn(
process.execPath,
[reportTelemetryConsentPath, telemetryConsent ? "yes" : "no"],
{
detached: true,
stdio: "ignore",
}
);
subprocess.unref();
return telemetryConsent;
}

@@ -37,3 +37,2 @@ import chalk from "chalk";

writePromptedForHHVSCode,
writeTelemetryConsent,
} from "../util/global-dir";

@@ -43,7 +42,7 @@ import { getPackageJson } from "../util/packageInfo";

import { saveFlamegraph } from "../core/flamegraph";
import { Analytics } from "./analytics";
import { Analytics, requestTelemetryConsent } from "./analytics";
import { ArgumentsParser } from "./ArgumentsParser";
import { enableEmoji } from "./emoji";
import { createProject } from "./project-creation";
import { confirmHHVSCodeInstallation, confirmTelemetryConsent } from "./prompt";
import { createProject, showSoliditySurveyMessage } from "./project-creation";
import { confirmHHVSCodeInstallation } from "./prompt";
import {

@@ -252,7 +251,3 @@ InstallationState,

) {
telemetryConsent = await confirmTelemetryConsent();
if (telemetryConsent !== undefined) {
writeTelemetryConsent(telemetryConsent);
}
telemetryConsent = await requestTelemetryConsent();
}

@@ -364,2 +359,12 @@

// we show the solidity survey message if the tests failed and only
// 1/3 of the time
if (
process.exitCode !== 0 &&
Math.random() < 0.3333 &&
process.env.HARDHAT_HIDE_SOLIDITY_SURVEY_MESSAGE !== "true"
) {
showSoliditySurveyMessage();
}
// we show the viaIR warning only if the tests failed

@@ -442,3 +447,5 @@ if (process.exitCode !== 0) {

process.env.HARDHAT_CREATE_JAVASCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_VIEM_PROJECT_WITH_DEFAULTS !==
undefined
) {

@@ -445,0 +452,0 @@ await createProject();

import chalk from "chalk";
import fsExtra from "fs-extra";
import os from "os";
import path from "path";

@@ -11,6 +10,3 @@

import { getAllFilesMatching } from "../util/fs-utils";
import {
hasConsentedTelemetry,
writeTelemetryConsent,
} from "../util/global-dir";
import { hasConsentedTelemetry } from "../util/global-dir";
import { fromEntries } from "../util/lang";

@@ -23,5 +19,5 @@ import {

import { pluralize } from "../util/strings";
import { isRunningOnCiServer } from "../util/ci-detection";
import {
confirmRecommendedDepsInstallation,
confirmTelemetryConsent,
confirmProjectCreation,

@@ -31,2 +27,3 @@ } from "./prompt";

import { Dependencies, PackageManager } from "./types";
import { requestTelemetryConsent } from "./analytics";

@@ -285,2 +282,7 @@ enum Action {

return Action.CREATE_TYPESCRIPT_PROJECT_ACTION;
} else if (
process.env.HARDHAT_CREATE_TYPESCRIPT_VIEM_PROJECT_WITH_DEFAULTS !==
undefined
) {
return Action.CREATE_TYPESCRIPT_VIEM_PROJECT_ACTION;
}

@@ -365,2 +367,16 @@

export function showSoliditySurveyMessage() {
if (new Date() > new Date("2024-01-07 23:39")) {
// the survey has finished
return;
}
console.log();
console.log(
chalk.cyan(
"Please take a moment to complete the 2023 Solidity Survey: https://hardhat.org/solidity-survey-2023"
)
);
}
export async function createProject() {

@@ -411,2 +427,3 @@ printAsciiLogo();

showStarOnGitHubMessage();
showSoliditySurveyMessage();

@@ -423,3 +440,5 @@ return;

process.env.HARDHAT_CREATE_JAVASCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined;
process.env.HARDHAT_CREATE_TYPESCRIPT_PROJECT_WITH_DEFAULTS !== undefined ||
process.env.HARDHAT_CREATE_TYPESCRIPT_VIEM_PROJECT_WITH_DEFAULTS !==
undefined;

@@ -452,9 +471,6 @@ if (useDefaultPromptResponses) {

process.env.HARDHAT_DISABLE_TELEMETRY_PROMPT !== "true" &&
!isRunningOnCiServer() &&
hasConsentedTelemetry() === undefined
) {
const telemetryConsent = await confirmTelemetryConsent();
if (telemetryConsent !== undefined) {
writeTelemetryConsent(telemetryConsent);
}
await requestTelemetryConsent();
}

@@ -517,11 +533,7 @@

showStarOnGitHubMessage();
showSoliditySurveyMessage();
}
async function canInstallRecommendedDeps() {
return (
(await fsExtra.pathExists("package.json")) &&
// TODO: Figure out why this doesn't work on Win
// cf. https://github.com/nomiclabs/hardhat/issues/1698
os.type() !== "Windows_NT"
);
return fsExtra.pathExists("package.json");
}

@@ -569,3 +581,3 @@

// The reason we don't quote the dependencies here is because they are going
// to be used in child_process.sapwn, which doesn't require escaping string,
// to be used in child_process.spawn, which doesn't require escaping string,
// and can actually fail if you do.

@@ -589,2 +601,3 @@ const installCmd = await getRecommendedDependenciesInstallationCommand(

stdio: "inherit",
shell: true,
});

@@ -591,0 +604,0 @@

@@ -1,2 +0,2 @@

export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.22";
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.23";
export const FIRST_SOLC_VERSION_SUPPORTED = "0.5.1";

@@ -394,3 +394,3 @@ import { bufferToHex } from "@nomicfoundation/ethereumjs-util";

public getScriptNameOrSourceURL() {
return null;
return "";
}

@@ -429,2 +429,18 @@

}
public getScriptHash(): string {
return "";
}
public getEnclosingColumnNumber(): number {
return 0;
}
public getEnclosingLineNumber(): number {
return 0;
}
public toString(): string {
return "[SolidityCallSite]";
}
}

@@ -62,2 +62,3 @@ const defaultEvmTargets: { [key: string]: string } = {

"0.8.22": "shanghai",
"0.8.23": "shanghai",
};

@@ -64,0 +65,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc