@i0san/hardhat-nextjs
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

hardhat-nextjs-plugin

Hardhat plugin that generates React hooks for all smart contract functions and events.

About

This plugin allows a smart contract developer to generate React implementations of all the smart contract functions and events.

React hooks or the whole NextJS project can then be shared with the dApp developer and jumpstart the development process.

The plugin also generates an optimized ABI files and copies then along with React Hooks.

To be able to use the hooks, the developer needs to enter the contract address into each abi file.

Installation

  1. Install the dependencies:
npm install @i0san/hardhat-nextjs
  1. Import the plugin in your hardhat.config.js:
import "@i0san/hardhat-nextjs";

Tasks

This plugin adds the "nextjs" task to Hardhat. To see the info about the task options run:

npx hardhat help nextjs

Usage

To use the task, run the task after the contracts have been compiled and artifacts generated.

npx hardhat nextjs

This will create a new folder "/nextjs-app" with the app and all the hooks and a usage page.

Configuration

Usage: hardhat [GLOBAL OPTIONS] nextjs [--hooks-only <BOOLEAN>] [--skip-contracts <STRING>]

OPTIONS:

  --hooks-only          Generate React Hooks only. (default: false)
  --skip-contracts      Array of contract names to skip. Format: "[\"Contract1", \"Contract2"]". Optional.

nextjs: Generate NextJS app with implemented contract functions and events.

License

MIT

Author

IoSan - iosan@protonmail.com

Package Sidebar

Install

npm i @i0san/hardhat-nextjs

Weekly Downloads

9

Version

1.0.0

License

MIT

Unpacked Size

174 kB

Total Files

41

Last publish

Collaborators

  • i0san