Created
June 26, 2019 15:36
-
-
Save mpolci/8d209d4638404cac9c750fcc759221d5 to your computer and use it in GitHub Desktop.
Ganache snaptshots for truffle
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
function evmSnapshot() { | |
const res = web3.currentProvider.send({ | |
jsonrpc: '2.0', | |
method: 'evm_snapshot', | |
params: [], | |
id: Date.now() | |
}) | |
// if (res.error) ... not required in sync call | |
return res.result | |
} | |
function evmRevert(snapId) { | |
const res = web3.currentProvider.send({ | |
jsonrpc: '2.0', | |
method: 'evm_revert', | |
params: [snapId], | |
id: Date.now() | |
}) | |
// if (res.error) ... not required in sync call | |
return res.result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment