@nomicfoundation/hardhat-errors 3.0.0-next.8 → 3.0.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.
@@ -8,7 +8,7 @@ export interface ErrorDescriptor {
8
8
  number: number;
9
9
 
10
10
  /**
11
- * A tempalte of the message of the error.
11
+ * A template of the message of the error.
12
12
  *
13
13
  * This should be a short description. If possible, it should tell the user
14
14
  * how to solve their problem.
@@ -54,7 +54,7 @@ export const ERROR_CATEGORIES: {
54
54
  min: 1,
55
55
  max: 9999,
56
56
  pluginId: undefined,
57
- websiteTitle: "Hardhat Core",
57
+ websiteTitle: "Hardhat 3",
58
58
  CATEGORIES: {
59
59
  GENERAL: {
60
60
  min: 1,
@@ -116,6 +116,16 @@ export const ERROR_CATEGORIES: {
116
116
  max: 1199,
117
117
  websiteSubTitle: "Hardhat node errors",
118
118
  },
119
+ TEST_PLUGIN: {
120
+ min: 1200,
121
+ max: 1299,
122
+ websiteSubTitle: "Hardhat test plugin errors",
123
+ },
124
+ COVERAGE: {
125
+ min: 1300,
126
+ max: 1399,
127
+ websiteSubTitle: "Hardhat coverage errors",
128
+ },
119
129
  },
120
130
  },
121
131
  IGNITION: {
@@ -274,6 +284,24 @@ export const ERROR_CATEGORIES: {
274
284
  },
275
285
  },
276
286
  },
287
+ HARDHAT_VERIFY: {
288
+ min: 80000,
289
+ max: 89999,
290
+ pluginId: "hardhat-verify",
291
+ websiteTitle: "Hardhat Verify",
292
+ CATEGORIES: {
293
+ GENERAL: {
294
+ min: 80000,
295
+ max: 80099,
296
+ websiteSubTitle: "General errors",
297
+ },
298
+ VALIDATION: {
299
+ min: 80100,
300
+ max: 80199,
301
+ websiteSubTitle: "Validation errors",
302
+ },
303
+ },
304
+ },
277
305
  };
278
306
 
279
307
  export const ERRORS = {
@@ -414,6 +442,29 @@ Please add the property "type" with the value "module" in your package.json to e
414
442
  websiteTitle: "Invalid hex string",
415
443
  websiteDescription: `Given value was not a valid hex string.`,
416
444
  },
445
+ CONFIG_VARIABLE_FORMAT_MUST_INCLUDE_VARIABLE: {
446
+ number: 19,
447
+ messageTemplate: `The format string "{format}" must include {marker} marker`,
448
+ websiteTitle: "Config variable format must include \\{variable\\}",
449
+ websiteDescription: `The config variable format must include the string "\\{variable\\}", which will be replaced with the actual value of the variable.`,
450
+ },
451
+ INVALID_FULLY_QUALIFIED_NAME: {
452
+ number: 20,
453
+ messageTemplate: `Invalid fully qualified contract name "{name}"`,
454
+ websiteTitle: "Invalid fully qualified contract name",
455
+ websiteDescription: `A contract name was expected to be in fully qualified form, but it's not.
456
+
457
+ A fully qualified name should look like file.sol:Contract`,
458
+ },
459
+ INVALID_CONFIG_FILE: {
460
+ number: 21,
461
+ messageTemplate: `Invalid Hardhat config file at {configPath}:
462
+ {errors}`,
463
+ websiteTitle: "Invalid Hardhat config file",
464
+ websiteDescription: `The config file has JS/TS errors.
465
+
466
+ Please resolve the errors before rerunning the command.`,
467
+ },
417
468
  },
418
469
  INTERNAL: {
419
470
  ASSERTION_ERROR: {
@@ -473,6 +524,12 @@ Please install a version of the peer dependency that meets the plugin's requirem
473
524
  websiteTitle: "Plugin hook factory is not a valid file URL",
474
525
  websiteDescription: `The loading of a plugin's hook factory failed as the import path is not a valid file:// URL.`,
475
526
  },
527
+ UNEXPECTED_HOOK_PARAM_MODIFICATION: {
528
+ number: 301,
529
+ messageTemplate: `Parameter "{paramName}" of hook "{hookCategoryName}#{hookName}" is not allowed to be modified`,
530
+ websiteTitle: "Unexpected hook parameter modification",
531
+ websiteDescription: `The parameter is not allowed to be modified`,
532
+ },
476
533
  },
477
534
  TASK_DEFINITIONS: {
478
535
  INVALID_FILE_ACTION: {
@@ -560,18 +617,17 @@ Please ensure that an action is defined for each task.`,
560
617
  websiteDescription:
561
618
  "The task is empty. Please ensure that tasks have at least one action.",
562
619
  },
563
- INVALID_ACTION_URL: {
620
+ INVALID_ACTION_IMPORT: {
564
621
  number: 411,
565
- messageTemplate:
566
- 'Unable to import the action specified by task "{task}" from the module "{action}"',
567
- websiteTitle: "Invalid action URL",
622
+ messageTemplate: 'Unable to import the action for task "{task}".',
623
+ websiteTitle: "Unable to import action for task",
568
624
  websiteDescription:
569
- "The action URL is invalid. Please ensure that the URL is correct.",
625
+ "Unable to import action for task. Please verify that the the file exists and that it provides a default function export.",
570
626
  },
571
627
  INVALID_ACTION: {
572
628
  number: 412,
573
629
  messageTemplate:
574
- 'The action resolved from "{action}" in task "{task}" is not a function',
630
+ 'The action resolved in task "{task}" is not a function',
575
631
  websiteTitle: "Invalid action",
576
632
  websiteDescription:
577
633
  "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.",
@@ -690,6 +746,32 @@ Please double check your arguments.`,
690
746
  'The global option "--config" cannot be used with the "init" command',
691
747
  websiteDescription: `The global option "--config" cannot be used with the "init" command.
692
748
 
749
+ Please double check your arguments.`,
750
+ },
751
+ CANNOT_GROUP_OPTIONS: {
752
+ number: 509,
753
+ messageTemplate:
754
+ 'Invalid option "{option}". Options cannot be grouped together. Try providing the options separately.',
755
+ websiteTitle: "Options grouping is not supported",
756
+ websiteDescription: `Options cannot be grouped together.
757
+
758
+ Please double check your arguments, and try providing the options separately.`,
759
+ },
760
+ CANNOT_REPEAT_OPTIONS: {
761
+ number: 510,
762
+ messageTemplate:
763
+ 'Invalid option "{option}". Options of type "{type}" cannot be repeated.',
764
+ websiteTitle: "Options repetition is not supported",
765
+ websiteDescription: `Some options cannot be repeated.
766
+
767
+ Please double check your arguments.`,
768
+ },
769
+ INVALID_SHORT_NAME: {
770
+ number: 511,
771
+ messageTemplate: `Argument short name "{name}" is invalid. It must consist of exactly one letter.`,
772
+ websiteTitle: "Invalid short argument name",
773
+ websiteDescription: `One of your Hardhat or task short argument names is invalid.
774
+
693
775
  Please double check your arguments.`,
694
776
  },
695
777
  },
@@ -871,7 +953,7 @@ Try using another mnemonic or deriving less keys.`,
871
953
  messageTemplate:
872
954
  'The provided network type "{networkType}" for network "{networkName}" is not recognized, only `http` and `edr` are supported.',
873
955
  websiteTitle: "Invalid network type",
874
- websiteDescription: `The network manager only supports the network types 'http' and 'edr'.`,
956
+ websiteDescription: `The network manager only supports the network types 'http' and 'edr-simulated'.`,
875
957
  },
876
958
  DATA_FIELD_CANNOT_BE_NULL_WITH_NULL_ADDRESS: {
877
959
  number: 721,
@@ -887,6 +969,16 @@ Try using another mnemonic or deriving less keys.`,
887
969
  websiteDescription:
888
970
  "The provider your are trying to use has been closed. Please create a new one using hre.network.connect() and try again.",
889
971
  },
972
+ INCOMPATIBLE_EIP7702_FIELDS: {
973
+ number: 723,
974
+ messageTemplate:
975
+ "An incompatible transaction with gasPrice and EIP-7702 fields.",
976
+ websiteTitle: "Incompatible EIP-7702 parameters",
977
+ websiteDescription: `You are trying to send a transaction with a locally managed
978
+ account, and its parameters are incompatible. You sent both gasPrice and authorizationList.
979
+
980
+ Please double check your transactions' parameters.`,
981
+ },
890
982
  },
891
983
  SOLIDITY_TESTS: {
892
984
  BUILD_INFO_NOT_FOUND_FOR_CONTRACT: {
@@ -914,140 +1006,38 @@ Remaining test suites: {suites}`,
914
1006
  },
915
1007
  },
916
1008
  SOLIDITY: {
917
- RESOLVING_INCORRECT_FILE_AS_PROJECT_FILE: {
1009
+ PROJECT_ROOT_RESOLUTION_ERROR: {
918
1010
  number: 900,
919
- shouldBeReported: true,
920
- messageTemplate: `File "{file}" is being resolved as a project file, but it's not part of the project.`,
921
- websiteTitle: "Solidity project file is outside the project",
922
- websiteDescription: `Tried to resolve a file as a project file, but it's not part of the project.`,
923
- },
924
- RESOLVING_NONEXISTENT_PROJECT_FILE: {
925
- number: 901,
926
- shouldBeReported: true,
927
- messageTemplate: `File "{file}" is being resolved as a project file, but it doesn't exist.`,
928
- websiteTitle: "Solidity project file doesn't exist",
929
- websiteDescription: `Tried to resolve a file as a project file, but it doesn't exist.`,
930
- },
931
- IMPORTED_FILE_DOESNT_EXIST: {
932
- number: 902,
933
- messageTemplate: `The import "{importPath} from "{from}" doesn't exist.`,
934
- websiteTitle: "Imported file doesn't exist",
935
- websiteDescription: `An imported file doesn't exist.`,
936
- },
937
- IMPORTED_FILE_WITH_INCORRECT_CASING: {
938
- number: 903,
939
- messageTemplate:
940
- 'The import "{importPath} from "{from}" exists, but its casing is incorrect. The correct casing is "{correctCasing}".',
941
- websiteTitle: "Imported file with incorrect casing",
942
- websiteDescription: `Hardhat enforces that you import your files with the correct casing (as stored in the filesystem).
1011
+ messageTemplate: `There was an error while resolving the project file "{filePath}":
943
1012
 
944
- This error is thrown when you import a file with the wrong casing under a case insensitve filesystem.`,
945
- },
946
- IMPORTED_PACKAGE_EXPORTS_FILE_WITH_INCORRECT_CASING: {
947
- number: 904,
948
- messageTemplate:
949
- 'The import "{importPath} from "{from}" exists, but its casing is incorrect.',
950
- websiteTitle: "Imported file with incorrect casing",
951
- websiteDescription: `Hardhat enforces that you import your files with the correct casing (as stored in the filesystem).
1013
+ {error}`,
1014
+ websiteTitle: "Project file resolution error",
1015
+ websiteDescription: `There was an error while resolving the project file.
952
1016
 
953
- This error is thrown when you import a file with the wrong casing under a case insensitve filesystem.`,
954
- },
955
- NPM_DEPEDNDENCY_NOT_INSTALLED: {
956
- number: 905,
957
- messageTemplate:
958
- 'The npm package "{packageName}" isn\'t installed in the {from}.',
959
- websiteTitle: "Uninstalled npm dependency",
960
- websiteDescription: `Trying to use an npm package as a solidity dependency, but it's not installed.`,
1017
+ Please double-check your configuration. If it keeps happening, please report it.`,
961
1018
  },
962
- IMPORTED_NPM_DEPENDENCY_NOT_INSTALLED: {
963
- number: 906,
964
- messageTemplate:
965
- 'The import "{importPath}" from "{from}" is trying to use an uninstalled npm dependency.',
966
- websiteTitle: "Uninstalled npm solidity dependency",
967
- websiteDescription: `One of your files is traying to import a dependency using npm, but it hasn't been installed`,
968
- },
969
- USER_REMAPPING_WITH_NPM_CONTEXT: {
970
- number: 907,
971
- messageTemplate:
972
- 'The remapping "{remapping}" has a context starting with "npm/", which is forbidden. Hardhat doesn\'t allow changing the behaviour of npm package\'s imports.',
973
- websiteTitle: "Remapping imports in npm packages is not allowed",
974
- websiteDescription: `This error happened because you are trying to change how the imports within an npm package, which is not allowed.
1019
+ NPM_ROOT_RESOLUTION_ERROR: {
1020
+ number: 901,
1021
+ messageTemplate: `There was an error while resolving the npm module "{npmModule}" when trying to compile it:
975
1022
 
976
- 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.`,
977
- },
978
- REMAPPING_WITH_INVALID_SYNTAX: {
979
- number: 908,
980
- messageTemplate: `The remapping "{remapping}" is invalid.`,
981
- websiteTitle: "Invalid remapping",
982
- websiteDescription: `You are trying to set a user remapping, but it's syntax is invalid.
1023
+ {error}`,
1024
+ websiteTitle: "Npm file resolution error",
1025
+ websiteDescription: `There was an error while resolving an npm module that you are trying to compile and generate artifacts for.
983
1026
 
984
- Please double check your remmpaings' syntax.`,
1027
+ Please double-check your configuration. If it keeps happening, please report it.`,
985
1028
  },
986
- REMAPPING_TO_UNINSTALLED_PACKAGE: {
987
- number: 909,
988
- messageTemplate: `The remapping "{remapping}" is trying to use the npm package "{package}", which is not installed`,
989
- websiteTitle: "Remapping into an uninstaleld npm package",
990
- websiteDescription: `You are trying to set a user remapping that uses an npm pacakge as target, but it's not installed.
1029
+ IMPORT_RESOLUTION_ERROR: {
1030
+ number: 902,
1031
+ messageTemplate: `There was an error while resolving the import "{importPath}" from "{filePath}":
991
1032
 
992
- Please make sure to install the package or fix the remapping.`,
993
- },
994
- REMAPPING_NPM_PACKAGE_AS_MONOREPO: {
995
- number: 910,
996
- messageTemplate: `The remapping "{remapping}" targets the npm pacakge "{pacakge}" as if it were part of this repository, but version "{version}" is installed instead`,
997
- websiteTitle:
998
- "Remapping into a monorepo package but found an npm package instead",
999
- 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.`,
1000
- },
1001
- REMAPPING_HARDHAT_PROJECT_AS_MONOREPO_PACKAGE: {
1002
- number: 911,
1003
- 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.`,
1004
- websiteTitle: `Remapping into the project using npm`,
1005
- websiteDescription: `You are trying to set a remapping whose target uses the npm/ syntax, but is within your Hardhat project.
1033
+ {error}`,
1034
+ websiteTitle: "Import resolution error",
1035
+ websiteDescription: `There was an error while resolving an import.
1006
1036
 
1007
- Please don't use npm/... as target, but use normal internal project remapping istead.`,
1008
- },
1009
- REMAPPING_INCORRECT_VERSION: {
1010
- number: 912,
1011
- messageTemplate: `The remapping "{remapping}" is trying to set the npm package "{package}" version "{expectedVersion}" as target, but found version "{actualVersion}" instead.`,
1012
- websiteTitle: `Remapping into incorrect npm package version`,
1013
- 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.
1014
-
1015
- Please change your remapping to match the installed version, or installed the correct one.`,
1016
- },
1017
- INVALID_NPM_IMPORT: {
1018
- number: 913,
1019
- 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.`,
1020
- websiteTitle: `Invalid npm import`,
1021
- 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.`,
1022
- },
1023
- ILLEGAL_PACKAGE_IMPORT: {
1024
- number: 914,
1025
- messageTemplate: `The import "{importPath}" in "{from}" is not a legal import as it's trying to import a file outside of its package.`,
1026
- websiteTitle: `Illegal package import`,
1027
- 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.`,
1028
- },
1029
- ILEGALL_PROJECT_IMPORT: {
1030
- number: 915,
1031
- messageTemplate: `The import "{importPath}" in "{from}" is not a legal import as it's trying to import a file outside of the project.`,
1032
- websiteTitle: `Illegal project import`,
1033
- 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.`,
1034
- },
1035
- ILLEGAL_PROJECT_IMPORT_AFTER_REMAPPING: {
1036
- number: 916,
1037
- 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.`,
1038
- websiteTitle: `Illegal project import after remapping`,
1039
- 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.
1040
-
1041
- If you are trying to remap into an npm module use the npm/ syntax instead.`,
1042
- },
1043
- IMPORT_PATH_WITH_WINDOWS_SEPARATOR: {
1044
- number: 917,
1045
- messageTemplate: `The import "{importPath}" in "{from}" is not a valid import as it contains a Windows path separator.`,
1046
- websiteTitle: `Import path with Windows path separator`,
1047
- 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.`,
1037
+ Please double-check your import`,
1048
1038
  },
1049
1039
  INVALID_SOLC_VERSION: {
1050
- number: 918,
1040
+ number: 903,
1051
1041
  messageTemplate: `Solidity version {version} is invalid or hasn't been released yet.
1052
1042
 
1053
1043
  If you are certain it has been released, run "npx hardhat clean --global" and try again`,
@@ -1056,39 +1046,8 @@ If you are certain it has been released, run "npx hardhat clean --global" and tr
1056
1046
 
1057
1047
  If you are certain it has been released, run \`npx hardhat clean --global\` and try again.`,
1058
1048
  },
1059
- RESOLVE_NPM_FILE_WITH_INVALID_FORMAT: {
1060
- number: 919,
1061
- messageTemplate: `Couldn't resolve the npm file "{module}" because it has an invalid format.
1062
-
1063
- Make sure that you are providing valid npm file paths (e.g. package/File.sol) in your config and programatically.`,
1064
- websiteTitle: "Resolving invalid npm file",
1065
- websiteDescription: `Tried to resolve an npm file directly (i.e. not imported by another file) but its format is invalid.
1066
-
1067
- 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.`,
1068
- },
1069
- RESOLVE_NPM_FILE_CLASHES_WITH_LOCAL_FILES: {
1070
- number: 920,
1071
- shouldBeReported: true,
1072
- 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.
1073
-
1074
- Please try renaming the directory.`,
1075
- websiteTitle: "Resolution of npm file clashes with local files",
1076
- 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.`,
1077
- },
1078
- RESOLVE_NON_EXISTENT_NPM_ROOT: {
1079
- number: 921,
1080
- messageTemplate: `You are tying to compile the npm file "{module}", but it doesn't exist within its package.`,
1081
- websiteTitle: "Resolution of non-existent npm file",
1082
- websiteDescription: `You are tying to resolve an npm file that doesn't exist within its package.`,
1083
- },
1084
- RESOLVE_WRONG_CASING_NPM_ROOT: {
1085
- number: 922,
1086
- messageTemplate: `You are tying to compile the npm file "{module}", its casing is incorrect. Please double check it in your config.`,
1087
- websiteTitle: "Resolution of npm file with incorrect casing",
1088
- websiteDescription: `You are tying to resolve an npm file whose casing is incorrect.`,
1089
- },
1090
1049
  DOWNLOAD_FAILED: {
1091
- number: 923,
1050
+ number: 904,
1092
1051
  messageTemplate:
1093
1052
  "Couldn't download compiler version {remoteVersion}. Please check your internet connection and try again.",
1094
1053
  websiteTitle: "`solc` download failed",
@@ -1097,7 +1056,7 @@ Please try renaming the directory.`,
1097
1056
  Please check your internet connection and try again.`,
1098
1057
  },
1099
1058
  VERSION_LIST_DOWNLOAD_FAILED: {
1100
- number: 924,
1059
+ number: 905,
1101
1060
  messageTemplate:
1102
1061
  "Couldn't download compiler version list. Please check your internet connection and try again.",
1103
1062
  websiteTitle: "Couldn't obtain `solc` version list",
@@ -1106,7 +1065,7 @@ Please check your internet connection and try again.`,
1106
1065
  Please check your internet connection and try again.`,
1107
1066
  },
1108
1067
  INVALID_DOWNLOAD: {
1109
- number: 925,
1068
+ number: 906,
1110
1069
  messageTemplate: `Couldn't download compiler version {remoteVersion}: Checksum verification failed.
1111
1070
 
1112
1071
  Please check your internet connection and try again.
@@ -1120,7 +1079,7 @@ Please check your internet connection and try again.
1120
1079
  If this error persists, run \`npx hardhat clean --global\`.`,
1121
1080
  },
1122
1081
  CANT_RUN_NATIVE_COMPILER: {
1123
- number: 926,
1082
+ number: 907,
1124
1083
  messageTemplate: `A native version of solc failed to run.
1125
1084
 
1126
1085
  If you are running MacOS, try installing Apple Rosetta.
@@ -1134,7 +1093,7 @@ If you are running MacOS, try installing Apple Rosetta.
1134
1093
  If this error persists, run "npx hardhat clean --global".`,
1135
1094
  },
1136
1095
  CANT_RUN_SOLCJS_COMPILER: {
1137
- number: 927,
1096
+ number: 908,
1138
1097
  messageTemplate: `A wasm version of solc failed to run.
1139
1098
 
1140
1099
  If this error persists, run "npx hardhat clean --global".`,
@@ -1146,7 +1105,7 @@ If you are running MacOS, try installing Apple Rosetta.
1146
1105
  If this error persists, run "npx hardhat clean --global".`,
1147
1106
  },
1148
1107
  COMPILATION_JOB_CREATION_ERROR: {
1149
- number: 928,
1108
+ number: 909,
1150
1109
  messageTemplate: `Failed to create compilation job for file "{rootFilePath}" using the build profile "{buildProfile}".
1151
1110
 
1152
1111
  {reason}`,
@@ -1156,7 +1115,7 @@ If this error persists, run "npx hardhat clean --global".`,
1156
1115
  This happens when your files require incompatible versions of solc or you haven't configured a version that works with them`,
1157
1116
  },
1158
1117
  BUILD_FAILED: {
1159
- number: 929,
1118
+ number: 910,
1160
1119
  messageTemplate: "Compilation failed",
1161
1120
  websiteTitle: "Compilation failed",
1162
1121
  websiteDescription: `Your smart contracts failed to compile.
@@ -1164,19 +1123,13 @@ This happens when your files require incompatible versions of solc or you haven'
1164
1123
  Please check Hardhat's output for more details.`,
1165
1124
  },
1166
1125
  INVALID_SOLCJS_COMPILER: {
1167
- number: 930,
1126
+ number: 911,
1168
1127
  messageTemplate: `A wasm version of solc {version} is invalid. The compile function is not available.`,
1169
1128
  websiteTitle: "Invalid solcjs compiler",
1170
- websiteDescription: `Hardhat successfully downloaded a WASM version of solc {version} but it is invalid. The compile function is missing.`,
1171
- },
1172
- RESOLVE_NOT_EXPORTED_NPM_FILE: {
1173
- number: 931,
1174
- messageTemplate: `You are tying to resolve the npm file "{module}", but it's not exported by its package`,
1175
- websiteTitle: "Resolution of not-exported npm file",
1176
- websiteDescription: `You are tying to resolve an npm file that is not exported by its package.`,
1129
+ websiteDescription: `Hardhat successfully downloaded a WASM version of solc but it is invalid. The compile function is missing.`,
1177
1130
  },
1178
1131
  BUILD_PROFILE_NOT_FOUND: {
1179
- number: 932,
1132
+ number: 912,
1180
1133
  messageTemplate: `The build profile "{buildProfileName}" is not defined in your Hardhat config`,
1181
1134
  websiteTitle: "Build profile not defined",
1182
1135
  websiteDescription: `The build profile you are trying to use is not defined in your Hardhat config.`,
@@ -1209,9 +1162,31 @@ Please use the fully qualified name of the contract to disambiguate it.`,
1209
1162
  NODE: {
1210
1163
  INVALID_NETWORK_TYPE: {
1211
1164
  number: 1100,
1212
- messageTemplate: `The provided node network type "{networkType}" for network "{networkName}" is not recognized, only 'edr' is supported.`,
1165
+ messageTemplate: `The provided node network type "{networkType}" for network "{networkName}" is not recognized, only 'edr-simulated' is supported.`,
1213
1166
  websiteTitle: "Invalid node network type",
1214
- websiteDescription: `The node only supports the 'edr' network type.`,
1167
+ websiteDescription: `The node only supports the 'edr-simulated' network type.`,
1168
+ },
1169
+ },
1170
+ TEST_PLUGIN: {
1171
+ CANNOT_DETERMINE_TEST_RUNNER: {
1172
+ number: 1200,
1173
+ messageTemplate: `Cannot determine a test runner for the following files: {files}. Please check whether these files are correctly included in the test paths defined by your test plugins in the Hardhat configuration. If they are, this likely indicates an issue with a plugin not correctly detecting the files.`,
1174
+ websiteTitle: "Cannot determine a test runner for files",
1175
+ websiteDescription: `Cannot determine a test runner for the test files. This may be because the files are not correctly included in the test paths defined by the test plugins in the Hardhat configuration. If they are correctly included, this likely indicates an issue with a plugin failing to detect the files.`,
1176
+ },
1177
+ },
1178
+ COVERAGE: {
1179
+ SOURCE_NOT_INSTRUMENTED: {
1180
+ number: 1300,
1181
+ messageTemplate: `The source file "{sourceName}" could not be instrumented for coverage.`,
1182
+ websiteTitle: "Source file not instrumented for coverage",
1183
+ websiteDescription: `The source file could not be instrumented for coverage.`,
1184
+ },
1185
+ IMPORT_PATH_ALREADY_DEFINED: {
1186
+ number: 1301,
1187
+ messageTemplate: `The import path "{importPath}" is already defined in the compilation sources`,
1188
+ websiteTitle: "Import path already defined in compilation sources",
1189
+ websiteDescription: `The import path is already defined in the compilation sources`,
1215
1190
  },
1216
1191
  },
1217
1192
  },
@@ -1231,6 +1206,14 @@ Please use the fully qualified name of the contract to disambiguate it.`,
1231
1206
  websiteTitle: "Unsupported ethers.js value",
1232
1207
  websiteDescription: "Unsupported ethers.js value",
1233
1208
  },
1209
+ ARTIFACT_MIGRATION_NEEDED: {
1210
+ number: 10002,
1211
+ messageTemplate:
1212
+ "Hardhat Ignition needs to migrate this deployments artifacts to the new format. Please run `npx hardhat ignition migrate {deploymentId}`",
1213
+ websiteTitle: "Artifact migration needed",
1214
+ websiteDescription:
1215
+ "Hardhat Ignition needs to migrate the artifacts to the new format. Please run `npx hardhat ignition migrate {deploymentId}`",
1216
+ },
1234
1217
  },
1235
1218
  INTERNAL: {
1236
1219
  INTERNAL_ERROR: {
@@ -1521,11 +1504,11 @@ Please review the error message and try again.`,
1521
1504
  },
1522
1505
  TRANSACTION_LOST: {
1523
1506
  number: 10410,
1524
- messageTemplate: `An error occured while trying to send a transaction for future {futureId}.
1507
+ messageTemplate: `An error occurred while trying to send a transaction for future {futureId}.
1525
1508
  Please use a block explorer to find the hash of the transaction with nonce {nonce} sent from account {sender} and use the following command to add it to your deployment:
1526
1509
  npx hardhat ignition track-tx <txHash> <deploymentId> --network <networkName>`,
1527
1510
  websiteTitle: "Transaction lost",
1528
- websiteDescription: `An error occured while trying to send a transaction`,
1511
+ websiteDescription: `An error occurred while trying to send a transaction`,
1529
1512
  },
1530
1513
  },
1531
1514
  RECONCILIATION: {
@@ -1683,7 +1666,7 @@ npx hardhat ignition track-tx <txHash> <deploymentId> --network <networkName>`,
1683
1666
  messageTemplate:
1684
1667
  "Invalid libraries for contract {contractName}: The names '{inputName}' and '{libName}' clash with each other, please use qualified names for both.",
1685
1668
  websiteTitle: "Conflicting library names",
1686
- websiteDescription: `The libray names clash with each other`,
1669
+ websiteDescription: `The library names clash with each other`,
1687
1670
  },
1688
1671
  INVALID_LIBRARY_NAME: {
1689
1672
  number: 10718,
@@ -1859,14 +1842,14 @@ Please double check the error you are getting when running Hardhat Ignition, and
1859
1842
  },
1860
1843
  KNOWN_TRANSACTION: {
1861
1844
  number: 11304,
1862
- messageTemplate: `The transaction hash that you provided was already present in your deployment.
1845
+ messageTemplate: `The transaction hash that you provided was already present in your deployment.
1863
1846
  Please double check the error you are getting when running Hardhat Ignition, and the instructions it's providing.`,
1864
1847
  websiteTitle: "Known transaction",
1865
1848
  websiteDescription: `The transaction hash that you provided was already present in your deployment.`,
1866
1849
  },
1867
1850
  INSUFFICIENT_CONFIRMATIONS: {
1868
1851
  number: 11305,
1869
- messageTemplate: `The transaction you provided doesn't have enough confirmations yet.
1852
+ messageTemplate: `The transaction you provided doesn't have enough confirmations yet.
1870
1853
  Please try again later.`,
1871
1854
  websiteTitle: "Insufficient confirmations",
1872
1855
  websiteDescription: `The transaction you provided doesn't have enough confirmations yet.`,
@@ -1961,6 +1944,26 @@ Please try again later.`,
1961
1944
  websiteTitle: "Unsupported type for deep copy",
1962
1945
  websiteDescription: "Unsupported type for deep copy",
1963
1946
  },
1947
+ ACCOUNTS_OF_TYPE_REMOTE: {
1948
+ number: 20014,
1949
+ messageTemplate:
1950
+ "Tried to obtain a private key, but the network is configured to use remote accounts.",
1951
+ websiteTitle: "Remote accounts are not supported",
1952
+ websiteDescription: "Remote accounts are not supported",
1953
+ },
1954
+ WRONG_ACCOUNTS_FORMAT: {
1955
+ number: 20015,
1956
+ messageTemplate: `The "accounts" property in your Hardhat configuration file is not set correctly.`,
1957
+ websiteTitle: `Invalid "accounts" property in your Hardhat configuration file`,
1958
+ websiteDescription: `The "accounts" property in your Hardhat configuration file is not set correctly. Please double check it and try again.`,
1959
+ },
1960
+ NO_PRIVATE_KEY_FOR_ADDRESS: {
1961
+ number: 20016,
1962
+ messageTemplate: `No private key can be associated with the address "{address}".`,
1963
+ websiteTitle: "Private key for the address could not be found",
1964
+ websiteDescription:
1965
+ "The private key for the address could not be found. Please double check your private keys and try again.",
1966
+ },
1964
1967
  },
1965
1968
  },
1966
1969
  HARDHAT_MOCHA: {
@@ -1982,11 +1985,13 @@ Please try again later.`,
1982
1985
  websiteTitle: "Network not found",
1983
1986
  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:
1984
1987
 
1988
+ \`\`\`ts
1985
1989
  import { someChain } from "viem/chains";
1986
1990
  const client = await hre.viem.getPublicClient({
1987
1991
  chain: someChain,
1988
1992
  ...
1989
1993
  });
1994
+ \`\`\`
1990
1995
 
1991
1996
  You can find a list of supported networks here: https://github.com/wevm/viem/blob/main/src/chains/index.ts`,
1992
1997
  },
@@ -2007,12 +2012,15 @@ Please ensure you're using one of the supported networks.`,
2007
2012
 
2008
2013
  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:
2009
2014
 
2015
+ \`\`\`ts
2010
2016
  const networkConnection = await hre.network.connect(...);
2011
2017
  const walletClient = await networkConnection.viem.getWalletClient(address);
2012
2018
 
2013
2019
  await networkConnection.viem.deployContract(contractName, constructorArgs, { walletClient });
2014
2020
  await networkConnection.viem.sendDeploymentTransaction(contractName, constructorArgs, { walletClient });
2015
- await networkConnection.viem.getContractAt(contractName, address, { walletClient });`,
2021
+ await networkConnection.viem.getContractAt(contractName, address, { walletClient });
2022
+ \`\`\`
2023
+ `,
2016
2024
  },
2017
2025
  LINKING_CONTRACT_ERROR: {
2018
2026
  number: 40003,
@@ -2048,6 +2056,20 @@ Please check Hardhat's output for more details.`,
2048
2056
  websiteDescription:
2049
2057
  "The password you provided is incorrect or the keystore file is corrupted.",
2050
2058
  },
2059
+ CANNOT_CHANGED_PASSWORD_FOR_DEV_KEYSTORE: {
2060
+ number: 50001,
2061
+ messageTemplate: `The keystore "change-password" task cannot be used with the development keystore`,
2062
+ websiteTitle: "Cannot change password for dev keystore",
2063
+ websiteDescription: `The keystore "change-password" task cannot be used with the development keystore`,
2064
+ },
2065
+ KEY_NOT_FOUND_DURING_TESTS_WITH_DEV_KEYSTORE: {
2066
+ number: 50002,
2067
+ messageTemplate: `Key "{key}" not found in the development keystore. Run "npx hardhat keystore set {key} --dev" to set it.`,
2068
+ websiteTitle: "Key not found in the development keystore during tests",
2069
+ websiteDescription: `Key not found in the development keystore. During tests, configuration variables can only be accessed through the development keystore.
2070
+
2071
+ Run \`npx hardhat keystore set <KEY> --dev\` to set it.`,
2072
+ },
2051
2073
  },
2052
2074
  },
2053
2075
  NETWORK_HELPERS: {
@@ -2242,9 +2264,9 @@ This might be caused by using hardhat_reset and loadFixture calls in a testcase.
2242
2264
  messageTemplate:
2243
2265
  "The .revertedWithCustomError matcher expects two arguments: the contract and the custom error name. Arguments should be asserted with the .withArgs helper.",
2244
2266
  websiteTitle:
2245
- "Invalid arguments length for the .revertedWithCustomError matcher",
2267
+ "Invalid arguments length for the .revertedWithCustomError matcher",
2246
2268
  websiteDescription:
2247
- "Invalid arguments length for the .revertedWithCustomError matcher",
2269
+ "Invalid arguments length for the .revertedWithCustomError matcher",
2248
2270
  },
2249
2271
  WITH_ARGS_FORBIDDEN: {
2250
2272
  number: 70011,
@@ -2340,6 +2362,396 @@ This might be caused by using hardhat_reset and loadFixture calls in a testcase.
2340
2362
  websiteDescription:
2341
2363
  "withArgs called with both .emit and .revertedWithCustomError, but these assertions cannot be combined",
2342
2364
  },
2365
+ DEPRECATED_REVERTED_MATCHER: {
2366
+ number: 70024,
2367
+ messageTemplate:
2368
+ "The .reverted matcher has been deprecated. Use .revert(ethers) instead.",
2369
+ websiteTitle: "Deprecated `reverted` matcher",
2370
+ websiteDescription:
2371
+ "The `.reverted` matcher was deprecated and you should use `.revert(ethers)` instead.",
2372
+ },
2373
+ },
2374
+ },
2375
+ HARDHAT_VERIFY: {
2376
+ GENERAL: {
2377
+ NETWORK_NOT_SUPPORTED: {
2378
+ number: 80000,
2379
+ messageTemplate: `The network "{networkName}" with chain id "{chainId}" is not supported.`,
2380
+ websiteTitle: "Network not supported",
2381
+ websiteDescription: `The network is not supported by hardhat-verify. To see the list of supported networks, run:
2382
+
2383
+ \`\`\`sh
2384
+ npx hardhat verify --list-networks
2385
+ \`\`\`
2386
+
2387
+ To add support for a new network, see https://hardhat.org/verify-custom-networks`,
2388
+ },
2389
+ EXPLORER_REQUEST_FAILED: {
2390
+ number: 80001,
2391
+ messageTemplate: `The request to {url} failed with the message "{errorMessage}". This error comes from {name}, not Hardhat.`,
2392
+ websiteTitle: "Explorer request failed",
2393
+ websiteDescription: `The request to the explorer failed.
2394
+
2395
+ - Verify that the URL is correct.
2396
+ - Ensure the service is up and reachable.
2397
+ - Check your network connection and try again.`,
2398
+ },
2399
+ EXPLORER_REQUEST_STATUS_CODE_ERROR: {
2400
+ number: 80002,
2401
+ messageTemplate: `The request to {url} returned a non-success status code {statusCode}: "{errorMessage}". (This response comes from {name}, not Hardhat.)`,
2402
+ websiteTitle: "Explorer request status code error",
2403
+ websiteDescription: `The request to the explorer returned a non-success status code.
2404
+
2405
+ - Verify that the URL is correct.
2406
+ - Ensure the service is up and reachable.
2407
+ - Check your network connection and try again.`,
2408
+ },
2409
+ SOLC_VERSION_NOT_SUPPORTED: {
2410
+ number: 80003,
2411
+ messageTemplate: `The following Solidity compiler versions are not supported by the Etherscan API: {unsupportedSolcVersions}.`,
2412
+ websiteTitle: "Unsupported solidity compiler version",
2413
+ websiteDescription: `The specified Solidity compiler version is not supported by the Etherscan API. Only versions 0.4.11 and above are supported.
2414
+ For a full list of supported versions, visit: https://etherscan.io/solcversions`,
2415
+ },
2416
+ DEPLOYED_BYTECODE_NOT_FOUND: {
2417
+ number: 80004,
2418
+ messageTemplate: `No bytecode found at address "{address}". Is the contract deployed on the "{networkName}" network?`,
2419
+ websiteTitle: "Deployed bytecode not found",
2420
+ websiteDescription: `No bytecode was found at the specified address. This usually means the contract is not deployed or was deployed to a different network.
2421
+ Please verify the address and selected network, and try again.`,
2422
+ },
2423
+ SOLC_VERSION_MISMATCH: {
2424
+ number: 80005,
2425
+ messageTemplate: `The contract deployed to the "{networkName}" network was compiled with Solidity {deployedSolcVersion}, but the configured compiler {configuredSolcVersionSummary}.`,
2426
+ websiteTitle: "Compiler version mismatch",
2427
+ websiteDescription: `The Solidity compiler version used to compile the deployed contract does not match any of the versions configured in your Hardhat project.
2428
+
2429
+ This mismatch may indicate:
2430
+
2431
+ - You're not on the same commit that was used to deploy the contract.
2432
+ - The compiler version in your Hardhat config is incorrect.
2433
+ - The address provided is not the deployed contract.
2434
+ - The selected network is incorrect.`,
2435
+ },
2436
+ CONTRACT_NOT_FOUND: {
2437
+ number: 80006,
2438
+ messageTemplate: `The contract "{contract}" is not present in your project's artifacts.`,
2439
+ websiteTitle: "Contract not found",
2440
+ websiteDescription: `The specified contract is not present in your project's artifacts. Please ensure the contract is compiled and the name is correct.`,
2441
+ },
2442
+ BUILD_INFO_NOT_FOUND: {
2443
+ number: 80007,
2444
+ messageTemplate: `The contract "{contract}" is present in your project, but its build info is missing.`,
2445
+ websiteTitle: "Build info not found",
2446
+ websiteDescription: `The specified contract is present in your project, but its build info is missing. Please ensure the contract is compiled by Hardhat and that it is written in Solidity.`,
2447
+ },
2448
+ BUILD_INFO_SOLC_VERSION_MISMATCH: {
2449
+ number: 80008,
2450
+ messageTemplate: `The contract "{contract}" build info specifies Solidity {buildInfoSolcVersion}, but the deployed bytecode on the "{networkName}" network indicates {versionDetails}.`,
2451
+ websiteTitle: "Build info compiler version mismatch",
2452
+ websiteDescription: `The compiler version in the build info does not match the version encoded in the deployed bytecode.
2453
+ Possible causes:
2454
+
2455
+ - Compiler settings were changed after deployment.
2456
+ - The contract address is incorrect.
2457
+ - The selected network is incorrect.`,
2458
+ },
2459
+ DEPLOYED_BYTECODE_MISMATCH: {
2460
+ number: 80009,
2461
+ messageTemplate: `The address contains a contract whose bytecode does not match {contractDescription}.`,
2462
+ websiteTitle: "Deployed bytecode mismatch",
2463
+ websiteDescription: `The bytecode at the specified address did not match the expected contract.
2464
+
2465
+ Possible causes:
2466
+
2467
+ - Your artifacts are outdated or missing; try running \`npx hardhat compile --force --buildProfile production\`.
2468
+ - The contract code was modified after deployment.
2469
+ - Compiler settings (optimizer, EVM version, etc.) changed after deployment.
2470
+ - The provided address is incorrect.
2471
+ - The selected network is incorrect.`,
2472
+ },
2473
+ DEPLOYED_BYTECODE_MULTIPLE_MATCHES: {
2474
+ number: 80010,
2475
+ messageTemplate: `More than one contract matches the deployed bytecode:
2476
+ {fqnList}
2477
+
2478
+ Specify the exact contract using the \`--contract\` flag.`,
2479
+ websiteTitle: "Multiple contract matches",
2480
+ websiteDescription: `The deployed bytecode matches multiple compiled contracts. Specify the exact contract using the \`--contract\` flag. For example:
2481
+
2482
+ \`\`\`sh
2483
+ npx hardhat verify --contract contracts/Example.sol:ExampleContract <other args>
2484
+ \`\`\`
2485
+ `,
2486
+ },
2487
+ INVALID_LIBRARY_ADDRESS: {
2488
+ number: 80011,
2489
+ messageTemplate: `The library "{library}" provided for the contract "{contract}" has an invalid address: "{address}".`,
2490
+ websiteTitle: "Invalid library address",
2491
+ websiteDescription: `The address provided for a linked library is invalid. Please make sure the address is a valid Ethereum address.`,
2492
+ },
2493
+ UNUSED_LIBRARY: {
2494
+ number: 80012,
2495
+ messageTemplate: `The library "{library}" provided for the contract "{contract}" is not used by the contract.
2496
+
2497
+ {suggestion}`,
2498
+ websiteTitle: "Library not found in contract",
2499
+ websiteDescription: `A library was specified using the "--libraries" option, but the selected contract does not use it.
2500
+
2501
+ If the contract uses external libraries, verify that the provided name matches the fully qualified name (FQN) of one of them, such as:
2502
+
2503
+ \`\`\`
2504
+ contracts/Math.sol:SafeMath
2505
+ \`\`\`
2506
+ `,
2507
+ },
2508
+ LIBRARY_MULTIPLE_MATCHES: {
2509
+ number: 80013,
2510
+ messageTemplate: `The library "{library}" provided for the contract "{contract}" is ambiguous.
2511
+ It matches multiple libraries:
2512
+ {fqnList}
2513
+
2514
+ To fix this, specify one of these fully qualified library names and try again.`,
2515
+ websiteTitle: "Library name is ambiguous",
2516
+ websiteDescription: `The specified library name matches multiple libraries used by the contract.
2517
+
2518
+ To resolve the ambiguity, provide the fully qualified library name in the format:
2519
+
2520
+ \`\`\`
2521
+ path/to/LibraryFile.sol:LibraryName
2522
+ \`\`\`
2523
+ `,
2524
+ },
2525
+ DUPLICATED_LIBRARY: {
2526
+ number: 80014,
2527
+ messageTemplate: `The library name "{library}" and its fully qualified name "{libraryFqn}" refer to the same library.
2528
+
2529
+ To fix this, remove one of them and try again.`,
2530
+ websiteTitle: "Duplicated library entry",
2531
+ websiteDescription: `The same library was specified more than once using both its short name and fully qualified name (FQN) in the \`--libraries\` option.
2532
+
2533
+ Only one form should be used for each library. Remove one of the entries and try again.`,
2534
+ },
2535
+ LIBRARY_ADDRESSES_MISMATCH: {
2536
+ number: 80015,
2537
+ messageTemplate: `The following detected library addresses differ from those you provided:
2538
+ {conflictList}
2539
+
2540
+ You can either fix these addresses in your libraries, or remove them to let the plugin autodetect them.`,
2541
+ websiteTitle: "Library address mismatch",
2542
+ websiteDescription: `Some libraries have conflicting addresses between what you provided and what was detected in the deployed bytecode.
2543
+
2544
+ Please ensure each library address is correct. You can remove entries from your input to use autodetection instead.`,
2545
+ },
2546
+ MISSING_LIBRARY_ADDRESSES: {
2547
+ number: 80016,
2548
+ messageTemplate: `The contract "{contract}" has one or more library addresses that cannot be detected from the deployed bytecode.
2549
+ This can occur if a library is only used in the contract's constructor. The missing libraries are:
2550
+ {missingList}`,
2551
+ websiteTitle: "Missing library addresses",
2552
+ websiteDescription: `One or more libraries required by the contract could not be detected from the deployed bytecode.
2553
+
2554
+ This usually happens when a library is only referenced in the contract's constructor. To resolve this, provide the missing library addresses using the "--libraries" option.`,
2555
+ },
2556
+ INVALID_CONSTRUCTOR_ARGUMENT_TYPE: {
2557
+ number: 80017,
2558
+ messageTemplate: `The value "{value}" for a constructor parameter cannot be encoded.
2559
+ Reason: {reason}.`,
2560
+ websiteTitle: "Invalid constructor argument type",
2561
+ websiteDescription: `One of the arguments passed to the contract's constructor has an invalid JavaScript type.
2562
+
2563
+ This error occurs when you supply a value whose runtime type doesn't match the expected Solidity type. For example, you must pass a JS string for a Solidity string parameter.
2564
+
2565
+ Please verify that each constructor argument is the correct JS type.`,
2566
+ },
2567
+ INVALID_CONSTRUCTOR_ARGUMENTS_LENGTH: {
2568
+ number: 80018,
2569
+ messageTemplate: `The constructor for "{contract}" has {requiredArgs} parameters but {providedArgs} arguments were provided instead.`,
2570
+ websiteTitle: "Invalid constructor argument count",
2571
+ websiteDescription: `The number of arguments provided to the contract's constructor doesn't match the number of parameters defined in its ABI.
2572
+
2573
+ This error occurs when you supply a different number of arguments than the constructor expects. For example, if the constructor expects two parameters but you provided three.
2574
+
2575
+ Please verify that you pass the exact number of arguments required by the constructor.`,
2576
+ },
2577
+ CONSTRUCTOR_ARGUMENT_OVERFLOW: {
2578
+ number: 80019,
2579
+ messageTemplate: `The value "{value}" is out of bounds for its Solidity type and cannot be encoded.`,
2580
+ websiteTitle: "Constructor argument value out of bounds",
2581
+ websiteDescription: `One of the arguments passed to the contract's constructor is outside the allowed range for its Solidity type (for example, passing 256 to a uint8 parameter).
2582
+
2583
+ This error occurs when a value exceeds the maximum or minimum allowed for the specified Solidity type.
2584
+
2585
+ Please ensure all argument values fit within the valid range for their respective Solidity types.`,
2586
+ },
2587
+ CONSTRUCTOR_ARGUMENTS_ENCODING_FAILED: {
2588
+ number: 80020,
2589
+ messageTemplate: `The constructor arguments for "{contract}" could not be encoded. Reason: {reason}.`,
2590
+ websiteTitle: "Constructor arguments encoding failed",
2591
+ websiteDescription: `The constructor arguments provided for the contract could not be encoded correctly.
2592
+ Please review the provided arguments and ensure they match the expected arguments defined in the contract's ABI.`,
2593
+ },
2594
+ CONTRACT_VERIFICATION_MISSING_BYTECODE: {
2595
+ number: 80021,
2596
+ messageTemplate: `The request to {url} failed because the address "{address}" does not have bytecode.`,
2597
+ websiteTitle: "Missing bytecode at address",
2598
+ websiteDescription: `The explorer responded that the specified address does not contain bytecode. This usually means the contract was deployed recently and the explorer's backend has not yet indexed it.
2599
+
2600
+ Please wait a short time (e.g., 30-60 seconds) and try again. If you're running this from a script, wait for at least five confirmations before verifying.`,
2601
+ },
2602
+ CONTRACT_ALREADY_VERIFIED: {
2603
+ number: 80022,
2604
+ messageTemplate: `The contract "{contract}" at address "{address}" is already verified.`,
2605
+ websiteTitle: "Contract already verified",
2606
+ websiteDescription: `The block explorer responded that the contract is already verified.
2607
+
2608
+ This typically occurs if you used the "--force" flag and the explorer does not support re-verification, or if the contract was previously verified with a full match.`,
2609
+ },
2610
+ CONTRACT_VERIFICATION_REQUEST_FAILED: {
2611
+ number: 80023,
2612
+ messageTemplate: `The contract verification request failed: "{message}".`,
2613
+ websiteTitle: "Contract verification request failed",
2614
+ websiteDescription: `The block explorer returned an error when attempting to verify the contract's source code.
2615
+
2616
+ Please check the returned message for details.`,
2617
+ },
2618
+ CONTRACT_VERIFICATION_STATUS_POLLING_FAILED: {
2619
+ number: 80024,
2620
+ messageTemplate: `The contract verification status polling encountered an error: "{message}". Verification may still succeed.`,
2621
+ websiteTitle: "Contract verification status polling failed",
2622
+ websiteDescription:
2623
+ "The block explorer returned a failure status when checking the verification status. Verification may still succeed; please check manually.",
2624
+ },
2625
+ CONTRACT_VERIFICATION_UNEXPECTED_RESPONSE: {
2626
+ number: 80025,
2627
+ messageTemplate: `The block explorer API returned an unexpected message: "{message}". Please report this issue to the Hardhat team.`,
2628
+ shouldBeReported: true,
2629
+ websiteTitle: "Unexpected API response during contract verification",
2630
+ websiteDescription: `The block explorer API returned a message that doesn't match the expected format. This may indicate a change in the API or an issue with the request.
2631
+
2632
+ Please report this issue to the Hardhat team.`,
2633
+ },
2634
+ CONTRACT_VERIFICATION_FAILED: {
2635
+ number: 80026,
2636
+ messageTemplate: `The contract verification failed.
2637
+ Reason: "{reason}".
2638
+ {librariesWarning}`,
2639
+ websiteTitle: "Contract verification failed",
2640
+ websiteDescription: `Unable to verify the contract on the block explorer.
2641
+
2642
+ If your contract uses libraries whose addresses cannot be detected automatically, make sure you are providing the correct address for each undetectable library.`,
2643
+ },
2644
+ BLOCK_EXPLORER_NOT_CONFIGURED: {
2645
+ number: 80027,
2646
+ messageTemplate:
2647
+ "No {verificationProvider} block explorer is configured for the {chainId} chain in the chain descriptors.",
2648
+ websiteTitle: "Block explorer not configured",
2649
+ websiteDescription: `
2650
+ Block explorer information is missing in your chain descriptor configuration.
2651
+
2652
+ To enable contract verification, add an entry for the verification provider in the blockExplorers field of the relevant chain descriptor.
2653
+ You can override the default chain descriptor by providing your own chainDescriptors object in the Hardhat config, with the following structure:
2654
+
2655
+ \`\`\`
2656
+ chainDescriptors: {
2657
+ <chainId>: {
2658
+ name: <name>,
2659
+ blockExplorers: {
2660
+ blockscout: { name: "Blockscout", url: <blockscout-url> apiUrl: <blockscout-api-url> };
2661
+ etherscan: { name: "Etherscan", url: <etherscan-url> apiUrl: <etherscan-api-url> };
2662
+ }
2663
+ }
2664
+ }
2665
+ \`\`\`
2666
+ `,
2667
+ },
2668
+ ADDRESS_NOT_A_CONTRACT: {
2669
+ number: 80028,
2670
+ messageTemplate: `{verificationProvider} responded that the address "{address}" does not contain a contract. This usually means the address is incorrect, the contract was not deployed on the selected network, or there is a temporary issue with the block explorer not updating its index.`,
2671
+ websiteTitle: "Address is not a contract",
2672
+ websiteDescription: `The block explorer responded that the address does not contain a contract. This usually means the address is incorrect, the contract was not deployed on the selected network, or there is a temporary issue with the block explorer not updating its index.
2673
+ Please verify the address and network, and try again later if necessary.`,
2674
+ },
2675
+ EXPLORER_API_KEY_EMPTY: {
2676
+ number: 80029,
2677
+ messageTemplate: `The {verificationProvider} API key is empty.`,
2678
+ websiteTitle: "Block explorer API key is empty",
2679
+ websiteDescription: `The provided API key for the block explorer is empty. This can happen in the following cases:
2680
+
2681
+ - No "apiKey" field is configured in the hardhat config.
2682
+ - The "apiKey" is explicitly set to an empty string in the Hardhat config.
2683
+ - The "apiKey" is assigned to a config variable that resolves to an empty string at runtime.
2684
+
2685
+ To resolve this, set a valid non-empty API key in your Hardhat config, then try again.`,
2686
+ },
2687
+ },
2688
+ VALIDATION: {
2689
+ INVALID_ADDRESS: {
2690
+ number: 80100,
2691
+ messageTemplate: `"{value}" is not a valid address`,
2692
+ websiteTitle: "Invalid address",
2693
+ websiteDescription: "The value is not a valid address",
2694
+ },
2695
+ MUTUALLY_EXCLUSIVE_CONSTRUCTOR_ARGS: {
2696
+ number: 80101,
2697
+ messageTemplate:
2698
+ "The parameters constructorArgs and constructorArgsPath are mutually exclusive.",
2699
+ websiteTitle: "Mutually exclusive constructor arguments",
2700
+ websiteDescription:
2701
+ "The parameters constructorArgs and constructorArgsPath are mutually exclusive. Please provide only one of them.",
2702
+ },
2703
+ INVALID_CONSTRUCTOR_ARGS_MODULE_EXPORT: {
2704
+ number: 80102,
2705
+ messageTemplate: `The module specified by "{constructorArgsPath}" must default export an array of constructor arguments.`,
2706
+ websiteTitle: "Invalid constructor arguments module",
2707
+ websiteDescription: `The module specified by the constructorArgsPath parameter must default export an array of constructor arguments.
2708
+
2709
+ Example:
2710
+
2711
+ \`\`\`ts
2712
+ export default ["arg1", "arg2", ...];
2713
+ \`\`\`
2714
+ `,
2715
+ },
2716
+ MODULE_NOT_FOUND: {
2717
+ number: 80103,
2718
+ messageTemplate: `The module specified by "{modulePath}" could not be found.`,
2719
+ websiteTitle: "Module not found",
2720
+ websiteDescription:
2721
+ "The specified module could not be found. Please check the path and try again.",
2722
+ },
2723
+ MODULE_SYNTAX_ERROR: {
2724
+ number: 80104,
2725
+ messageTemplate: `The module specified by "{modulePath}" has a syntax error: {errorMessage}`,
2726
+ websiteTitle: "Module syntax error",
2727
+ websiteDescription:
2728
+ "The specified module has a syntax error. Please fix the error and try again.",
2729
+ },
2730
+ IMPORT_MODULE_FAILED: {
2731
+ number: 80105,
2732
+ messageTemplate: `The module specified by "{modulePath}" could not be imported: {errorMessage}`,
2733
+ websiteTitle: "Import module failed",
2734
+ websiteDescription: "The specified module could not be imported.",
2735
+ },
2736
+ INVALID_LIBRARIES_MODULE_EXPORT: {
2737
+ number: 80106,
2738
+ messageTemplate: `The module specified by "{librariesPath}" must default export a record of libraries.`,
2739
+ websiteTitle: "Invalid libraries module",
2740
+ websiteDescription: `The module specified by the librariesPath parameter must default export a record of libraries.
2741
+
2742
+ Example:
2743
+
2744
+ \`\`\`ts
2745
+ export default { lib1: "0x...", lib2: "0x...", ... };
2746
+ \`\`\``,
2747
+ },
2748
+ INVALID_VERIFICATION_PROVIDER: {
2749
+ number: 80107,
2750
+ messageTemplate: `The verification provider "{verificationProvider}" is not supported. Supported providers are: {supportedVerificationProviders}.`,
2751
+ websiteTitle: "Invalid verification provider",
2752
+ websiteDescription:
2753
+ "The specified verification provider is not supported. Please use one of the supported providers.",
2754
+ },
2343
2755
  },
2344
2756
  },
2345
2757
  } as const;