move ganacheHelper

This commit is contained in:
poma 2019-07-18 21:38:21 +03:00
parent 6b3b7ca72b
commit f5d8f48cf0
No known key found for this signature in database
GPG key ID: 530BBEE4AE8C3604
3 changed files with 2 additions and 2 deletions

View file

@ -1,46 +0,0 @@
function send(method, params = []) {
return new Promise((resolve, reject) => {
// eslint-disable-next-line no-undef
web3.currentProvider.send({
jsonrpc: '2.0',
id: Date.now(),
method,
params
}, (err, res) => {
return err ? reject(err) : resolve(res)
})
})
}
const takeSnapshot = async () => {
return await send('evm_snapshot')
}
const revertSnapshot = async (id) => {
await send('evm_revert', [id])
}
const mineBlock = async (timestamp) => {
await send('evm_mine', [timestamp])
}
const increaseTime = async (seconds) => {
await send('evm_increaseTime', [seconds])
}
const minerStop = async () => {
await send('miner_stop', [])
}
const minerStart = async () => {
await send('miner_start', [])
}
module.exports = {
takeSnapshot,
revertSnapshot,
mineBlock,
minerStop,
minerStart,
increaseTime,
}