0.2.0 • Published 1 year ago

@ddzero2c/hardhat-abi-gen v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Hardhat ABI Generator

Export Solidity smart contract ABIs and generate javascript objects on compilation via Hardhat.

Installation

yarn add --dev @symblox/hardhat-abi-gen

Usage

Load plugin in Hardhat config:

require('@symblox/hardhat-abi-gen');

Add configuration under the abiExporter key:

optiondescriptiondefault
pathpath to ABI export directory (relative to Hardhat root)'./abi'
clearwhether to delete old files in path on compilationfalse
flatwhether to flatten output directory (may cause name collisions)false
onlyArray of String matchers used to select included contracts, defaults to all contracts if length is 0[]
exceptArray of String matchers used to exclude contracts[]
spacingnumber of spaces per indentation level of formatted output2
abiExporter: {
  path: './data/abi',
  clear: true,
  flat: true,
  only: [':ERC20$'],
  spacing: 2
}

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.