This script is used to convert the metadata generated by Hardhat (build-info.json
) to the standard JSON input format required for contract verification on Etherscan.
The script reads the build-info.json
file generated by Hardhat during the compile process and extracts the relevant information to create a formatted JSON file suitable for contract verification using solc
standard input.
- Extracts and formats the necessary fields from all source files.
- Removes unnecessary metadata fields to match the standard JSON input format.
- Node.js installed on your system.
- Hardhat project with compiled contracts (i.e.,
build-info.json
available in theartifacts/build-info.json
path).
-
Clone the repository or download the script:
git clone <repository-url>
-
Navigate to the directory:
cd <directory>
-
Ensure you have a
build-info.json
file generated by Hardhat compile proces in the directory:./build-info.json
-
Run the script using Node.js:
node convertToStandardInput.js
โข Formatted JSON File: build-info-formatted.json
Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.