/hardhat-flat-exporter

Export flat contract on compilation via Hardhat.

Primary LanguageTypeScriptMIT LicenseMIT

npm version Build Status buidler

hardhat-flat-exporter

Export flat contract on compilation via Hardhat.

👾 Additional supplement to the official flatten command

Installation

npm install --save-dev hardhat-flat-exporter
# or
yarn add --dev hardhat-flat-exporter

And add the following to your hardhat.config.js:

require("hardhat-flat-exporter");

Or, if you are using TypeScript, add this to your hardhat.config.ts:

import "hardhat-flat-exporter";

Configuration

Configuration is optional.

module.exports = {
  flattenExporter: {
    src: "./contracts",
    path: "./flat",
    clear: true,
  },
};

Options

option description default
src folder path of the target contracts (relative to Hardhat root) './contracts'
path path to flat sol export directory (relative to Hardhat root) './flat'
clear whether to delete old flat sol files in path on compilation true

Usage

The included Hardhat tasks may be run manually:

npx hardhat export-flat
# or
yarn run hardhat export-flat