krisbitney / Web3Api-hardhat-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web3API Hardhat Plugin

A Hardhat plugin to manage and run your Web3API test environment

Summary

The Web3API Hardhat plugin facilitates simultaneous api and smart contract development using Hardhat (formerly Buidler, a popular smart contract development environment). The plugin automatically starts and stops the Web3API test environment in the background, and extends the Hardhat Runtime Environment to provide an instance of the Web3API client.

Description

I wrote the bare-bones implementation described in the summary. However, the plugin doesn't work yet. The test env currently hangs, suggesting it may running in the same thread as Mocha or I didn't correctly configure Hardhat. Need to debug!

We already have a web3api test environment and a CLI, so you might be wondering why we need it integrated with Hardhat. The Hardhat plugin is more than just another avenue for Web3API development tool distribution. The Hardhat community is a subset of our target market, so every developer who learns about Web3API through Hardhat is a developer who can benefit from our product. Because plugins are central to Hardhat and the list of plugins on hardhat.org is short enough to be browsed, many developers would see the plugin even if it were listed last. Getting our plugin listed on hardhat.org would itself be a valuable, long-term, free advertisement.

More importantly, Hardhat provides a suite of tools that make it easy for us to help developers streamline their API development process. Hardhat Tasks expose useful hooks to streamline development. The plugin could:

  • automatically start and stop the test environment
  • automatically build and publish API when smart contracts are compiled
  • integrate stack traces for debugging API alongside contracts
  • auto-generate a starter graphql schema and API interface based on contract abi and type artifacts produced by hardhat compiler
  • ???
  • profit

A simple Web3API Hardhat plugin can add value to the SDLC by facilitating simultaneous contract and API development, encouraging developers to think about their API early on. Developers who love Hardhat can write their API, configure the Web3API test environment and client, and access the Web3API client in a familiar environment without changing their workflow.

End of Readme

It's just placeholder text below this line!

Installation

<A step-by-step guide on how to install the plugin>

npm install <your npm package name> [list of peer dependencies]

Import the plugin in your hardhat.config.js:

require("<your plugin npm package name>");

Or if you are using TypeScript, in your hardhat.config.ts:

import "<your plugin npm package name>";

Required plugins

<The list of all the required Hardhat plugins if there are any>

Tasks

<A description of each task added by this plugin. If it just overrides internal tasks, this may not be needed>

This plugin creates no additional tasks.

<or>

This plugin adds the example task to Hardhat:

output of `npx hardhat help example`

Environment extensions

<A description of each extension to the Hardhat Runtime Environment>

This plugin extends the Hardhat Runtime Environment by adding an example field whose type is ExampleHardhatRuntimeEnvironmentField.

Configuration

<A description of each extension to the HardhatConfig or to its fields>

This plugin extends the HardhatUserConfig's ProjectPathsUserConfig object with an optional newPath field.

This is an example of how to set it:

module.exports = {
  paths: {
    newPath: "new-path"
  }
};

Usage

<A description of how to use this plugin. How to use the tasks if there are any, etc.>

There are no additional steps you need to take for this plugin to work.

Install it and access ethers through the Hardhat Runtime Environment anywhere you need it (tasks, scripts, tests, etc).

About


Languages

Language:TypeScript 96.7%Language:Solidity 3.3%