README
Hardhat ABI Exporter
Export Ethereum smart contract ABIs on compilation via Hardhat.
Versions of this plugin prior to
2.0.0
were released asbuidler-abi-exporter
.
Installation
yarn add --dev hardhat-abi-exporter
Usage
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 | 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
|
| filter
| Function
with signature (abiElement: any, index: number, abi: any, fullyQualifiedName: string) => boolean
used to filter elements from each exported ABI | () => true
|
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