Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hardhat-interact

Package Overview
Dependencies
Maintainers
10
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardhat-interact

Execute commands on deployed contracts using a helpful TUI. Inspired by `hardhat interact` command on https://github.com/Synthetixio/synthetix

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-17.65%
Maintainers
10
Weekly downloads
 
Created
Source

hardhat-interact

Run queries and transactions against contracts using a handy CLI which integrates with your deployments.

A Hardhat plugin.

What

This plugin implements a CLI to allow you to run read or write queries against your deployed contracts on any network! It uses deployment manifests exported in either hardhat or truffle format. This plugin also includes a command to import arbitrary contracts from etherscan as needed.

Installation

npm install --save-dev hardhat-interact @nomiclabs/hardhat-ethers

Import the plugin in your hardhat.config.js:

require("hardhat-interact");

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

import "hardhat-interact";

Required plugins

Tasks

This plugin adds the interact task to Hardhat:

$ npx hardhat --network mainnet interact

Interact CLI
Please review this information:
================================================================================
> Network: mainnet
> Gas price: provider default
> Block tag: latest
> Read Only: 0x0000000000000000000000000000000000000000
================================================================================


? Pick a CONTRACT: (Press <enter> to submit)
❯ AddressResolver
  CollateralManager
  CollateralManagerState
  CollateralShort
  CollateralUtil
  DappMaintenance
  DebtCache
(Move up and down to reveal more choices)

Note that the network specified by --network above must exist in hardhat configuration, and the network should have a preexisting deployment of your contracts.

Follow the on-screen instructions to select a contract, then a function, and finally the arguments. If its read-only, you can choose to view the return value of the function. If it is a writable, state-changing function, you will be prompted to sign the transaction and submit it to the network.

The interact command supports a few command line arguments. To see an updated list, use npx hardhat interact --help.

Configuration

This plugin extends the ProjectPathsUserConfig object with an optional deployments field. This field specifies the location of the deployment artifacts (either hardhat-deploy or truffle compatible) within your repository. By default, this value is ./deployments/.

This is an example of how to set it:

module.exports = {
  paths: {
    deployments: "publish/deployed"
  }
};

Keywords

FAQs

Package last updated on 02 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc