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

First test

import createWeb3 from 'ethereum-waffle';
import StandardToken from '../build/StandardToken.json';

describe('StandardToken', () => {
  const amount = 100;
  let web3;
  let accounts;
  let token;
  let to;
  let from;

  beforeEach(async () => {
    {web3, [from]} = createWeb3();
    token = await deployContract(StandardTokenMock.new(account[0], amount));
  });
  
  it("Should transfer", async () => {
    const [from] = accounts;
    await token.methods.transfer(to, amount).send({from});

    expect(await token.balanceOf(from)).to.eq('0');
    expect(await token.balanceOf(to)).to.eq('0');
     const recipientBalance = await this.token.balanceOf(to);
     assert.equal(recipientBalance, amount);

    expect(await aContract.methods.transfer().send({from})).to.emitEvent('Transfered').withParams(...);
  });
  
  it("Transfer should emit event", async () => {
    expect(token.methods.transfer(to, amount).send({from})).to
      .to.emitEvent('Transfered')
      .withParams(from, to, amount);
  });
}

Run tests:

yarn waffle:test

FAQs

Package last updated on 03 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