Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

@openzeppelin/test-helpers

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openzeppelin/test-helpers - npm Package Compare versions

Comparing version
0.5.11
to
0.5.12
+26
src/snapshot.js
const { web3 } = require('./setup');
const { promisify } = require('util');
/**
* Returns a snapshot object with the 'restore' function, which reverts blockchain to the captured state
*/
const snapshot = async function () {
const snapshotData = await promisify(web3.currentProvider.send.bind(web3.currentProvider))({
jsonrpc: '2.0',
method: 'evm_snapshot',
id: new Date().getTime(),
});
return {
restore: async function () {
await promisify(web3.currentProvider.send.bind(web3.currentProvider))({
jsonrpc: '2.0',
method: 'evm_revert',
params: [snapshotData.result],
id: new Date().getTime(),
});
},
};
};
module.exports = snapshot;
+3
-0
# Changelog
## 0.5.12 (2021-07-05)
* Added new `snapshot` module to capture and revert blockchain state.
## 0.5.11 (2021-04-29)

@@ -4,0 +7,0 @@ * Fixed `expectRevert` for latest versions of Hardhat.

+1
-1
{
"name": "@openzeppelin/test-helpers",
"version": "0.5.11",
"version": "0.5.12",
"description": "JavaScript testing helpers for Ethereum smart contract development.",

@@ -5,0 +5,0 @@ "main": "index.js",