sol-time-machine

1.1.0 • Public • Published

sol-time-machine

Block manager for Solidity tests

Install

npm install sol-time-machine

Usage

const TimeMachine = require('sol-time-machine')
const timeMachine = new TimeMachine(global.web3)

snapshot/revert

// test.js
contract('Example', (accounts) => {
  beforeEach(async () => {
    await timeMachine.snapshot()
  })
  
  afterEach(async () => {
    await timeMachine.revert()
  })
 
  // Your tests here...
})

mine

// advance 10 blocks
await timeMachine.mine(10)

mineTo

// advance to block number 10
await timeMachine.mineTo(10)

/sol-time-machine/

    Package Sidebar

    Install

    npm i sol-time-machine

    Weekly Downloads

    0

    Version

    1.1.0

    License

    ISC

    Unpacked Size

    4.28 kB

    Total Files

    4

    Last publish

    Collaborators

    • dwalintukan