Skip to content

Instantly share code, notes, and snippets.

@sogoiii
Created June 30, 2017 19:00
Show Gist options
  • Save sogoiii/4d541cc6586d486d82bbec4f40e10bb4 to your computer and use it in GitHub Desktop.
Save sogoiii/4d541cc6586d486d82bbec4f40e10bb4 to your computer and use it in GitHub Desktop.
Promisify evm_increateTime
const timeTravel = function (time) {
return new Promise((resolve, reject) => {
web3.currentProvider.sendAsync({
jsonrpc: "2.0",
method: "evm_increaseTime",
params: [time], // 86400 is num seconds in day
id: new Date().getTime()
}, (err, result) => {
if(err){ return reject(err) }
return resolve(result)
});
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment