4.0.5 • Published 7 months ago

@ethereum-waffle/provider v4.0.5

Weekly downloads
15,648
License
MIT
Repository
github
Last release
7 months ago

CircleCI npm.io

Ethereum Waffle

@ethereum-waffle/provider

A mock provider for your blockchain testing needs.

Installation

In the current version of waffle (v2.x.x) you will install this package as a dependency of the main waffle package - ethereum-waffle.

yarn add --dev ethereum-waffle
npm install --save-dev ethereum-waffle

If you want to use this package directly please install it via:

yarn add --dev @ethereum-waffle/provider
npm install --save-dev @ethereum-waffle/provider

Feature overview

NOTE: You do not need to use this package directly. You can install it through the main package (ethereum-waffle) and use it instead.

MockProvider

The MockProvider class is the main way of interacting with the blockchain in your waffle tests.

It wraps ganache-core in an ethers provider and extends it with useful functionality.

You can learn more about it in the documentation.

Examples:

const {MockProvider} = require('@ethereum-waffle/provider');
const {expect} = require('chai');

describe('waffle tests', () => {
  it('wallets have non-zero balance', () => {
    const provider = new MockProvider();
    const wallets = provider.getWallets();
    const balance = await wallets[0].getBalance();
    expect(balance.gt(0)).to.equal(true)
  })
})

Fixtures

Fixtures are an advanced concept that you can use to make your tests run faster. They take advantage of the snapshot mechanism in Ganache.

You can learn more about it in the documentation.

Legacy API

  • createMockProvider - this was the old way to construct a MockProvider instance
  • getGanacheOptions - previously it was possible to load the options from the waffle config file
  • getWallets - this was the old way to get wallets from a provider
4.0.5-dev.238c11c

7 months ago

4.0.5-dev.efd5f2a

7 months ago

4.0.5

1 year ago

4.0.4

2 years ago

4.0.1

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

4.0.0-alpha.25

2 years ago

4.0.0-alpha.24

2 years ago

4.0.0-alpha.23

2 years ago

4.0.0-alpha.22

2 years ago

4.0.0-alpha.21

2 years ago

4.0.0-alpha.9

2 years ago

4.0.0-alpha.17

2 years ago

4.0.0-alpha.16

2 years ago

4.0.0-alpha.15

2 years ago

4.0.0-alpha.14

2 years ago

4.0.0-alpha.19

2 years ago

4.0.0-alpha.18

2 years ago

4.0.0-alpha.13

2 years ago

4.0.0-alpha.12

2 years ago

4.0.0-alpha.11

2 years ago

4.0.0-alpha.10

2 years ago

4.0.0-alpha.17.4

2 years ago

4.0.0-alpha.20

2 years ago

4.0.0-alpha.7

2 years ago

4.0.0-alpha.8

2 years ago

4.0.0-alpha.5

2 years ago

4.0.0-alpha.6

2 years ago

4.0.0-alpha.3

2 years ago

4.0.0-alpha.4

2 years ago

4.0.0-alpha.1

2 years ago

4.0.0-alpha.2

2 years ago

3.4.4

2 years ago

4.0.0

2 years ago

4.0.0-alpha.0

2 years ago

3.4.1

2 years ago

3.4.0

3 years ago

3.3.2

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

3.0.0-beta.3

4 years ago

3.0.0-beta.2

4 years ago

2.5.1

4 years ago

2.5.0

4 years ago

3.0.0-beta.1

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago