diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5319a23..3a69c1a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,10 +2,10 @@ name: tests on: push: branches: - - main + - master pull_request: branches: - - main + - master - dev jobs: diff --git a/README.md b/README.md index 0c46111..8ec9a77 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ [![npm](https://img.shields.io/npm/v/@solarity/hardhat-habits.svg)](https://www.npmjs.com/package/@solarity/hardhat-habits) [![hardhat](https://hardhat.org/buidler-plugin-badge.svg?1)](https://hardhat.org) -# Habits +# Hardhat Habits (hABIts) + +The hardhat plugin with common ABI utilities. ## What +This plugin simplifies interation with ABI and enables the following use cases: + - **Interface ID Calculation**: Calculates the Interface ID for a specified smart contract using `hardhat` environment and `solidity-ast` package. ## Installation @@ -13,21 +17,22 @@ npm install --save-dev @solarity/hardhat-habits ``` ## Usage + To use the module, follow these steps: 1. **Import the Module**: ```typescript -import { getInterfaceID } from '@solarity/hardhat-habits'; +import { getInterfaceID } from "@solarity/hardhat-habits"; ``` 2. **Call the Function**: ```typescript -const interfaceID = await getInterfaceID('YourContractName'); +const interfaceID = await getInterfaceID("YourContractName"); ``` -Replace `'YourContractName'` with the name of your contract. +Replace `"YourContractName"` with the name of your contract. > [!NOTE] > If the contract name is ambiguous, the fully qualified name of the contract will have to be specified. @@ -39,10 +44,3 @@ This plugin does not add tasks to the Hardhat Runtime Environment. ## Environment extensions This plugin does not extend the Hardhat Runtime Environment. - -## Dependencies - -- `solidity-ast`: For parsing Solidity AST. - -## License -This module is licensed under [MIT], see the LICENSE file for details. diff --git a/package-lock.json b/package-lock.json index 2efdad8..381dafa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "test/fixture-projects/*" ], "dependencies": { - "solidity-ast": "^0.4.55" + "solidity-ast": "0.4.55" }, "devDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.5", diff --git a/package.json b/package.json index c0616ed..fe5bf38 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@solarity/hardhat-habits", "version": "1.0.0", - "description": "The tool designed to simplify working with Ethereum ABI.", + "description": "The tool to work with Ethereum ABI", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", "scripts": { @@ -45,7 +45,7 @@ }, "homepage": "https://github.com/dl-solarity/hardhat-habits#readme", "dependencies": { - "solidity-ast": "^0.4.55" + "solidity-ast": "0.4.55" }, "peerDependencies": { "hardhat": "^2.0.0" diff --git a/src/index.ts b/src/index.ts index a26c6c1..bb334a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,6 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { ContractDefinition, FunctionDefinition, SourceUnit } from "solidity-ast"; - import { findAll, isNodeType } from "solidity-ast/utils"; export async function getInterfaceID(contractName: string) { diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/ERC165Contract.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/ERC165Contract.sol index 32e379d..d2e4d5e 100644 --- a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/ERC165Contract.sol +++ b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/ERC165Contract.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.20; import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; - import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol"; import {IERC1967} from "@openzeppelin/contracts/interfaces/IERC1967.sol"; diff --git a/test/index.test.ts b/test/index.test.ts index 6974276..2500fe9 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -4,7 +4,6 @@ import chaiAsPromised from "chai-as-promised"; chai.use(chaiAsPromised); import { useEnvironment } from "./helpers"; - import { getInterfaceID } from "../src"; import {