Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@nomiclabs/hardhat-waffle
Advanced tools
Hardhat plugin for integration with Waffle.
You can use this plugin to build smart contract tests using Waffle in Hardhat, taking advantage of both.
This plugin adds a Hardhat-ready version of Waffle to the Hardhat Runtime Environment, and automatically initializes the Waffle Chai matchers.
npm install --save-dev @nomiclabs/hardhat-waffle 'ethereum-waffle@^3.0.0' @nomiclabs/hardhat-ethers 'ethers@^5.0.0' @types/sinon-chai@^3.2.3
And add the following statement to your hardhat.config.js
:
require("@nomiclabs/hardhat-waffle");
Or, if you are using TypeScript, add this to your hardhat.config.ts
:
import "@nomiclabs/hardhat-waffle";
This plugin creates no additional tasks.
This plugin adds a waffle
object to the Hardhat Runtime Environment. This object has all the Waffle functionality, already adapted to work with Hardhat.
The waffle
object has these properties:
provider
deployContract
solidity
link
deployMockContract
createFixtureLoader
loadFixture
This plugin depends on @nomiclabs/hardhat-ethers
, so it also injects an ethers
object into the HRE, which is documented here.
Once installed, you can build your tests almost like in Waffle.
Instead of importing things from ethereum-waffle
, you access them from the waffle
property of the Hardhat Runtime Environment.
For example, instead of doing
const { deployContract } = require("ethereum-waffle");
you should do
const { waffle } = require("hardhat");
const { deployContract } = waffle;
Also, you don't need to call chai.use
in order to use Waffle's Chai matchers.
Note that by default, Hardhat saves its compilation output into artifacts/
instead of build/
. You can either use that directory in your tests, or customize your Hardhat config.
2.0.6
FAQs
Hardhat plugin to test smart contracts with Waffle
The npm package @nomiclabs/hardhat-waffle receives a total of 54,893 weekly downloads. As such, @nomiclabs/hardhat-waffle popularity was classified as popular.
We found that @nomiclabs/hardhat-waffle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.