Code Monkey home page Code Monkey logo

hardhat-abigen's Introduction

Hardhat Abigen Plugin

This repository contains a plugin for Hardhat, a popular Ethereum development environment. The Hardhat Abigen Plugin generates ABI (Application Binary Interface) files from smart contracts, making it easier to interact with contracts on the Ethereum blockchain.

Installation

To use this plugin, follow these steps:

  1. Ensure you have Node.js installed on your machine.
  2. Install Hardhat by running npm install --save-dev hardhat.
  3. Install the Hardhat-Abigen plugin by running npm install --save-dev hardhat-abigen.

Usage

After installing the plugin, you can import it in your TypeScript or JavaScript files by adding the following line:

import "hardhat-abigen";

or

require("hardhat-abigen");

This will enable the necessary functionality provided by the plugin.

Configuration

The Hardhat-Abigen plugin supports a configuration file that allows you to customize its behavior. Create a file named hardhat.config.js or hardhat.config.ts in the root directory of your project and add the following configuration options:

JavaScript

module.exports = {
  // ...other configuration options...

  abigen: {
    outDir: "abi",            // The output directory for generated ABI files (default: "abi")
    inDir: "contracts",       // The input directory containing your contract files (default: "contracts")
    includeContracts: ["*"],  // An array of contract patterns to include in the generate ABIs (default: ["*"])
    excludeContracts: [],     // An array of contract patterns to exclude from the generate ABIs (default: [])
    space: 2,                 // The number of spaces to use for indentation in the generated ABIs (default: 2)
    autoCompile: true         // Whether to automatically compile contracts before generating ABIs (default: true)
  },
};

TypeScript

import { HardhatUserConfig } from "hardhat/config";

const config: HardhatUserConfig = {
  // ...other configuration options...

  abigen: {
    outDir: "abi",            // The output directory for generated ABI files (default: "abi")
    inDir: "contracts",       // The input directory containing your contract files (default: "contracts")
    includeContracts: ["*"],  // An array of contract patterns to include in the generate ABIs (default: ["*"])
    excludeContracts: [],     // An array of contract patterns to exclude from the generate ABIs (default: [])
    space: 2,                 // The number of spaces to use for indentation in the generated ABIs (default: 2)
    autoCompile: true         // Whether to automatically compile contracts before generating ABIs (default: true)
  },
};

export default config;

Make sure to replace the values with your desired configuration options.

Generating ABIs

To generate ABIs for your contracts, run the following command:

npx hardhat abigen

This will compile your contracts (if autoCompile is set to true) and generate the corresponding ABI files in the specified outDir directory.

License

This plugin is open-source and available under the MIT License. Feel free to use, modify, and distribute it as per the terms of the license.


I hope this plugin simplifies your development workflow by automatically generating ABIs from your contracts. If you encounter any issues or have suggestions for improvements, please open an issue. Contributions are also welcome!

hardhat-abigen's People

Contributors

nazarkhatsko avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.