1.18.2 • Published 9 months ago

hardhat-generate-function-selectors v1.18.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

generate-function-selectors plugin

Hardhat TS plugin to generate function selectors from each of the ABI/.json files found in the artifacts/contracts. (Depth/organization doesn't matter)

Outputs 'selectors.json' to project's root directory, which looks like the below for the hardhat example project:

{
  "Lock.sol": {
    "0x251c1aa3": "unlockTime",
    "0x3ccfd60b": "withdraw",
    "0x8da5cb5b": "owner"
  }
}

Quick Start

  1. Install the Hardhat plug-in
npm install hardhat-generate-function-selectors
yarn add hardhat-generate-function-selectors
  1. Add this to your hardhat.config.js
require("hardhat-generate-function-selectors");
import "hardhat-generate-function-selectors";
  1. Add this to your hardhat.config.js as well:
optiondescriptiondefault
separateContractSelectorsseparate by contracttrue
orderedByValueorder function selectors by hex value, least to greatestfalse
outputPathdirectory including filename where output file should be written./selectors.json
prettypretty print the output JSON(s)true
runOnCompilerun the selectors task on compiletrue
includeParamsinclude the parameters in the selector title (outputs only)true
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[]
skipSelectorsArray of selectors to be excluded from generated output[]
<your hardhat config> = {
  functionSelectors: {
    separateContractSelectors: true, 
    orderedByValue: true,
    <other optional params>
  },
};

Now you're able to to generate the function selectors with:

npx hardhat selectors
yarn hardhat selectors
1.18.2

9 months ago

1.19.1

9 months ago

1.17.1

2 years ago

1.17.0

2 years ago

1.16.0

2 years ago

1.15.0

2 years ago

1.13.0

2 years ago

1.11.0

2 years ago

1.10.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago