@openzeppelin/test-helpers
Advanced tools
| 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", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
52108
1.57%20
5.26%852
2.77%