@nomicfoundation/hardhat-errors 3.0.0-next.0

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.
@@ -0,0 +1,1611 @@
1
+ /**
2
+ * A description of a kind of error that Hardhat can throw.
3
+ */
4
+ export interface ErrorDescriptor {
5
+ /**
6
+ * The error number, which should be unique.
7
+ */
8
+ number: number;
9
+
10
+ /**
11
+ * The id of the plugin that throws this error.
12
+ */
13
+ pluginId?: string;
14
+
15
+ /**
16
+ * A tempalte of the message of the error.
17
+ *
18
+ * This should be a short description. If possible, it should tell the user
19
+ * how to solve their problem.
20
+ *
21
+ * @see The `applyErrorMessageTemplate` function.
22
+ */
23
+ messageTemplate: string;
24
+
25
+ /**
26
+ * `true` if this error should be reported
27
+ */
28
+ shouldBeReported?: true;
29
+
30
+ /**
31
+ * The title to use on the website section explaining this error, which can
32
+ * use markdown.
33
+ */
34
+ websiteTitle: string;
35
+
36
+ /**
37
+ * The description to use on the website section explaining this error, which
38
+ * can use markdown.
39
+ */
40
+ websiteDescription: string;
41
+ }
42
+
43
+ export const ERROR_CATEGORIES: {
44
+ [categoryName: string]: {
45
+ min: number;
46
+ max: number;
47
+ websiteTitle: string;
48
+ };
49
+ } = {
50
+ GENERAL: { min: 1, max: 99, websiteTitle: "General errors" },
51
+ INTERNAL: { min: 100, max: 199, websiteTitle: "Internal Hardhat errors" },
52
+ PLUGINS: {
53
+ min: 200,
54
+ max: 299,
55
+ websiteTitle: "Plugin errors",
56
+ },
57
+ HOOKS: {
58
+ min: 300,
59
+ max: 399,
60
+ websiteTitle: "Hooks errors",
61
+ },
62
+ TASK_DEFINITIONS: {
63
+ min: 400,
64
+ max: 499,
65
+ websiteTitle: "Task definition errors",
66
+ },
67
+ ARGUMENTS: { min: 500, max: 599, websiteTitle: "Arguments related errors" },
68
+ BUILTIN_TASKS: { min: 600, max: 699, websiteTitle: "Built-in tasks errors" },
69
+ NETWORK: { min: 700, max: 799, websiteTitle: "Network errors" },
70
+ KEYSTORE: { min: 800, max: 899, websiteTitle: "Keystore errors" },
71
+ NETWORK_HELPERS: {
72
+ min: 900,
73
+ max: 999,
74
+ websiteTitle: "Network-helpers errors",
75
+ },
76
+ SOLIDITY_TESTS: {
77
+ min: 1000,
78
+ max: 1099,
79
+ websiteTitle: "Solidity tests errors",
80
+ },
81
+ ETHERS: {
82
+ min: 1100,
83
+ max: 1199,
84
+ websiteTitle: "Ethers errors",
85
+ },
86
+ SOLIDITY: { min: 1200, max: 1299, websiteTitle: "Solidity errors" },
87
+ VIEM: { min: 1300, max: 1399, websiteTitle: "Hardhat-viem errors" },
88
+ NODE: { min: 1400, max: 1499, websiteTitle: "Hardhat node errors" },
89
+ CHAI_MATCHERS: {
90
+ min: 1500,
91
+ max: 1599,
92
+ websiteTitle: "Hardhat-ethers-chai-matchers errors",
93
+ },
94
+ ARTIFACTS: {
95
+ min: 1600,
96
+ max: 1699,
97
+ websiteTitle: "Compilation artifacts related errors",
98
+ },
99
+ IGNITION: {
100
+ min: 1700,
101
+ max: 1799,
102
+ websiteTitle: "Hardhat Ignition errors",
103
+ },
104
+ };
105
+
106
+ export const ERRORS = {
107
+ GENERAL: {
108
+ NOT_INSIDE_PROJECT: {
109
+ number: 1,
110
+ messageTemplate: "You are not inside a Hardhat project.",
111
+ websiteTitle: "You are not inside a Hardhat project",
112
+ websiteDescription: `You are trying to run Hardhat outside of a Hardhat project.
113
+
114
+ You can learn how to use Hardhat by reading the [Getting Started guide](/hardhat-runner/docs/getting-started).`,
115
+ },
116
+ DUPLICATED_PLUGIN_ID: {
117
+ number: 2,
118
+ shouldBeReported: true,
119
+ messageTemplate:
120
+ 'Duplicated plugin id "{id}" found. Did you install multiple versions of the same plugin?',
121
+ websiteTitle: "Duplicated plugin id",
122
+ websiteDescription: `While loading the plugins, two different plugins where found with the same id.
123
+
124
+ Please double check whether you have multiple versions of the same plugin installed.`,
125
+ },
126
+ NO_CONFIG_FILE_FOUND: {
127
+ number: 3,
128
+ messageTemplate:
129
+ "No Hardhat config file found.\n\nYou can initialize a new project by running Hardhat with --init",
130
+ websiteTitle: "No Hardhat config file found",
131
+ websiteDescription:
132
+ "Hardhat couldn't find a config file in the current directory or any of its parents.",
133
+ },
134
+ INVALID_CONFIG_PATH: {
135
+ number: 4,
136
+ messageTemplate: "Config file {configPath} not found",
137
+ websiteTitle: "Invalid config path",
138
+ websiteDescription: "The config file doesn't exist at the provided path.",
139
+ },
140
+ NO_CONFIG_EXPORTED: {
141
+ number: 5,
142
+ messageTemplate: "No config exported in {configPath}",
143
+ websiteTitle: "No config exported",
144
+ websiteDescription: "There is nothing exported from the config file.",
145
+ },
146
+ INVALID_CONFIG_OBJECT: {
147
+ number: 6,
148
+ messageTemplate: "Invalid config exported in {configPath}",
149
+ websiteTitle: "Invalid config object",
150
+ websiteDescription:
151
+ "The config file doesn't export a valid configuration object.",
152
+ },
153
+ ENV_VAR_NOT_FOUND: {
154
+ number: 7,
155
+ messageTemplate: `Configuration Variable "{name}" not found.
156
+
157
+ You can define it using a plugin like hardhat-keystore, or set it as an environment variable.`,
158
+ websiteTitle: "Configuration variable not found",
159
+ websiteDescription: `A configuration variable was expected to be set as an environment variable, but it wasn't.`,
160
+ },
161
+ INVALID_URL: {
162
+ number: 8,
163
+ messageTemplate: "Invalid URL: {url}",
164
+ websiteTitle: "Invalid URL",
165
+ websiteDescription: `Given value was not a valid URL.`,
166
+ },
167
+ INVALID_BIGINT: {
168
+ number: 9,
169
+ messageTemplate: "Invalid BigInt: {value}",
170
+ websiteTitle: "Invalid BigInt",
171
+ websiteDescription: `Given value was not a valid BigInt.`,
172
+ },
173
+ HARDHAT_PROJECT_ALREADY_CREATED: {
174
+ number: 10,
175
+ messageTemplate:
176
+ "You are trying to initialize a project inside an existing Hardhat project. The path to the project's configuration file is: {hardhatProjectRootPath}.",
177
+ websiteTitle: "Hardhat project already created",
178
+ websiteDescription: `Cannot create a new Hardhat project, the current folder is already associated with a project.`,
179
+ },
180
+ NOT_IN_INTERACTIVE_SHELL: {
181
+ number: 11,
182
+ messageTemplate:
183
+ "You are trying to initialize a project but you are not in an interactive shell.",
184
+ websiteTitle: "Not inside an interactive shell",
185
+ websiteDescription: `You are trying to initialize a project but you are not in an interactive shell.
186
+
187
+ Please re-run the command inside an interactive shell.`,
188
+ },
189
+ UNSUPPORTED_OPERATION: {
190
+ number: 12,
191
+ messageTemplate: "{operation} is not supported in Hardhat.",
192
+ websiteTitle: "Unsupported operation",
193
+ websiteDescription: `You are trying to perform an unsupported operation.
194
+
195
+ Unless you are creating a task or plugin, this is probably a bug.
196
+
197
+ Please [report it](https://github.com/nomiclabs/hardhat/issues/new) to help us improve Hardhat.`,
198
+ },
199
+ ONLY_ESM_SUPPORTED: {
200
+ number: 13,
201
+ messageTemplate: `Hardhat only supports ESM projects. Please be sure to specify "'type': 'module'" in your package.json`,
202
+ websiteTitle: "Only ESM projects are supported",
203
+ websiteDescription: `You are trying to initialize a new Hardhat project, but your package.json does not have the property "type" set to "module".
204
+
205
+ Currently, Hardhat only supports ESM projects.
206
+
207
+ Please add the property "type" with the value "module" in your package.json to ensure that your project is recognized as an ESM project.`,
208
+ },
209
+ GLOBAL_OPTION_ALREADY_DEFINED: {
210
+ number: 14,
211
+ messageTemplate:
212
+ 'Plugin "{plugin}"" is trying to define the global option "{globalOption}" but it is already defined by plugin "{definedByPlugin}"',
213
+ websiteTitle: "Global option already defined",
214
+ websiteDescription:
215
+ "The global option is already defined by another plugin. Please ensure that global options are uniquely named to avoid conflicts.",
216
+ },
217
+ INVALID_CONFIG: {
218
+ number: 15,
219
+ messageTemplate: `Invalid config:
220
+ {errors}`,
221
+ websiteTitle: "Invalid config",
222
+ websiteDescription: `The configuration you provided is invalid. Please check the documentation to learn how to configure Hardhat correctly.`,
223
+ },
224
+ TEMPLATE_NOT_FOUND: {
225
+ number: 16,
226
+ messageTemplate: `Template "{template}" not found`,
227
+ websiteTitle: "Template not found",
228
+ websiteDescription: `The template you provided is not found. Please check the documentation to learn which templates are available.`,
229
+ },
230
+ WORKSPACE_NOT_FOUND: {
231
+ number: 17,
232
+ messageTemplate: `Workspace "{workspace}" not found`,
233
+ websiteTitle: "Workspace not found",
234
+ websiteDescription: `The workspace you provided does not exist. Please ensure that the workspace exists and try again.`,
235
+ },
236
+ INVALID_HEX_STRING: {
237
+ number: 18,
238
+ messageTemplate: `Invalid hex string "{value}"`,
239
+ websiteTitle: "Invalid hex string",
240
+ websiteDescription: `Given value was not a valid hex string.`,
241
+ },
242
+ },
243
+ INTERNAL: {
244
+ ASSERTION_ERROR: {
245
+ number: 100,
246
+ messageTemplate: "An internal invariant was violated: {message}",
247
+ websiteTitle: "Invariant violation",
248
+ websiteDescription: `An internal invariant was violated. This is probably caused by a programming error in Hardhat or in one of the used plugins.
249
+
250
+ Please [report it](https://github.com/nomiclabs/hardhat/issues/new) to help us improve Hardhat.`,
251
+ shouldBeReported: true,
252
+ },
253
+ NOT_IMPLEMENTED_ERROR: {
254
+ number: 101,
255
+ messageTemplate: "Not implemented: {message}",
256
+ websiteTitle: "Not implemented",
257
+ websiteDescription: `A code path that has not been implemented was unexpectedly triggered.
258
+
259
+ Please [report it](https://github.com/nomiclabs/hardhat/issues/new) to help us improve Hardhat.`,
260
+ shouldBeReported: true,
261
+ },
262
+ },
263
+ PLUGINS: {
264
+ PLUGIN_NOT_INSTALLED: {
265
+ number: 200,
266
+ messageTemplate: 'Plugin "{pluginId}" is not installed.',
267
+ websiteTitle: "Plugin not installed",
268
+ websiteDescription: `A plugin was included in the Hardhat config but has not been installed into "node_modules".`,
269
+ },
270
+ PLUGIN_MISSING_DEPENDENCY: {
271
+ number: 201,
272
+ messageTemplate:
273
+ 'Plugin "{pluginId}" is missing a peer dependency "{peerDependencyName}".',
274
+ websiteTitle: "Plugin missing peer dependency",
275
+ websiteDescription: `A plugin's peer dependency has not been installed.`,
276
+ },
277
+ DEPENDENCY_VERSION_MISMATCH: {
278
+ number: 202,
279
+ messageTemplate:
280
+ 'Plugin "{pluginId}" has a peer dependency "{peerDependencyName}" with expected version "{expectedVersion}" but the installed version is "{installedVersion}".',
281
+ websiteTitle: "Dependency version mismatch",
282
+ websiteDescription: `A plugin's peer dependency expected version does not match the version of the installed package.
283
+
284
+ Please install a version of the peer dependency that meets the plugin's requirements.`,
285
+ },
286
+ PLUGIN_DEPENDENCY_FAILED_LOAD: {
287
+ number: 203,
288
+ messageTemplate: 'Plugin "{pluginId}" dependency could not be loaded.',
289
+ websiteTitle: "Plugin dependency could not be loaded",
290
+ websiteDescription: `The loading of a plugin's dependent plugin failed.`,
291
+ },
292
+ },
293
+ HOOKS: {
294
+ INVALID_HOOK_FACTORY_PATH: {
295
+ number: 300,
296
+ messageTemplate:
297
+ 'Plugin "{pluginId}" hook factory for "{hookCategoryName}" is not a valid file:// URL: {path}.',
298
+ websiteTitle: "Plugin hook factory is not a valid file URL",
299
+ websiteDescription: `The loading of a plugin's hook factory failed as the import path is not a valid file:// URL.`,
300
+ },
301
+ },
302
+ TASK_DEFINITIONS: {
303
+ INVALID_FILE_ACTION: {
304
+ number: 400,
305
+ messageTemplate: "Invalid file action: {action} is not a valid file URL",
306
+ websiteTitle: "Invalid file action",
307
+ websiteDescription: `The setAction function was called with a string parameter that is not a valid file URL. A valid file URL must start with 'file://'.
308
+
309
+ Please ensure that you are providing a correct file URL.`,
310
+ },
311
+ NO_ACTION: {
312
+ number: 401,
313
+ messageTemplate: `The task "{task}" doesn't have an action`,
314
+ websiteTitle: "Task missing action",
315
+ websiteDescription: `A task was defined without an action.
316
+
317
+ Please ensure that an action is defined for each task.`,
318
+ },
319
+ POSITIONAL_ARG_AFTER_VARIADIC: {
320
+ number: 402,
321
+ messageTemplate:
322
+ 'Cannot add the positional argument "{name}" after a variadic one',
323
+ websiteTitle: "Invalid task definition",
324
+ websiteDescription:
325
+ "A variadic argument must always be the last positional argument in a task definition.",
326
+ },
327
+ REQUIRED_ARG_AFTER_OPTIONAL: {
328
+ number: 403,
329
+ messageTemplate:
330
+ 'Cannot add required positional argument "{name}" after an optional one',
331
+ websiteTitle: "Invalid task definition",
332
+ websiteDescription:
333
+ "Required positional arguments must be defined before optional ones in a task definition.",
334
+ },
335
+ TASK_NOT_FOUND: {
336
+ number: 404,
337
+ messageTemplate: 'Task "{task}" not found',
338
+ websiteTitle: "Task not found",
339
+ websiteDescription: "The provided task name does not match any task.",
340
+ },
341
+ SUBTASK_WITHOUT_PARENT: {
342
+ number: 405,
343
+ messageTemplate:
344
+ 'Task "{task}" not found when attempting to define subtask "{subtask}". If you intend to only define subtasks, please first define "{task}" as an empty task',
345
+ websiteTitle: "Subtask without parent",
346
+ websiteDescription:
347
+ "The parent task of the subtask being defined was not found. If you intend to only define subtasks, please first define the parent task as an empty task.",
348
+ },
349
+ TASK_ALREADY_DEFINED: {
350
+ number: 406,
351
+ messageTemplate:
352
+ '{actorFragment} trying to define the task "{task}" but it is already defined{definedByFragment}',
353
+ websiteTitle: "Task already defined",
354
+ websiteDescription:
355
+ "The task is already defined. Please ensure that tasks are uniquely named to avoid conflicts.",
356
+ },
357
+ EMPTY_TASK_ID: {
358
+ number: 407,
359
+ messageTemplate: "Task id cannot be an empty string or an empty array",
360
+ websiteTitle: "Empty task id",
361
+ websiteDescription:
362
+ "The task id cannot be an empty string or an empty array. Please ensure that the array of task names is not empty.",
363
+ },
364
+ TASK_OPTION_ALREADY_DEFINED: {
365
+ number: 408,
366
+ messageTemplate:
367
+ '{actorFragment} trying to define task "{task}" with the option "{option}" but it is already defined as a global option by plugin "{globalOptionPluginId}"',
368
+ websiteTitle: "Task option already defined",
369
+ websiteDescription:
370
+ "The task option is already defined as a global option by another plugin. Please ensure that task options are uniquely named to avoid conflicts.",
371
+ },
372
+ TASK_OVERRIDE_OPTION_ALREADY_DEFINED: {
373
+ number: 409,
374
+ messageTemplate:
375
+ '{actorFragment} trying to override the option "{option}" of the task "{task}" but it is already defined',
376
+ websiteTitle: "Task override option already defined",
377
+ websiteDescription:
378
+ "An attempt is being made to override an option that has already been defined. Please ensure that the option is not defined before trying to override it.",
379
+ },
380
+ EMPTY_TASK: {
381
+ number: 410,
382
+ messageTemplate: `Can't run the empty task "{task}"`,
383
+ websiteTitle: "Empty task",
384
+ websiteDescription:
385
+ "The task is empty. Please ensure that tasks have at least one action.",
386
+ },
387
+ INVALID_ACTION_URL: {
388
+ number: 411,
389
+ messageTemplate:
390
+ 'Unable to import the module specified by the action "{action}" of task "{task}"',
391
+ websiteTitle: "Invalid action URL",
392
+ websiteDescription:
393
+ "The action URL is invalid. Please ensure that the URL is correct.",
394
+ },
395
+ INVALID_ACTION: {
396
+ number: 412,
397
+ messageTemplate:
398
+ 'The action resolved from "{action}" in task "{task}" is not a function',
399
+ websiteTitle: "Invalid action",
400
+ websiteDescription:
401
+ "The action of the task is not a function. Make sure that the file pointed to by the action URL exports a function as the default export.",
402
+ },
403
+ MISSING_VALUE_FOR_TASK_ARGUMENT: {
404
+ number: 413,
405
+ messageTemplate:
406
+ 'Missing value for the argument named "{argument}" in the task "{task}"',
407
+ websiteTitle: "Missing value for the task argument",
408
+ websiteDescription: `You tried to run a task, but one of the values of its arguments was missing.
409
+
410
+ Please double check how you invoked Hardhat or ran your task.`,
411
+ },
412
+ INVALID_VALUE_FOR_TYPE: {
413
+ number: 414,
414
+ messageTemplate:
415
+ 'Invalid value "{value}" for argument "{name}" of type "{type}" in the task "{task}"',
416
+ websiteTitle: "Invalid argument type",
417
+ websiteDescription: `One of your task arguments has an invalid type.
418
+
419
+ Please double check your task arguments.`,
420
+ },
421
+ UNRECOGNIZED_TASK_OPTION: {
422
+ number: 415,
423
+ messageTemplate: 'Invalid option "{option}" for the task "{task}"',
424
+ websiteTitle: "Invalid option value",
425
+ websiteDescription: `One of the options for your task is invalid.
426
+
427
+ Please double check your arguments.`,
428
+ },
429
+ },
430
+ ARGUMENTS: {
431
+ INVALID_VALUE_FOR_TYPE: {
432
+ number: 500,
433
+ messageTemplate:
434
+ 'Invalid value "{value}" for argument "{name}" of type "{type}"',
435
+ websiteTitle: "Invalid argument type",
436
+ websiteDescription: `One of your Hardhat or task arguments has an invalid type.
437
+
438
+ Please double check your arguments.`,
439
+ },
440
+ RESERVED_NAME: {
441
+ number: 501,
442
+ messageTemplate: 'Argument name "{name}" is reserved',
443
+ websiteTitle: "Reserved argument name",
444
+ websiteDescription: `One of your Hardhat or task arguments has a reserved name.
445
+
446
+ Please double check your arguments.`,
447
+ },
448
+ DUPLICATED_NAME: {
449
+ number: 502,
450
+ messageTemplate: 'Argument name "{name}" is already in use',
451
+ websiteTitle: "Argument name already in use",
452
+ websiteDescription: `One of your Hardhat or task argument names is already in use.
453
+
454
+ Please double check your arguments.`,
455
+ },
456
+ INVALID_NAME: {
457
+ number: 503,
458
+ messageTemplate: `Argument name "{name}" is invalid. It must consist only of alphanumeric characters and cannot start with a number.`,
459
+ websiteTitle: "Invalid argument name",
460
+ websiteDescription: `One of your Hardhat or task argument names is invalid.
461
+
462
+ Please double check your arguments.`,
463
+ },
464
+ UNRECOGNIZED_OPTION: {
465
+ number: 504,
466
+ messageTemplate:
467
+ 'Invalid option "{option}". It is neither a valid global option nor associated with any task. Did you forget to add the task first, or did you misspell it?',
468
+ websiteTitle: "Invalid option value",
469
+ websiteDescription: `One of your Hardhat options is invalid.
470
+
471
+ Please double check your arguments.`,
472
+ },
473
+ MISSING_VALUE_FOR_ARGUMENT: {
474
+ number: 505,
475
+ messageTemplate: 'Missing value for the task argument named "{argument}"',
476
+ websiteTitle: "Missing value for the task argument",
477
+ websiteDescription: `You tried to run a task, but one of the values of its arguments was missing.
478
+
479
+ Please double check how you invoked Hardhat or ran your task.`,
480
+ },
481
+ UNUSED_ARGUMENT: {
482
+ number: 506,
483
+ messageTemplate:
484
+ 'The argument with value "{value}" was not consumed because it is not associated with any task.',
485
+ websiteTitle: "Argument was not consumed",
486
+ websiteDescription: `You tried to run a task, but one of your arguments was not consumed.
487
+
488
+ Please double check how you invoked Hardhat or ran your task.`,
489
+ },
490
+ MISSING_CONFIG_FILE: {
491
+ number: 507,
492
+ messageTemplate:
493
+ 'The global option "--config" was passed, but no file path was provided.',
494
+ websiteTitle: "Missing configuration file path",
495
+ websiteDescription: `A path to the configuration file is expected after the global option "--config", but none was provided.
496
+
497
+ Please double check your arguments.`,
498
+ },
499
+ CANNOT_COMBINE_INIT_AND_CONFIG_PATH: {
500
+ number: 508,
501
+ messageTemplate:
502
+ 'The global option "--config" cannot be used with the "init" command',
503
+ websiteTitle:
504
+ 'The global option "--config" cannot be used with the "init" command',
505
+ websiteDescription: `The global option "--config" cannot be used with the "init" command.
506
+
507
+ Please double check your arguments.`,
508
+ },
509
+ },
510
+ BUILTIN_TASKS: {
511
+ RUN_FILE_NOT_FOUND: {
512
+ number: 600,
513
+ messageTemplate: `Script "{script}" doesn't exist`,
514
+ websiteTitle: "Script doesn't exist",
515
+ websiteDescription: `Tried to use \`hardhat run\` to execute a nonexistent script.
516
+
517
+ Please double check your script's path.`,
518
+ },
519
+ TEST_TASK_ESM_TESTS_RUN_TWICE: {
520
+ number: 601,
521
+ messageTemplate: `Your project uses ESM and you've programmatically run your tests twice. This is not supported yet.`,
522
+ websiteTitle: "Running tests twice in an ESM project",
523
+ websiteDescription:
524
+ 'You have run your tests twice programmatically and your project is an ESM project (you have `"type": "module"` in your `package.json`, or some of your files have the `.mjs` extension). This is not supported by Mocha yet (https://github.com/mochajs/mocha/issues/2706).',
525
+ },
526
+ },
527
+ NETWORK: {
528
+ INVALID_URL: {
529
+ number: 700,
530
+ messageTemplate: 'Invalid URL "{value}" for network or forking.',
531
+ websiteTitle: "Invalid URL for network or forking",
532
+ websiteDescription: `You are trying to connect to a network with an invalid network or forking URL.
533
+
534
+ Please check that you are sending a valid URL string for the network or forking \`URL\` parameter.`,
535
+ },
536
+ INVALID_REQUEST_PARAMS: {
537
+ number: 701,
538
+ messageTemplate:
539
+ "Invalid request arguments: only array parameters are supported.",
540
+ websiteTitle: "Invalid method parameters",
541
+ websiteDescription:
542
+ "The JSON-RPC request parameters are invalid. You are trying to make an EIP-1193 request with object parameters, but only array parameters are supported. Ensure that the 'params' parameter is correctly specified as an array in your JSON-RPC request.",
543
+ },
544
+ INVALID_JSON_RESPONSE: {
545
+ number: 702,
546
+ messageTemplate: "Invalid JSON-RPC response received: {response}",
547
+ websiteTitle: "Invalid JSON-RPC response",
548
+ websiteDescription: `One of your JSON-RPC requests received an invalid response.
549
+
550
+ Please make sure your node is running, and check your internet connection and networks config.`,
551
+ },
552
+ CONNECTION_REFUSED: {
553
+ number: 703,
554
+ messageTemplate: `Cannot connect to the network "{network}".
555
+ Please make sure your node is running, and check your internet connection and networks config`,
556
+ websiteTitle: "Cannot connect to the network",
557
+ websiteDescription: `Cannot connect to the network.
558
+
559
+ Please make sure your node is running, and check your internet connection and networks config.`,
560
+ },
561
+ NETWORK_TIMEOUT: {
562
+ number: 704,
563
+ messageTemplate: `Network connection timed out.
564
+ Please check your internet connection and networks config`,
565
+ websiteTitle: "Network timeout",
566
+ websiteDescription: `One of your JSON-RPC requests timed out.
567
+
568
+ Please make sure your node is running, and check your internet connection and networks config.`,
569
+ },
570
+ NETWORK_NOT_FOUND: {
571
+ number: 705,
572
+ messageTemplate: `The network "{networkName}" is not defined in your networks config.`,
573
+ websiteTitle: "Network not found",
574
+ websiteDescription: `The network you are trying to connect to is not found.
575
+
576
+ Please double check that the network is correctly defined in your networks config.`,
577
+ },
578
+ INVALID_CHAIN_TYPE: {
579
+ number: 706,
580
+ messageTemplate: `The provided chain type "{chainType}" does not match the network's chain type "{networkChainType}" for network "{networkName}".`,
581
+ websiteTitle: "Invalid chain type",
582
+ websiteDescription: `The chain type does not match the network's chain type.
583
+
584
+ If you want to use a different chain type, please update your networks config.`,
585
+ },
586
+ INVALID_CONFIG_OVERRIDE: {
587
+ number: 707,
588
+ messageTemplate: `Invalid config override:
589
+ {errors}`,
590
+ websiteTitle: "Invalid config override",
591
+ websiteDescription: `The configuration override you provided is invalid.`,
592
+ },
593
+ INVALID_GLOBAL_CHAIN_ID: {
594
+ number: 708,
595
+ messageTemplate:
596
+ 'Hardhat was set to use chain id "{configChainId}", but connected to a chain with id "{connectionChainId}".',
597
+ websiteTitle: "Invalid global chain id",
598
+ websiteDescription: `Hardhat was set to use a chain id but connected to a chain with a different id`,
599
+ },
600
+ NO_REMOTE_ACCOUNT_AVAILABLE: {
601
+ number: 709,
602
+ messageTemplate:
603
+ "No local account was set and there are accounts in the remote node.",
604
+ websiteTitle: "No remote account available",
605
+ websiteDescription:
606
+ "No local account was set and there are accounts in the remote node",
607
+ },
608
+ ETHSIGN_MISSING_DATA_PARAM: {
609
+ number: 710,
610
+ messageTemplate: `Missing "data" param when calling eth_sign.`,
611
+ websiteTitle: `Missing "data" param when calling eth_sign`,
612
+ websiteDescription: `You called "eth_sign" with incorrect parameters.
613
+
614
+ Please check that you are sending a "data" parameter.`,
615
+ },
616
+ PERSONALSIGN_MISSING_ADDRESS_PARAM: {
617
+ number: 711,
618
+ messageTemplate: `Missing "address" param when calling personal_sign.`,
619
+ websiteTitle: `Missing "address" param when calling personal_sign`,
620
+ websiteDescription: `You called "personal_sign" with incorrect parameters.
621
+
622
+ Please check that you are sending an "address" parameter.`,
623
+ },
624
+ ETHSIGN_TYPED_DATA_V4_INVALID_DATA_PARAM: {
625
+ number: 712,
626
+ messageTemplate: `Invalid "data" param when calling eth_signTypedData_v4.`,
627
+ websiteTitle: `Invalid "data" param when calling eth_signTypedData_v4`,
628
+ websiteDescription: `You called "eth_signTypedData_v4" with incorrect parameters.
629
+
630
+ Please check that you are sending a "data" parameter with a JSON string or object conforming to EIP712 TypedData schema.`,
631
+ },
632
+ MISSING_TX_PARAM_TO_SIGN_LOCALLY: {
633
+ number: 713,
634
+ messageTemplate: `Missing param "{param}" from a tx being signed locally.`,
635
+ websiteTitle: "Missing transaction parameter",
636
+ websiteDescription: `You are trying to send a transaction with a locally managed account, and some parameters are missing.
637
+
638
+ Please double check your transactions' parameters.`,
639
+ },
640
+ MISSING_FEE_PRICE_FIELDS: {
641
+ number: 714,
642
+ messageTemplate:
643
+ "Tried to sign a transaction locally, but gasPrice, maxFeePerGas, and maxPriorityFeePerGas were missing.",
644
+ websiteTitle: "Missing fee price parameters",
645
+ websiteDescription: `You are trying to send a transaction with a locally managed account, and no fee price parameters were provided. You need to send gasPrice, or maxFeePerGas and maxPriorityFeePerGas.
646
+
647
+ Please double check your transactions' parameters.`,
648
+ },
649
+ INCOMPATIBLE_FEE_PRICE_FIELDS: {
650
+ number: 715,
651
+ messageTemplate:
652
+ "An incompatible transaction with gasPrice and EIP-1559 fee price fields.",
653
+ websiteTitle: "Incompatible fee price parameters",
654
+ websiteDescription: `You are trying to send a transaction with a locally managed account, and its parameters are incompatible. You sent both gasPrice, and maxFeePerGas or maxPriorityFeePerGas.
655
+
656
+ Please double check your transactions' parameters.`,
657
+ },
658
+ NOT_LOCAL_ACCOUNT: {
659
+ number: 716,
660
+ messageTemplate: `Account "{account}" is not managed by the node you are connected to.`,
661
+ websiteTitle: "Unrecognized account",
662
+ websiteDescription: `You are trying to send a transaction or sign some data with an account not managed by your Ethereum node nor Hardhat.
663
+
664
+ Please double check your accounts and the "from" parameter in your RPC calls.`,
665
+ },
666
+ INVALID_HD_PATH: {
667
+ number: 717,
668
+ messageTemplate: `HD path "{path}" is invalid. Read about BIP32 to know about the valid forms.`,
669
+ websiteTitle: "Invalid HD path",
670
+ websiteDescription: `An invalid HD/BIP32 derivation path was provided in your config.
671
+
672
+ Read the [documentation](https://hardhat.org/hardhat-runner/docs/config#hd-wallet-config) to learn how to define HD accounts correctly.`,
673
+ },
674
+ CANT_DERIVE_KEY: {
675
+ number: 718,
676
+ messageTemplate: `Cannot derive key "{path}" from mnemonic "{mnemonic}". Try using another mnemonic or deriving fewer keys.`,
677
+ websiteTitle: "Could not derive an HD key",
678
+ websiteDescription: `One of your HD keys could not be derived.
679
+
680
+ Try using another mnemonic or deriving less keys.`,
681
+ },
682
+ WRONG_VALIDATION_PARAMS: {
683
+ number: 719,
684
+ messageTemplate:
685
+ "Validation of parameters against the schemas failed for the following reason: {reason}",
686
+ websiteTitle: "Invalid validation parameters",
687
+ websiteDescription:
688
+ "The validation of parameters against the schemas failed.",
689
+ },
690
+ INVALID_NETWORK_TYPE: {
691
+ number: 720,
692
+ messageTemplate:
693
+ 'The provided network type "{networkType}" for network "{networkName}" is not recognized, only `http` and `edr` are supported.',
694
+ websiteTitle: "Invalid network type",
695
+ websiteDescription: `The network manager only supports the network types 'http' and 'edr'.`,
696
+ },
697
+ DATA_FIELD_CANNOT_BE_NULL_WITH_NULL_ADDRESS: {
698
+ number: 721,
699
+ messageTemplate: `The "to" field is undefined, and the "data" field is also undefined; however, a transaction to the null address cannot have an undefined "data" field.`,
700
+ websiteTitle: "Transaction to null address cannot have undefined data",
701
+ websiteDescription:
702
+ "The transaction to the null address cannot have undefined data",
703
+ },
704
+ PROVIDER_CLOSED: {
705
+ number: 722,
706
+ messageTemplate: "The provider has been closed.",
707
+ websiteTitle: "Provider closed",
708
+ websiteDescription:
709
+ "The provider your are trying to use has been closed. Please create a new one using hre.network.connect() and try again.",
710
+ },
711
+ },
712
+ KEYSTORE: {},
713
+ NETWORK_HELPERS: {
714
+ ONLY_ALLOW_0X_PREFIXED_STRINGS: {
715
+ number: 900,
716
+ messageTemplate: `Only hex-encoded strings prefixed with "0x" are accepted`,
717
+ websiteTitle: `Only hex-encoded strings prefixed with "0x" are accepted`,
718
+ websiteDescription: `Only hex-encoded strings prefixed with "0x" are accepted`,
719
+ },
720
+ CANNOT_CONVERT_TO_RPC_QUANTITY: {
721
+ number: 901,
722
+ messageTemplate: `The value "{value}" cannot be converted into an RPC quantity`,
723
+ websiteTitle: "Cannot converted into an RPC quantity",
724
+ websiteDescription: "The value cannot be converted into an RPC quantity",
725
+ },
726
+ INVALID_HEX_STRING: {
727
+ number: 902,
728
+ messageTemplate: `"{value}" is not a valid hex string`,
729
+ websiteTitle: "Invalid hex string",
730
+ websiteDescription: "The value is not a valid hex string",
731
+ },
732
+ INVALID_TX_HASH: {
733
+ number: 903,
734
+ messageTemplate: `"{value}" is not a valid transaction hash`,
735
+ websiteTitle: "Invalid transaction hash",
736
+ websiteDescription: "The value is not a valid transaction hash",
737
+ },
738
+ INVALID_ADDRESS: {
739
+ number: 904,
740
+ messageTemplate: `"{value}" is not a valid address`,
741
+ websiteTitle: "Invalid address",
742
+ websiteDescription: "The value is not a valid address",
743
+ },
744
+ INVALID_CHECKSUM_ADDRESS: {
745
+ number: 905,
746
+ messageTemplate: `Address "{value}" has an invalid checksum`,
747
+ websiteTitle: "Invalid checksum address",
748
+ websiteDescription: "The address has an invalid checksum",
749
+ },
750
+ BLOCK_NUMBER_SMALLER_THAN_CURRENT: {
751
+ number: 906,
752
+ messageTemplate: `The block number "{newValue}" is smaller than the current block number "{currentValue}"`,
753
+ websiteTitle: "Block number smaller than the current block number",
754
+ websiteDescription:
755
+ "The block number is smaller than the current block number",
756
+ },
757
+ EVM_SNAPSHOT_VALUE_NOT_A_STRING: {
758
+ number: 907,
759
+ messageTemplate: `The value returned by evm_snapshot should be a string`,
760
+ websiteTitle: "The evm_snapshot value should be a string",
761
+ websiteDescription:
762
+ "The value returned by evm_snapshot should be a string",
763
+ },
764
+ EVM_REVERT_VALUE_NOT_A_BOOLEAN: {
765
+ number: 908,
766
+ messageTemplate: `The value returned by evm_revert should be a boolean`,
767
+ websiteTitle: "The evm_revert value should be a boolean",
768
+ websiteDescription:
769
+ "The value returned by evm_revert should be a boolean",
770
+ },
771
+ INVALID_SNAPSHOT: {
772
+ number: 909,
773
+ messageTemplate: `Trying to restore an invalid snapshot.`,
774
+ websiteTitle: "Trying to restore an invalid snapshot.",
775
+ websiteDescription: "Trying to restore an invalid snapshot.",
776
+ },
777
+ EXPECTED_NON_NEGATIVE_NUMBER: {
778
+ number: 910,
779
+ messageTemplate: `Invalid input: expected a non-negative number but "{value}" was given.`,
780
+ websiteTitle: "Invalid input, expected a non-negative number",
781
+ websiteDescription: "Invalid input, expected a non-negative number",
782
+ },
783
+ CANNOT_CONVERT_NEGATIVE_NUMBER_TO_RPC_QUANTITY: {
784
+ number: 911,
785
+ messageTemplate: `Cannot convert negative number "{value}" to RPC quantity`,
786
+ websiteTitle: "Cannot convert negative number to RPC quantity",
787
+ websiteDescription: "Cannot convert negative number to RPC quantity",
788
+ },
789
+ FIXTURE_ANONYMOUS_FUNCTION_ERROR: {
790
+ number: 912,
791
+ messageTemplate: `Anonymous functions cannot be used as fixtures.
792
+
793
+ You probably did something like this:
794
+
795
+ loadFixture(async () => ... );
796
+
797
+ Instead, define a fixture function and refer to that same function in each call to loadFixture.
798
+
799
+ Learn more at (https://hardhat.org/hardhat-network-helpers/docs/reference#fixtures)`,
800
+ websiteTitle: "Anonymous functions cannot be used as fixtures",
801
+ websiteDescription: "Anonymous functions cannot be used as fixtures",
802
+ },
803
+ FIXTURE_SNAPSHOT_ERROR: {
804
+ number: 913,
805
+ messageTemplate: `There was an error reverting the snapshot of the fixture.
806
+
807
+ This might be caused by using hardhat_reset and loadFixture calls in a testcase.`,
808
+ websiteTitle: "Error while reverting snapshot",
809
+ websiteDescription: "Error while reverting snapshot",
810
+ },
811
+ CAN_ONLY_BE_USED_WITH_HARDHAT_NETWORK: {
812
+ number: 914,
813
+ messageTemplate: `This helper can only be used with the Hardhat Network. You are connected to "{networkName}".`,
814
+ websiteTitle:
815
+ "Hardhat network helpers can only be used with the Hardhat Network",
816
+ websiteDescription:
817
+ "Hardhat network helpers can only be used with the Hardhat Network",
818
+ },
819
+ CAN_ONLY_BE_USED_WITH_HARDHAT_NETWORK_VERSIONED: {
820
+ number: 915,
821
+ messageTemplate: `This helper can only be used with the Hardhat Network. You are connected to "{networkName}", whose identifier is "{version}".`,
822
+ websiteTitle:
823
+ "Hardhat network helpers can only be used with the Hardhat Network - version info",
824
+ websiteDescription:
825
+ "Hardhat network helpers can only be used with the Hardhat Network",
826
+ },
827
+ },
828
+ SOLIDITY_TESTS: {
829
+ BUILD_INFO_NOT_FOUND_FOR_CONTRACT: {
830
+ number: 1000,
831
+ shouldBeReported: true,
832
+ messageTemplate: `Build info not found for contract "{fqn}"`,
833
+ websiteTitle: `Build info not found for contract`,
834
+ websiteDescription: `Build info not found for contract while compiling Solidity test contracts.`,
835
+ },
836
+ RUNNER_TIMEOUT: {
837
+ number: 1001,
838
+ messageTemplate: `Runner timed out after {duration} ms.
839
+
840
+ Remaining test suites: {suites}`,
841
+ websiteTitle: `Runner timed out`,
842
+ websiteDescription: `Runner timed out while running Solidity tests.`,
843
+ },
844
+ },
845
+ ETHERS: {
846
+ METHOD_NOT_IMPLEMENTED: {
847
+ number: 1100,
848
+ messageTemplate: `Method "{method}" is not implemented`,
849
+ websiteTitle: "Method not implemented",
850
+ websiteDescription: "Method not implemented",
851
+ },
852
+ EVENT_NOT_SUPPORTED: {
853
+ number: 1101,
854
+ messageTemplate: `Event "{event}" is not supported`,
855
+ websiteTitle: "Event not supported",
856
+ websiteDescription: "Event not supported",
857
+ },
858
+ ACCOUNT_INDEX_OUT_OF_RANGE: {
859
+ number: 1102,
860
+ messageTemplate: `Tried to get account with index {accountIndex} but there are only {accountsLength} accounts`,
861
+ websiteTitle: "Account index out of range",
862
+ websiteDescription: "Account index out of range",
863
+ },
864
+ BROADCASTED_TX_DIFFERENT_HASH: {
865
+ number: 1103,
866
+ messageTemplate: `Expected broadcasted transaction to have hash "{txHash}", but got "{broadcastedTxHash}"`,
867
+ websiteTitle: "Broadcasted transaction hash mismatch",
868
+ websiteDescription: "Broadcasted transaction hash mismatch",
869
+ },
870
+ CANNOT_GET_ACCOUNT: {
871
+ number: 1104,
872
+ messageTemplate: `Cannot get account with address "{address}"`,
873
+ websiteTitle: "Cannot get account",
874
+ websiteDescription: "Cannot get account",
875
+ },
876
+ INVALID_BLOCK_TAG: {
877
+ number: 1105,
878
+ messageTemplate: `Invalid block tag "{blockTag}"`,
879
+ websiteTitle: "Invalid block tag",
880
+ websiteDescription: "Invalid block tag",
881
+ },
882
+ INVALID_ARTIFACT_FOR_FACTORY: {
883
+ number: 1106,
884
+ messageTemplate:
885
+ "You are trying to create a contract factory from an artifact, but you have not passed a valid artifact parameter.",
886
+ websiteTitle: "Invalid artifact for contract factory creation",
887
+ websiteDescription: "Invalid artifact for contract factory creation",
888
+ },
889
+ INVALID_ABSTRACT_CONTRACT_FOR_FACTORY: {
890
+ number: 1107,
891
+ messageTemplate: `You are trying to create a contract factory for the contract "{contractName}", which is abstract and can't be deployed. If you want to call a contract using "{contractName}" as its interface use the "getContractAt" function instead.`,
892
+ websiteTitle: "Invalid abstract contract for contract factory creation",
893
+ websiteDescription:
894
+ "Invalid abstract contract for contract factory creation",
895
+ },
896
+ INVALID_ADDRESS_TO_LINK_CONTRACT_TO_LIBRARY: {
897
+ number: 1108,
898
+ messageTemplate: `You tried to link the contract "{contractName}" with the library "{linkedLibraryName}", but you provided this invalid address: {resolvedAddress}`,
899
+ websiteTitle: "Invalid address to link contract",
900
+ websiteDescription: "Invalid address to link contract",
901
+ },
902
+ LIBRARY_NOT_AMONG_CONTRACT_LIBRARIES: {
903
+ number: 1109,
904
+ messageTemplate: `You tried to link the contract "{contractName}" with the library "{linkedLibraryName}", which is not one of its libraries. Detailed message: {detailedMessage}`,
905
+ websiteTitle: "Library is not one of the contract libraries",
906
+ websiteDescription: "Library is not one of the contract libraries",
907
+ },
908
+ AMBIGUOUS_LIBRARY_NAME: {
909
+ number: 1110,
910
+ messageTemplate: `The library name "{linkedLibraryName}" is ambiguous for the contract "{contractName}". It may resolve to one of the following libraries: "{matchingNeededLibrariesFQNs}". To fix this, choose one of these fully qualified library names and replace where appropriate.`,
911
+ websiteTitle: "Ambiguous library name",
912
+ websiteDescription: "Ambiguous library name",
913
+ },
914
+ REFERENCE_TO_SAME_LIBRARY: {
915
+ number: 1111,
916
+ messageTemplate: `The library names "{linkedLibraryName1}" and "{linkedLibraryName2}" refer to the same library and were given as two separate library links. Remove one of them and review your library links before proceeding.`,
917
+ websiteTitle: "Reference to same library",
918
+ websiteDescription: "Reference to same library",
919
+ },
920
+ MISSING_LINK_FOR_LIBRARY: {
921
+ number: 1112,
922
+ messageTemplate: `The contract "{contractName}" is missing links for the following libraries: "{missingLibraries}". Learn more about linking contracts at (https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-ethers#library-linking).`,
923
+ websiteTitle: "Missing links for library",
924
+ websiteDescription: "Missing links for library",
925
+ },
926
+ UNSUPPORTED_TYPE_FOR_DEEP_COPY: {
927
+ number: 1113,
928
+ messageTemplate: `The value "{value}" with type "{type}" is not supported by the deepCopy function.`,
929
+ websiteTitle: "Unsupported type for deep copy",
930
+ websiteDescription: "Unsupported type for deep copy",
931
+ },
932
+ },
933
+ SOLIDITY: {
934
+ RESOLVING_INCORRECT_FILE_AS_PROJECT_FILE: {
935
+ number: 1200,
936
+ shouldBeReported: true,
937
+ messageTemplate: `File "{file}" is being resolved as a project file, but it's not part of the project.`,
938
+ websiteTitle: "Solidity project file is outside the project",
939
+ websiteDescription: `Tried to resolve a file as a project file, but it's not part of the project.`,
940
+ },
941
+ RESOLVING_NONEXISTENT_PROJECT_FILE: {
942
+ number: 1201,
943
+ shouldBeReported: true,
944
+ messageTemplate: `File "{file}" is being resolved as a project file, but it doesn't exist.`,
945
+ websiteTitle: "Solidity project file doesn't exist",
946
+ websiteDescription: `Tried to resolve a file as a project file, but it doesn't exist.`,
947
+ },
948
+ IMPORTED_FILE_DOESNT_EXIST: {
949
+ number: 1202,
950
+ messageTemplate: `The import "{importPath} from "{from}" doesn't exist.`,
951
+ websiteTitle: "Imported file doesn't exist",
952
+ websiteDescription: `An imported file doesn't exist.`,
953
+ },
954
+ IMPORTED_FILE_WITH_INCORRECT_CASING: {
955
+ number: 1203,
956
+ messageTemplate:
957
+ 'The import "{importPath} from "{from}" exists, but its casing is incorrect. The correct casing is "{correctCasing}".',
958
+ websiteTitle: "Imported file with incorrect casing",
959
+ websiteDescription: `Hardhat enforces that you import your files with the correct casing (as stored in the filesystem).
960
+
961
+ This error is thrown when you import a file with the wrong casing under a case insensitve filesystem.`,
962
+ },
963
+ IMPORTED_PACKAGE_EXPORTS_FILE_WITH_INCORRECT_CASING: {
964
+ number: 1204,
965
+ messageTemplate:
966
+ 'The import "{importPath} from "{from}" exists, but its casing is incorrect.',
967
+ websiteTitle: "Imported file with incorrect casing",
968
+ websiteDescription: `Hardhat enforces that you import your files with the correct casing (as stored in the filesystem).
969
+
970
+ This error is thrown when you import a file with the wrong casing under a case insensitve filesystem.`,
971
+ },
972
+ NPM_DEPEDNDENCY_NOT_INSTALLED: {
973
+ number: 1205,
974
+ messageTemplate:
975
+ 'The npm package "{packageName}" isn\'t installed in the {from}.',
976
+ websiteTitle: "Uninstalled npm dependency",
977
+ websiteDescription: `Trying to use an npm package as a solidity dependency, but it's not installed.`,
978
+ },
979
+ IMPORTED_NPM_DEPENDENCY_NOT_INSTALLED: {
980
+ number: 1206,
981
+ messageTemplate:
982
+ 'The import "{importPath}" from "{from}" is trying to use an uninstalled npm dependency.',
983
+ websiteTitle: "Uninstalled npm solidity dependency",
984
+ websiteDescription: `One of your files is traying to import a dependency using npm, but it hasn't been installed`,
985
+ },
986
+ USER_REMAPPING_WITH_NPM_CONTEXT: {
987
+ number: 1207,
988
+ messageTemplate:
989
+ 'The remapping "{remapping}" has a context starting with "npm/", which is forbidden. Hardhat doesn\'t allow changing the behaviour of npm package\'s imports.',
990
+ websiteTitle: "Remapping imports in npm packages is not allowed",
991
+ websiteDescription: `This error happened because you are trying to change how the imports within an npm package, which is not allowed.
992
+
993
+ While Hardhat supports user-defined remappings, it doesn't support remapping the behavior of npm packages to ensure that everything what's imported via npm uses the same npm resolution logic.`,
994
+ },
995
+ REMAPPING_WITH_INVALID_SYNTAX: {
996
+ number: 1208,
997
+ messageTemplate: `The remapping "{remapping}" is invalid.`,
998
+ websiteTitle: "Invalid remapping",
999
+ websiteDescription: `You are trying to set a user remapping, but it's syntax is invalid.
1000
+
1001
+ Please double check your remmpaings' syntax.`,
1002
+ },
1003
+ REMAPPING_TO_UNINSTALLED_PACKAGE: {
1004
+ number: 1209,
1005
+ messageTemplate: `The remapping "{remapping}" is trying to use the npm package "{package}", which is not installed`,
1006
+ websiteTitle: "Remapping into an uninstaleld npm package",
1007
+ websiteDescription: `You are trying to set a user remapping that uses an npm pacakge as target, but it's not installed.
1008
+
1009
+ Please make sure to install the package or fix the remapping.`,
1010
+ },
1011
+ REMAPPING_NPM_PACKAGE_AS_MONOREPO: {
1012
+ number: 1210,
1013
+ messageTemplate: `The remapping "{remapping}" targets the npm pacakge "{pacakge}" as if it were part of this repository, but version "{version}" is installed instead`,
1014
+ websiteTitle:
1015
+ "Remapping into a monorepo package but found an npm package instead",
1016
+ websiteDescription: `You are trying to set a remapping setting a monorepo package as target, but Hardhat found the pacakge to be installed from the npm regristry instead.`,
1017
+ },
1018
+ REMAPPING_HARDHAT_PROJECT_AS_MONOREPO_PACKAGE: {
1019
+ number: 1211,
1020
+ messageTemplate: `The remapping "{remapping}" is trying to set the npm package "{package}" as target, but that's the project is the Hardhat project, so it shouldn't be remapped through npm/, but as internal project remappings.`,
1021
+ websiteTitle: `Remapping into the project using npm`,
1022
+ websiteDescription: `You are trying to set a remapping whose target uses the npm/ syntax, but is within your Hardhat project.
1023
+
1024
+ Please don't use npm/... as target, but use normal internal project remapping istead.`,
1025
+ },
1026
+ REMAPPING_INCORRECT_VERSION: {
1027
+ number: 1212,
1028
+ messageTemplate: `The remapping "{remapping}" is trying to set the npm package "{package}" version "{expectedVersion}" as target, but found version "{actualVersion}" instead.`,
1029
+ websiteTitle: `Remapping into incorrect npm package version`,
1030
+ websiteDescription: `You are trying to set a remapping into an npm package, but the version that you are using is not the currently installed one.
1031
+
1032
+ Please change your remapping to match the installed version, or installed the correct one.`,
1033
+ },
1034
+ INVALID_NPM_IMPORT: {
1035
+ number: 1213,
1036
+ messageTemplate: `The import "{importPath}" in "{from}" is treated as an npm import as it's first directory doesn't exist in your project, but it's syntax is not that of a valid npm import either.`,
1037
+ websiteTitle: `Invalid npm import`,
1038
+ websiteDescription: `You are trying to import a file that is not a valid npm import. Please double check that you are using the correct syntax.`,
1039
+ },
1040
+ ILLEGAL_PACKAGE_IMPORT: {
1041
+ number: 1214,
1042
+ messageTemplate: `The import "{importPath}" in "{from}" is not a legal import as it's trying to import a file outside of its package.`,
1043
+ websiteTitle: `Illegal package import`,
1044
+ websiteDescription: `One of your npm packages has a Solidity file that is trying to import a file outside of its package using a relative import. This is disabled for security reasons.`,
1045
+ },
1046
+ ILEGALL_PROJECT_IMPORT: {
1047
+ number: 1215,
1048
+ messageTemplate: `The import "{importPath}" in "{from}" is not a legal import as it's trying to import a file outside of the project.`,
1049
+ websiteTitle: `Illegal project import`,
1050
+ websiteDescription: `One of your Solidity files is trying to import a file outside of the Hardhat project using a relative import. This is disabled for security reasons.`,
1051
+ },
1052
+ ILLEGAL_PROJECT_IMPORT_AFTER_REMAPPING: {
1053
+ number: 1216,
1054
+ messageTemplate: `Applying the remapping "{remapping}" to the import "{importPath}" from "{from}" results in an invalid import "{remappedDirectImport}", as it's not a local file. If you are trying to remap into an npm module use the npm/ syntax instead.`,
1055
+ websiteTitle: `Illegal project import after remapping`,
1056
+ websiteDescription: `One of your Solidity files has an import which after applying a user remapping becomes an illegal import, as it tries to import a file outside of the project. This is disabled for security reasons.
1057
+
1058
+ If you are trying to remap into an npm module use the npm/ syntax instead.`,
1059
+ },
1060
+ IMPORT_PATH_WITH_WINDOWS_SEPARATOR: {
1061
+ number: 1217,
1062
+ messageTemplate: `The import "{importPath}" in "{from}" is not a valid import as it contains a Windows path separator.`,
1063
+ websiteTitle: `Import path with Windows path separator`,
1064
+ websiteDescription: `One of your Solidity files is trying to import a file with a Windows path separator, and this is not supported. Please use a Unix-style path instead.`,
1065
+ },
1066
+ INVALID_SOLC_VERSION: {
1067
+ number: 1218,
1068
+ messageTemplate: `Solidity version {version} is invalid or hasn't been released yet.
1069
+
1070
+ If you are certain it has been released, run "npx hardhat clean --global" and try again`,
1071
+ websiteTitle: "Invalid or unreleased `solc` version",
1072
+ websiteDescription: `The Solidity version in your config is invalid or hasn't been released yet.
1073
+
1074
+ If you are certain it has been released, run \`npx hardhat clean --global\` and try again.`,
1075
+ },
1076
+ RESOLVE_NPM_FILE_WITH_INVALID_FORMAT: {
1077
+ number: 1219,
1078
+ messageTemplate: `Couldn't resolve the npm file "{module}" because it has an invalid format.
1079
+
1080
+ Make sure that you are providing valid npm file paths (e.g. package/File.sol) in your config and programatically.`,
1081
+ websiteTitle: "Resolving invalid npm file",
1082
+ websiteDescription: `Tried to resolve an npm file directly (i.e. not imported by another file) but its format is invalid.
1083
+
1084
+ This can happen if you setting npm files to be compiled as local files, with invalid file paths, or by misusing the solidity build system.`,
1085
+ },
1086
+ RESOLVE_NPM_FILE_CLASHES_WITH_LOCAL_FILES: {
1087
+ number: 1220,
1088
+ shouldBeReported: true,
1089
+ messageTemplate: `You are tying to resolve the npm file "{module}", for example to compile it as a local one, but it can clash with your project as the "{directory}" directory is present in your project.
1090
+
1091
+ Please try renaming the directory.`,
1092
+ websiteTitle: "Resolution of npm file clashes with local files",
1093
+ websiteDescription: `You are tying to resolve an npm file, for example to compile it as a local one, but it can clash with your project files.`,
1094
+ },
1095
+ RESOLVE_NON_EXISTENT_NPM_ROOT: {
1096
+ number: 1221,
1097
+ messageTemplate: `You are tying to compile the npm file "{module}", but it doesn't exist within its package.`,
1098
+ websiteTitle: "Resolution of non-existent npm file",
1099
+ websiteDescription: `You are tying to resolve an npm file that doesn't exist within its package.`,
1100
+ },
1101
+ RESOLVE_WRONG_CASING_NPM_ROOT: {
1102
+ number: 1222,
1103
+ messageTemplate: `You are tying to compile the npm file "{module}", its casing is incorrect. Please double check it in your config.`,
1104
+ websiteTitle: "Resolution of npm file with incorrect casing",
1105
+ websiteDescription: `You are tying to resolve an npm file whose casing is incorrect.`,
1106
+ },
1107
+ DOWNLOAD_FAILED: {
1108
+ number: 1223,
1109
+ messageTemplate:
1110
+ "Couldn't download compiler version {remoteVersion}. Please check your internet connection and try again.",
1111
+ websiteTitle: "`solc` download failed",
1112
+ websiteDescription: `Couldn't download \`solc\`.
1113
+
1114
+ Please check your internet connection and try again.`,
1115
+ },
1116
+ VERSION_LIST_DOWNLOAD_FAILED: {
1117
+ number: 1224,
1118
+ messageTemplate:
1119
+ "Couldn't download compiler version list. Please check your internet connection and try again.",
1120
+ websiteTitle: "Couldn't obtain `solc` version list",
1121
+ websiteDescription: `Couldn't download \`solc\`'s version list.
1122
+
1123
+ Please check your internet connection and try again.`,
1124
+ },
1125
+ INVALID_DOWNLOAD: {
1126
+ number: 1225,
1127
+ messageTemplate: `Couldn't download compiler version {remoteVersion}: Checksum verification failed.
1128
+
1129
+ Please check your internet connection and try again.
1130
+
1131
+ If this error persists, run "npx hardhat clean --global".`,
1132
+ websiteTitle: "Downloaded `solc` checksum verification failed",
1133
+ websiteDescription: `Hardhat downloaded a version of the Solidity compiler, and its checksum verification failed.
1134
+
1135
+ Please check your internet connection and try again.
1136
+
1137
+ If this error persists, run \`npx hardhat clean --global\`.`,
1138
+ },
1139
+ CANT_RUN_NATIVE_COMPILER: {
1140
+ number: 1226,
1141
+ messageTemplate: `A native version of solc failed to run.
1142
+
1143
+ If you are running MacOS, try installing Apple Rosetta.
1144
+
1145
+ If this error persists, run "npx hardhat clean --global".`,
1146
+ websiteTitle: "Failed to run native solc",
1147
+ websiteDescription: `Hardhat successfully downloaded a native version of solc but it doesn't run.
1148
+
1149
+ If you are running MacOS, try installing Apple Rosetta.
1150
+
1151
+ If this error persists, run "npx hardhat clean --global".`,
1152
+ },
1153
+ CANT_RUN_SOLCJS_COMPILER: {
1154
+ number: 1227,
1155
+ messageTemplate: `A wasm version of solc failed to run.
1156
+
1157
+ If this error persists, run "npx hardhat clean --global".`,
1158
+ websiteTitle: "Failed to run solcjs",
1159
+ websiteDescription: `Hardhat successfully downloaded a WASM version of solc but it doesn't run.
1160
+
1161
+ If you are running MacOS, try installing Apple Rosetta.
1162
+
1163
+ If this error persists, run "npx hardhat clean --global".`,
1164
+ },
1165
+ COMPILATION_JOB_CREATION_ERROR: {
1166
+ number: 1228,
1167
+ messageTemplate: `Failed to create compilation job for file "{rootFilePath}" using the build profile "{buildProfile}".
1168
+
1169
+ {reason}`,
1170
+ websiteTitle: "Failed to create compilation job",
1171
+ websiteDescription: `Hardhat failed to create a compilation job for a file in your project.
1172
+
1173
+ This happens when your files require incompatible versions of solc or you haven't configured a version that works with them`,
1174
+ },
1175
+ BUILD_FAILED: {
1176
+ number: 1229,
1177
+ messageTemplate: "Compilation failed",
1178
+ websiteTitle: "Compilation failed",
1179
+ websiteDescription: `Your smart contracts failed to compile.
1180
+
1181
+ Please check Hardhat's output for more details.`,
1182
+ },
1183
+ INVALID_SOLCJS_COMPILER: {
1184
+ number: 1230,
1185
+ messageTemplate: `A wasm version of solc {version} is invalid. The compile function is not available.`,
1186
+ websiteTitle: "Invalid solcjs compiler",
1187
+ websiteDescription: `Hardhat successfully downloaded a WASM version of solc {version} but it is invalid. The compile function is missing.`,
1188
+ },
1189
+ RESOLVE_NOT_EXPORTED_NPM_FILE: {
1190
+ number: 1231,
1191
+ messageTemplate: `You are tying to resolve the npm file "{module}", but it's not exported by its package`,
1192
+ websiteTitle: "Resolution of not-exported npm file",
1193
+ websiteDescription: `You are tying to resolve an npm file that is not exported by its package.`,
1194
+ },
1195
+ },
1196
+ VIEM: {
1197
+ NETWORK_NOT_FOUND: {
1198
+ number: 1300,
1199
+ messageTemplate: `No network with chain id "{chainId}" found.`,
1200
+ websiteTitle: "Network not found",
1201
+ websiteDescription: `No network with the specified chain id was found. You can override the chain by passing it as a parameter to the client getter:
1202
+
1203
+ import { someChain } from "viem/chains";
1204
+ const client = await hre.viem.getPublicClient({
1205
+ chain: someChain,
1206
+ ...
1207
+ });
1208
+
1209
+ You can find a list of supported networks here: https://github.com/wevm/viem/blob/main/src/chains/index.ts`,
1210
+ },
1211
+ UNSUPPORTED_DEVELOPMENT_NETWORK: {
1212
+ number: 1301,
1213
+ messageTemplate:
1214
+ "Unsupported development network detected. Hardhat and Anvil are the only supported networks.",
1215
+ websiteTitle: "Unsupported Development Network",
1216
+ websiteDescription: `The chain ID corresponds to a development network, but we were unable to identify it as either Hardhat or Anvil.
1217
+
1218
+ Please ensure you're using one of the supported networks.`,
1219
+ },
1220
+ DEFAULT_WALLET_CLIENT_NOT_FOUND: {
1221
+ number: 1302,
1222
+ messageTemplate: `No default wallet client found for chain id "{chainId}".`,
1223
+ websiteTitle: "Default Wallet Client Not Found",
1224
+ websiteDescription: `A default wallet client could not be found for the specified chain ID. This issue may occur if no accounts were configured for the selected network.
1225
+
1226
+ To resolve this, make sure to add an account to the specified network in the Hardhat config. Alternatively, you can set a custom wallet client by passing it as a parameter in the relevant function:
1227
+
1228
+ const networkConnection = await hre.network.connect(...);
1229
+ const walletClient = await networkConnection.viem.getWalletClient(address);
1230
+
1231
+ await networkConnection.viem.deployContract(contractName, constructorArgs, { walletClient });
1232
+ await networkConnection.viem.sendDeploymentTransaction(contractName, constructorArgs, { walletClient });
1233
+ await networkConnection.viem.getContractAt(contractName, address, { walletClient });`,
1234
+ },
1235
+ LINKING_CONTRACT_ERROR: {
1236
+ number: 1303,
1237
+ messageTemplate: `Error linking the contract "{contractName}":
1238
+
1239
+ {error}`,
1240
+ websiteTitle: "Error Linking Contract",
1241
+ websiteDescription: `An error occurred while linking the contract libraries.
1242
+
1243
+ Please check Hardhat's output for more details.`,
1244
+ },
1245
+ INVALID_CONFIRMATIONS: {
1246
+ number: 1304,
1247
+ messageTemplate: `Invalid confirmations value. {error}`,
1248
+ websiteTitle: "Invalid Confirmations Value",
1249
+ websiteDescription: `Invalid confirmations value. The confirmations value provided is invalid.`,
1250
+ },
1251
+ DEPLOY_CONTRACT_ERROR: {
1252
+ number: 1305,
1253
+ messageTemplate: `The deployment transaction "{txHash}" was mined in block "{blockNumber}" but its receipt doesn't contain a contract address`,
1254
+ websiteTitle: "Deployment Transaction Error",
1255
+ websiteDescription:
1256
+ "The deployment transaction was mined but its receipt doesn't contain a contract address.",
1257
+ },
1258
+ },
1259
+ NODE: {
1260
+ INVALID_NETWORK_TYPE: {
1261
+ number: 1400,
1262
+ messageTemplate: `The provided node network type "{networkType}" for network "{networkName}" is not recognized, only 'edr' is supported.`,
1263
+ websiteTitle: "Invalid node network type",
1264
+ websiteDescription: `The node only supports the 'edr' network type.`,
1265
+ },
1266
+ },
1267
+ CHAI_MATCHERS: {
1268
+ UNKNOWN_COMPARISON_OPERATION: {
1269
+ number: 1500,
1270
+ messageTemplate: `Unknown comparison operation "{method}"`,
1271
+ websiteTitle: "Unknown comparison operation",
1272
+ websiteDescription: "Unknown comparison operation",
1273
+ },
1274
+ EXPECTED_STRING_OR_ADDRESSABLE: {
1275
+ number: 1501,
1276
+ messageTemplate: `Expected string or addressable, but got "{account}"`,
1277
+ websiteTitle: "Expected string or addressable",
1278
+ websiteDescription: "Expected string or addressable",
1279
+ },
1280
+ ASSERTION_WITHOUT_ERROR_MESSAGE: {
1281
+ number: 1502,
1282
+ messageTemplate: `Assertion doesn't have an error message. Please open an issue to report this.`,
1283
+ websiteTitle: "Assertion doesn't have an error message",
1284
+ websiteDescription: `Assertion doesn't have an error message. Please open an issue to report this.`,
1285
+ shouldBeReported: true,
1286
+ },
1287
+ MATCHER_CANNOT_BE_CHAINED_AFTER: {
1288
+ number: 1503,
1289
+ messageTemplate: `The matcher "{matcher}" cannot be chained after "{previousMatcher}". For more information, please refer to the documentation at: (https://hardhat.org/chaining-async-matchers).`,
1290
+ websiteTitle: "Matcher cannot be chained after",
1291
+ websiteDescription: `The matcher cannot be chained after another matcher. Please open an issue to report this.`,
1292
+ },
1293
+ DECODING_ERROR: {
1294
+ number: 1504,
1295
+ messageTemplate: `There was an error decoding "{encodedData}" as a "{type}. Reason: {reason}"`,
1296
+ websiteTitle: "Error while decoding data",
1297
+ websiteDescription: `There was an error decoding data`,
1298
+ },
1299
+ EXPECTED_VALID_TRANSACTION_HASH: {
1300
+ number: 1505,
1301
+ messageTemplate: `Expected a valid transaction hash, but got "{hash}"`,
1302
+ websiteTitle: "Expected a valid transaction hash",
1303
+ websiteDescription: `Expected a valid transaction hash`,
1304
+ },
1305
+ EXPECT_STRING_OR_REGEX_AS_REVERT_REASON: {
1306
+ number: 1506,
1307
+ messageTemplate:
1308
+ "Expected the revert reason to be a string or a regular expression",
1309
+ websiteTitle:
1310
+ "Expected the revert reason to be a string or a regular expression",
1311
+ websiteDescription:
1312
+ "Expected the revert reason to be a string or a regular expression",
1313
+ },
1314
+ FIRST_ARGUMENT_MUST_BE_A_CONTRACT: {
1315
+ number: 1507,
1316
+ messageTemplate:
1317
+ "The first argument of .revertedWithCustomError must be the contract that defines the custom error",
1318
+ websiteTitle: "First argument must be a contract",
1319
+ websiteDescription: "First argument must be a contract",
1320
+ },
1321
+ STRING_EXPECTED_AS_CUSTOM_ERROR_NAME: {
1322
+ number: 1508,
1323
+ messageTemplate: "Expected the custom error name to be a string",
1324
+ websiteTitle: "Expected the custom error name to be a string",
1325
+ websiteDescription: "Expected the custom error name to be a string",
1326
+ },
1327
+ CONTRACT_DOES_NOT_HAVE_CUSTOM_ERROR: {
1328
+ number: 1509,
1329
+ messageTemplate: `The given contract doesn't have a custom error named "{customErrorName}"`,
1330
+ websiteTitle:
1331
+ "Contract doesn't have a custom error with the specified name",
1332
+ websiteDescription:
1333
+ "Contract doesn't have a custom error with the specified name",
1334
+ },
1335
+ REVERT_INVALID_ARGUMENTS_LENGTH: {
1336
+ number: 1510,
1337
+ messageTemplate:
1338
+ "The .revertedWithCustomError matcher expects two arguments: the contract and the custom error name. Arguments should be asserted with the .withArgs helper.",
1339
+ websiteTitle:
1340
+ "Invalid arguments length for the .revertedWithCustomError matcher",
1341
+ websiteDescription:
1342
+ "Invalid arguments length for the .revertedWithCustomError matcher",
1343
+ },
1344
+ WITH_ARGS_FORBIDDEN: {
1345
+ number: 1511,
1346
+ messageTemplate:
1347
+ "[.withArgs] should never happen, please submit an issue to the Hardhat repository",
1348
+ websiteTitle:
1349
+ "[.withArgs] should never happen, please submit an issue to the Hardhat repository",
1350
+ websiteDescription:
1351
+ "[.withArgs] should never happen, please submit an issue to the Hardhat repository",
1352
+ },
1353
+ INDEXED_EVENT_FORBIDDEN: {
1354
+ number: 1512,
1355
+ messageTemplate:
1356
+ "Should not get an indexed event when the assertion type is not event. Please open an issue about this.",
1357
+ websiteTitle:
1358
+ "Should not get an indexed event when the assertion type is not event",
1359
+ websiteDescription:
1360
+ "Should not get an indexed event when the assertion type is not event",
1361
+ },
1362
+ PANIC_CODE_EXPECTED: {
1363
+ number: 1513,
1364
+ messageTemplate: `Expected the given panic code to be a number-like value, but got "{panicCode}"`,
1365
+ websiteTitle: "Expected the given panic code to be a number-like value",
1366
+ websiteDescription:
1367
+ "Expected the given panic code to be a number-like value",
1368
+ },
1369
+ ACCOUNTS_NUMBER_DIFFERENT_FROM_BALANCE_CHANGES: {
1370
+ number: 1514,
1371
+ messageTemplate: `The number of accounts ({accounts}) is different than the number of expected balance changes ({balanceChanges})`,
1372
+ websiteTitle:
1373
+ "The number of accounts is different than the number of expected balance changes",
1374
+ websiteDescription:
1375
+ "The number of accounts is different than the number of expected balance changes",
1376
+ },
1377
+ FIRST_ARGUMENT_MUST_BE_A_CONTRACT_INSTANCE: {
1378
+ number: 1515,
1379
+ messageTemplate: `The first argument of "{method}" must be the contract instance of the token`,
1380
+ websiteTitle: "First argument must be a contract instance",
1381
+ websiteDescription: "First argument must be a contract instance",
1382
+ },
1383
+ CONTRACT_IS_NOT_AN_ERC20_TOKEN: {
1384
+ number: 1516,
1385
+ messageTemplate: `The given contract instance is not an ERC20 token`,
1386
+ websiteTitle: "Given contract instance is not an ERC20 token",
1387
+ websiteDescription: "Given contract instance is not an ERC20 token",
1388
+ },
1389
+ INVALID_TRANSACTION: {
1390
+ number: 1517,
1391
+ messageTemplate: '"{transaction}" is not a valid transaction',
1392
+ websiteTitle: "Invalid transaction",
1393
+ websiteDescription: "Invalid transaction",
1394
+ },
1395
+ CONTRACT_TARGET_MUST_BE_A_STRING: {
1396
+ number: 1518,
1397
+ messageTemplate: "The contract target should be a string",
1398
+ websiteTitle: "Contract target must be a string",
1399
+ websiteDescription: "Contract target must be a string",
1400
+ },
1401
+ EMIT_EXPECTS_TWO_ARGUMENTS: {
1402
+ number: 1519,
1403
+ messageTemplate:
1404
+ "The .emit matcher expects two arguments: the contract and the event name. Arguments should be asserted with the .withArgs helper.",
1405
+ websiteTitle: "Invalid arguments length for the .emit matcher",
1406
+ websiteDescription: "Invalid arguments length for the .emit matcher",
1407
+ },
1408
+ CONTRACT_RUNNER_PROVIDER_NOT_NULL: {
1409
+ number: 1520,
1410
+ messageTemplate: "contract.runner.provider shouldn't be null",
1411
+ websiteTitle: "Contract runner's provider shouldn't be null",
1412
+ websiteDescription: "Contract runner's provider shouldn't be null",
1413
+ },
1414
+ WITH_ARGS_CANNOT_BE_COMBINED_WITH_NOT: {
1415
+ number: 1521,
1416
+ messageTemplate: "Do not combine .not. with .withArgs()",
1417
+ websiteTitle: "Do not combine .not. with .withArgs()",
1418
+ websiteDescription: "Do not combine .not. with .withArgs()",
1419
+ },
1420
+ WITH_ARGS_WRONG_COMBINATION: {
1421
+ number: 1522,
1422
+ messageTemplate:
1423
+ "withArgs can only be used in combination with a previous .emit or .revertedWithCustomError assertion",
1424
+ websiteTitle:
1425
+ "withArgs can only be used in combination with a previous .emit or .revertedWithCustomError assertion",
1426
+ websiteDescription:
1427
+ "withArgs can only be used in combination with a previous .emit or .revertedWithCustomError assertion",
1428
+ },
1429
+ WITH_ARGS_COMBINED_WITH_INCOMPATIBLE_ASSERTIONS: {
1430
+ number: 1523,
1431
+ messageTemplate:
1432
+ "withArgs called with both .emit and .revertedWithCustomError, but these assertions cannot be combined",
1433
+ websiteTitle:
1434
+ "withArgs called with both .emit and .revertedWithCustomError, but these assertions cannot be combined",
1435
+ websiteDescription:
1436
+ "withArgs called with both .emit and .revertedWithCustomError, but these assertions cannot be combined",
1437
+ },
1438
+ },
1439
+ ARTIFACTS: {
1440
+ NOT_FOUND: {
1441
+ number: 1600,
1442
+ messageTemplate:
1443
+ 'Artifact for contract "{contractName}" not found. {suggestion}',
1444
+ websiteTitle: "Artifact not found",
1445
+ websiteDescription: `Tried to read a nonexistent artifact.
1446
+
1447
+ Please double check that your contracts have been compiled and double check your artifact's name.`,
1448
+ },
1449
+ MULTIPLE_FOUND: {
1450
+ number: 1601,
1451
+ messageTemplate: `There are multiple artifacts for contract "{contractName}", please use a fully qualified name.
1452
+
1453
+ Please replace "{contractName}" for one of these options wherever you are trying to read its artifact:
1454
+
1455
+ {candidates}
1456
+ `,
1457
+ websiteTitle: "Multiple artifacts found",
1458
+ websiteDescription: `There are multiple artifacts that match the given contract name, and Hardhat doesn't know which one to use.
1459
+
1460
+ Please use the fully qualified name of the contract to disambiguate it.`,
1461
+ },
1462
+ },
1463
+ IGNITION: {
1464
+ INTERNAL_ERROR: {
1465
+ number: 1700,
1466
+ shouldBeReported: true,
1467
+ messageTemplate: "Hardhat Ignition Internal Error",
1468
+ websiteTitle: "An internal error to Hardhat Ignition has occurred",
1469
+ websiteDescription: `An internal error to Hardhat Ignition has occurred`,
1470
+ },
1471
+ ETHERSCAN_API_KEY_NOT_CONFIGURED: {
1472
+ number: 1701,
1473
+ messageTemplate: "No etherscan API key configured",
1474
+ websiteTitle: "No etherscan API key configured",
1475
+ websiteDescription: `You are trying to run verification during a Hardhat Ignition deploy, but there is no Etherscan API Key set.`,
1476
+ },
1477
+ CANNOT_RESET_EPHEMERAL_NETWORK: {
1478
+ number: 1702,
1479
+ messageTemplate:
1480
+ "Deploy cancelled: Cannot reset deployment on ephemeral Hardhat network",
1481
+ websiteTitle: "Cannot reset deployment on ephemeral Hardhat network",
1482
+ websiteDescription: `The reset flag can only used against a persistent network. You are trying to reset a deployment against an in-memory network.`,
1483
+ },
1484
+ UNKNOWN_STRATEGY: {
1485
+ number: 1703,
1486
+ messageTemplate: `Invalid strategy name "{strategyName}", must be either 'basic' or 'create2'`,
1487
+ websiteTitle:
1488
+ "Invalid strategy name, must be either 'basic' or 'create2'",
1489
+ websiteDescription:
1490
+ "Invalid strategy, must be either 'basic' or 'create2'",
1491
+ },
1492
+ NO_MODULES_FOUND: {
1493
+ number: 1704,
1494
+ messageTemplate: "No Ignition modules found",
1495
+ websiteTitle: "No Ignition modules found",
1496
+ websiteDescription:
1497
+ "Ignition was unable to find the module requested for deployment.",
1498
+ },
1499
+ FAILED_TO_PARSE_JSON: {
1500
+ number: 1705,
1501
+ messageTemplate: "Could not parse JSON parameters",
1502
+ websiteTitle: "Could not parse JSON parameters",
1503
+ websiteDescription:
1504
+ "Ignition failed to parse the JSON parameters for deployment. Review the JSON and try again.",
1505
+ },
1506
+ INVALID_DEPLOYMENT_ID: {
1507
+ number: 1706,
1508
+ messageTemplate: `The deployment-id "{deploymentId}" contains banned characters, ids can only contain alphanumerics, dashes or underscores`,
1509
+ websiteTitle: "The deployment-id contains banned characters",
1510
+ websiteDescription:
1511
+ "The deployment-id being used for the Hardhat Ignition deployment contains banned characters. Deployment ids can only contain alphanumerics, dashes or underscores.",
1512
+ },
1513
+ IGNITION_CLIENT_EXTENSION_NOT_INSTALLED: {
1514
+ number: 1707,
1515
+ messageTemplate:
1516
+ "Please install either `@nomicfoundation/hardhat-ignition-viem` or `@nomicfoundation/hardhat-ignition-ethers` to use Ignition in your Hardhat tests",
1517
+ websiteTitle:
1518
+ "Neither the `viem` or `ethers` Ignition extension plugin is installed.",
1519
+ websiteDescription:
1520
+ "Please install either `@nomicfoundation/hardhat-ignition-viem` or `@nomicfoundation/hardhat-ignition-ethers` to use Ignition in your Hardhat tests",
1521
+ },
1522
+ UNKNOWN_TRANSACTION_TYPE: {
1523
+ number: 1708,
1524
+ shouldBeReported: true,
1525
+ messageTemplate: `Unknown transaction type: "{type}"`,
1526
+ websiteTitle:
1527
+ "Hardhat Ignition was unable to display an unknown transaction type",
1528
+ websiteDescription:
1529
+ "Hardhat Ignition was unable to display an unknown transaction type",
1530
+ },
1531
+ PARAMETER_EXCEEDS_MAXIMUM_SAFE_INTEGER: {
1532
+ number: 1709,
1533
+ messageTemplate: `Parameter "{parameter}" exceeds maximum safe integer size. Encode the value as a string using bigint notation: "{value}n"`,
1534
+ websiteTitle: "Parameter exceeds maximum safe integer size",
1535
+ websiteDescription: "Parameter exceeds maximum safe integer size",
1536
+ },
1537
+ MODULE_VALIDATION_FAILED: {
1538
+ number: 1710,
1539
+ messageTemplate:
1540
+ "Module validation failed. Check the stack trace above to identify the issue and its source code location.",
1541
+ websiteTitle: "Module validation failed.",
1542
+ websiteDescription:
1543
+ "Hardhat Ignition found problems while validating the module. Please review the module and try again.",
1544
+ },
1545
+ FAILED_TO_PARSE_DEPLOYMENT_PARAMETERS: {
1546
+ number: 1711,
1547
+ messageTemplate: `Could not parse parameters from "{filepath}"`,
1548
+ websiteTitle: "Parsing of deployment parameters failed.",
1549
+ websiteDescription: "Parsing of deployment parameters failed.",
1550
+ },
1551
+ VISUALIZATION_TEMPLATE_DIR_NOT_FOUND: {
1552
+ number: 1712,
1553
+ shouldBeReported: true,
1554
+ messageTemplate: `Unable to find template directory: "{templateDir}"`,
1555
+ websiteTitle: "Visualization template directory not found",
1556
+ websiteDescription: "Visualization template directory not found",
1557
+ },
1558
+ MODULE_NOT_FOUND_AT_PATH: {
1559
+ number: 1713,
1560
+ messageTemplate: `Could not find a module file at the path: "{modulePath}"`,
1561
+ websiteTitle: "Ignition module not found",
1562
+ websiteDescription:
1563
+ "Hardhat Ignition was not able to find an Ignition Module at the given path.",
1564
+ },
1565
+ MODULE_OUTSIDE_MODULE_DIRECTORY: {
1566
+ number: 1714,
1567
+ messageTemplate: `The referenced module file "{modulePath}" is outside the module directory "{shortModulesDirectoryName}"`,
1568
+ websiteTitle: "Ignition module outside of module directory",
1569
+ websiteDescription:
1570
+ "Ignition modules must be located within the module directory.",
1571
+ },
1572
+ VIEM_TEST_HELPER_ERROR: {
1573
+ number: 1715,
1574
+ messageTemplate: `Hardhat Ignition Viem Test Error: {message}`,
1575
+ websiteTitle: "Test error in Hardhat Ignition Viem's test helper",
1576
+ websiteDescription: "Test error in Hardhat Ignition Viem's test helper.",
1577
+ },
1578
+ ARTIFACT_PATH_NOT_FOUND: {
1579
+ number: 1716,
1580
+ messageTemplate: `Artifact path not found for "{contractName}"`,
1581
+ websiteTitle:
1582
+ "Hardhat Ignition unable to find artifact path for the contract name",
1583
+ websiteDescription:
1584
+ "Hardhat Ignition unable to find artifact path for the contract name",
1585
+ },
1586
+ ONLY_ONE_IGNITION_EXTENSION_PLUGIN_ALLOWED: {
1587
+ number: 1717,
1588
+ messageTemplate:
1589
+ "Found ethers and viem, but only one Hardhat Ignition extension plugin can be used at a time",
1590
+ websiteTitle: "Only one Ignition extension plugin allowed",
1591
+ websiteDescription: `Both the ethers and viem Ignition extension plugins were found, but only one can be used at a time.
1592
+
1593
+ Please only include one of the plugins in your Hardhat configuration.`,
1594
+ },
1595
+ DEPLOYMENT_ERROR: {
1596
+ number: 1718,
1597
+ messageTemplate: "Hardhat Ignition deployment error: {message}",
1598
+ websiteTitle: "Hardhat Ignition deployment error",
1599
+ websiteDescription: `Hardhat Ignition was not able to successfully complete a deployment.
1600
+
1601
+ Please review the error message and try again.`,
1602
+ },
1603
+ NO_DEFAULT_VIEM_WALLET_CLIENT: {
1604
+ number: 1719,
1605
+ messageTemplate:
1606
+ "No default wallet client found while creating Viem contract instances for deployed contracts",
1607
+ websiteTitle: "No default Viem wallet client found",
1608
+ websiteDescription: `Hardhat Ignition will use the default wallet client to create Viem contract instances for deployed contracts. No wallet clients were found.`,
1609
+ },
1610
+ },
1611
+ } as const;