Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@ethereum-waffle/provider
Advanced tools
A mock provider for your blockchain testing needs.
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
NOTE: You do not need to use this package directly. You can install it through the main package (ethereum-waffle
) and use it instead.
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 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.
createMockProvider
- this was the old way to construct a MockProvider instancegetGanacheOptions
- previously it was possible to load the options from the waffle config filegetWallets
- this was the old way to get wallets from a providerFAQs
A mock provider for your blockchain testing needs.
The npm package @ethereum-waffle/provider receives a total of 54,366 weekly downloads. As such, @ethereum-waffle/provider popularity was classified as popular.
We found that @ethereum-waffle/provider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.