
Product
Introducing Module Reachability: Focus on the Vulnerabilities That Matter
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
hardhat-abi-exporter
Advanced tools
Export Ethereum smart contract ABIs on compilation via Hardhat.
Versions of this plugin prior to
2.0.0
were released asbuidler-abi-exporter
.
npm install --save-dev hardhat-abi-exporter
# or
yarn add --dev hardhat-abi-exporter
Load plugin in Hardhat config:
require('hardhat-abi-exporter');
Add configuration under the abiExporter
key:
option | description | default |
---|---|---|
path | path to ABI export directory (relative to Hardhat root) | './abi' |
runOnCompile | whether to automatically export ABIs during compilation | false |
clear | whether to delete old ABI files in path on compilation and on clean | false |
flat | whether to flatten output directory (may cause name collisions) | false |
only | Array of String matchers used to select included contracts, defaults to all contracts if length is 0 | [] |
except | Array of String matchers used to exclude contracts | [] |
spacing | number of spaces per indentation level of formatted output | 2 |
pretty | whether to use interface-style formatting of output for better readability | false |
format | format type ("json", "minimal", "fullName"). Alternative to pretty | json |
filter | Function with signature (abiElement: any, index: number, abi: any, fullyQualifiedName: string) => boolean used to filter elements from each exported ABI | () => true |
rename | Function with signature (sourceName: string, contractName: string) => string used to rename an exported ABI (incompatible with flat option) | undefined |
Note that the configuration formatted as either a single Object
, or an Array
of objects. An Array
may be used to specify multiple outputs.
abiExporter: {
path: './data/abi',
runOnCompile: true,
clear: true,
flat: true,
only: [':ERC20$'],
spacing: 2,
pretty: true,
format: "minimal",
}
// or
abiExporter: [
{
path: './abi/pretty',
pretty: true,
},
{
path: './abi/ugly',
pretty: false,
},
]
// or
abiExporter: [
{
path: './abi/json',
format: "json",
},
{
path: './abi/minimal',
format: "minimal",
},
{
path: './abi/fullName',
format: "fullName",
},
]
The included Hardhat tasks may be run manually:
npx hardhat export-abi
npx hardhat clear-abi
# or
yarn run hardhat export-abi
yarn run hardhat clear-abi
By default, the hardhat compile
task is run before exporting ABIs. This behavior can be disabled with the --no-compile
flag:
npx hardhat export-abi --no-compile
# or
yarn run hardhat export-abi --no-compile
The path
directory will be created if it does not exist.
The clear
option is set to false
by default because it represents a destructive action, but should be set to true
in most cases.
ABIs files are saved in the format [CONTRACT_NAME].json
.
Install dependencies via Yarn:
yarn install
Setup Husky to format code on commit:
yarn prepare
FAQs
Export Ethereum smart contract ABIs on compilation
The npm package hardhat-abi-exporter receives a total of 6,657 weekly downloads. As such, hardhat-abi-exporter popularity was classified as popular.
We found that hardhat-abi-exporter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
Research
Security News
Socket researchers uncovered malicious npm and PyPI packages that steal crypto wallet credentials using Google Analytics and Telegram for exfiltration.