Created
June 30, 2017 19:00
-
-
Save sogoiii/4d541cc6586d486d82bbec4f40e10bb4 to your computer and use it in GitHub Desktop.
Promisify evm_increateTime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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