Created
March 26, 2019 00:16
-
-
Save miguelmota/7466479e5bed330d8ff466eedb4579af to your computer and use it in GitHub Desktop.
Truffle ganache increase time mine helper function
This file contains 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
module.exports = async function mine(durationSeconds) { | |
return new Promise((resolve, reject) => { | |
web3.currentProvider.send({ | |
jsonrpc: '2.0', | |
method: 'evm_increaseTime', | |
params: [durationSeconds], | |
id: Date.now() | |
}, (err, resp) => { | |
if (err) { | |
return reject(err) | |
} | |
resolve() | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment