2.0.6 • Published 2 years ago

@nomiclabs/hardhat-waffle v2.0.6

Weekly downloads
8,622
License
MIT
Repository
github
Last release
2 years ago

npm hardhat

hardhat-waffle

Hardhat plugin for integration with Waffle.

What

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.

Installation

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";

Tasks

This plugin creates no additional tasks.

Environment extensions

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.

Usage

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.

distributed-town-smart-contracts@jbox/contracts@unioncredit/union-v1-sdk@meetusvr/smart-contracts@infinitebrahmanuniverse/nolb-_nom@everything-registry/sub-chunk-663packed-solidity-arrayswepublic-contractsx-domain-messenger-plusx1-sfcsafient-claimssafient-claims-testreiciendisaccusamustea-osstestpackage-praveen5-ovoluptasomnisillumquoico-crowdsale12growpayinfinitymint-btharbor-hardhat-anvilgluwa-token-testtoolsname-wrappermarket143411marketplace-nftnewdex-peripherynum_complex_soliditynemosapientenetrefvotesoulswap-hardhat-configsurviving-the-bearrward-backendskill-walletsolidity-trading-journalsolidity_tutorialstornadio-sdk@asheliahut/hardhat-demo@blockswaplab/rpbs-sol@bobanetwork/contracts@carlos0202/local-testnet-deployer@cardinal-protocol/v1-sdk@chainscore/contracts@chainscore/client@abacus-network/hardhat@dcspark/milkomeda-liquid-staking@consensolabs/claims-test@foundry-rs/hardhat-anvil@foundry-rs/hardhat-forge@idecentralize/pulsar@ikalasdev/erc20generator@elasticswap/elasticswap@elasticswap/token@elasticswap/token-bridged@eth-optimism/chugsplash@eth-optimism/contracts-governance@gluwa/token-testtools@gluwa/evm-network-test@lightdotso/hardhat-config@luckyfinance/hardhat-framework@lhrc/core@insuredao/pool-contracts@m.arefev/nft@mstable/protocol@ngmpool/sdk@nifty-badges/contracts@ensdomains/name-wrapper@equilibrelabs/swap-router-contracts@exodiafi/exodia-sdk@elastic-dao/elasticswap@matthewyun/v2-periphery@mimic-fi/v3-helpers@mimic-fi/helpers@mimic-fi/v1-contracts@mimic-fi/v2-helpers@klaytn/kds-oracles@klaytn/kss-oracles@ikalasdev/erc721generator@ikalasdev/timelock@holyswap/hardhat-framework@infini3/hardhat-ts@kaiachain/kss-oracles@kangafinance/hardhat-framework@moraswap/permit2@quant-finance/testnet-faucet@safient/claims@safient/contracts@protocol-octopus/smart-contracts@saxle/daemons@sc1/contracts@recruiter.party/contracts@richeroneren/fast-presale@ponyswapdex/pony-swap-core@polycity/hardhat-framework@picoswap/pico-test-tokens@picoswap/pico-v2-core@overnight-contracts/blp-rebalancer@ourz/our-contracts@panukresko/hardhat-anvil@panukresko/hardhat-forge@partylikeits1983/complex_sol
2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

4 years ago

1.0.0

4 years ago

2.0.0-rc.1

4 years ago

2.0.0

4 years ago

2.0.0-rc.0

4 years ago