better increaseTime

This commit is contained in:
Ricardo Guilherme Schmidt 2018-05-17 12:47:41 -03:00
parent 7936cf2f25
commit 4b43dba374
1 changed files with 27 additions and 24 deletions

View File

@ -206,31 +206,34 @@ function isException(error) {
} }
exports.increaseTime = async (amount) => { exports.increaseTime = async (amount) => {
web3.currentProvider.sendAsync( return new Promise(function(resolve, reject) {
web3.currentProvider.sendAsync(
{ {
jsonrpc: '2.0', jsonrpc: '2.0',
method: 'evm_increaseTime', method: 'evm_increaseTime',
params: [+amount], params: [+amount],
id: new Date().getSeconds() id: new Date().getSeconds()
}, },
(error) => { (error) => {
if(error) { if (error) {
console.log(error) console.log(error);
} else { return reject(err);
/*web3.currentProvider.sendAsync( }
{ web3.currentProvider.sendAsync(
jsonrpc: '2.0', {
method: 'evm_mine', jsonrpc: '2.0',
params: [], method: 'evm_mine',
id: new Date().getSeconds() params: [],
}, (error) => { id: new Date().getSeconds()
if(error) { }, (error) => {
console.log(error) if (error) {
} console.log(error);
} return reject(err);
)*/ }
resolve();
} }
)
} }
) )
});
} }