Socket
Socket
Sign inDemoInstall

ethereum-waffle

Package Overview
Dependencies
Maintainers
1
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethereum-waffle

Sweeter and simpler than truffle.


Version published
Weekly downloads
39K
decreased by-29.11%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Ethereum Waffle

Sweeter and simpler than truffle. Works with ethers-js. Taste best with chai and ES6.

Philosophy

  • Simpler: Set of helpers rather than framework
  • Sweeter: Easy to customize and extend

Features:

  • Build, deploy link and test solidity based smart contracts
  • No need to run mock rpc server
  • Easily import contracts from other npms
  • Coming soon: Parallel testing

Install:

To start using with npm, type:

npm i ethereum-waffle

or with Yarn:

yarn add ethereum-waffle

Step by step guide

Compiling contracts

To compile you contracts simply type:

npx waffle

Waffle expects your contracts are in contracts directory. The output will be saved in the build directory.

Adding a task

For convince, you can add a task to your package.json. In the sections scripts, add following line:

  "build": "waffle"        

Now you can build you contracts with:

yarn build

Example test

Waffle is test suite agnostic. Here is example test written using mocha:

import chai from 'chai';
import {createMockProvider, deployContract, getWallets} from 'ethereum-waffle';
import ethers from 'ethers';
import BasicToken from './contracts/BasicToken';

const {expect} = chai;

describe('Example', () => {
  let provider;
  let token;
  let wallet;

  beforeEach(async () => {
    provider = createMockProvider();
    [wallet] = await getWallets(provider);
    token = await deployContract(wallet, BasicToken);  
  });
  
  it('Should be able to test', async () => {
    const actualBalance = await token.balanceOf(wallet.address);
    expect(actualBalance.eq(0)).to.be.true;
  });  
});

To run test type in the console:

mocha

FAQs

Package last updated on 04 Aug 2018

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