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

@nomiclabs/buidler-waffle

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nomiclabs/buidler-waffle

Buidler plugin to test smart contracts with Waffle

  • 1.3.3-rc.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
148
decreased by-40.56%
Maintainers
2
Weekly downloads
 
Created
Source

npm buidler

buidler-waffle

Buidler plugin for integration with Waffle.

What

You can use this plugin to build smart contract tests using Waffle in Buidler, taking advantage of both.

This plugin adds a Waffle-compatible provider to the Buidler Runtime Environment, and automatically initializes the Waffle Chai matchers.

Installation

npm install --save-dev @nomiclabs/buidler-waffle ethereum-waffle @nomiclabs/buidler-ethers ethers@^4.0.23

And add the following statement to your buidler.config.js:

usePlugin("@nomiclabs/buidler-waffle");

Tasks

This plugin creates no additional tasks.

Environment extensions

This plugin adds a waffle object to the Buidler Runtime Environment. This object has a single property, the Waffle mock provider.

waffle: {
  provider: JsonRpcProvider;
}

This plugin depends on @nomiclabs/buidler-ethers, so it also injects an ethers object into the BRE, which is documented here.

Usage

Once installed, you can build your tests just like in Waffle. The only difference is that you must use waffle.provider instead of createMockProvider().

Note that by default, Buidler save its compilation output into artifacts/ instead of build/. You can either use that directory in your tests, or customize your Buidler config.

TypeScript support

This plugin supports TypeScript by following these steps:

  1. Add these to your tsconfig.json's files array: 1.1. "node_modules/@nomiclabs/buidler-ethers/src/type-extensions.d.ts" 1.2. "node_modules/@nomiclabs/buidler-waffle/src/type-extensions.d.ts"

  2. Install this packages: npm install --save-dev @types/mocha @types/chai

We also recommend enabling resolveJsonModule in your tsconfig.json, as it's common to import JSON files directly when using Waffle.

There's no need to import the Waffle's solidity Chai matchers. They are automatically imported and initialized by this plugin, including its types.

Keywords

FAQs

Package last updated on 05 May 2020

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