hardhat-simulate-tx
v0.0.0-alpha
Published
Programatically simulate network activity between accounts and contracts.
Maintainers
Readme
hardhat-simulate-tx
Work In Progress
A Hardhat plugin to programmatically send transactions on your local development network. The plugin can simulate the following:
- ETH transactions between random signers
- ETH transactions between a
targetaddress and randoms signers.
Future types of transactions
- Transactions with ERC20 tokens
- Programitic calls to contracts methods
Installation
Run the following command to install hardhat-simulate-tx in your hardhat project. The pluging requires the @nomiclabs/hardhat-ethers plugin and the Ethereum library ethers.js.
npm install hardhat-simulate-tx @nomiclabs/hardhat-ethers ethers@^5.0.0Import the plugin in your hardhat.config.js:
require("hardhat-simulate-tx");Or if you are using TypeScript, in your hardhat.config.ts:
import "hardhat-simulate-tx";Required plugins
Configuration
The plugin adds the simulateTx property to hardhat.config.js. Use this property to configure the transactions.
By default, the task will send 5 random ETH transactions between random signers.
Assigning a target will direct all of the transactions to the target address.
This is an example:
module.exports = {
simulateTx: {
target: <ethereum-address>,
delay: 5000
}
};Tasks
The plugin adds the simulate task to Hardhat.
npx hardhat simulate