Git Product home page Git Product logo

Comments (3)

tcoulter avatar tcoulter commented on August 15, 2024

Hi @wighawag - quick question. Are you using this with Truffle?

Either way, you'd want to do something like this after setting the provider:

web3.currentProvider.sendAsync({
  jsonrpc: "2.0",
  method: "evm_snapshot",
  id: 12345
}, function(err, result) {
  // this is your callback
});

The reason you have to do this is because evm_snapshot is a non-standard method and web3 does not provide an interface for it.

Aside: The provider interface exists on the TestRPC as well, which, depending on your context may simplify a few things for you:

var TestRPC = require("ethereumjs-testrpc");

before(function(done){
    web3.setProvider(new TestRPC.provider()));
    done();
})

Going to close this as unfortunately there's no way around this syntax given the relationship between providers and web3 proper.

from ganache-cli-archive.

wighawag avatar wighawag commented on August 15, 2024

Thanks for the quick reply, I am using it without anything except just node and mocha

using sendAsync I get the same error :

 Uncaught AssertionError: null == true
      at Object.callback (test/index.js:142:8)
      at node_modules/web3/lib/web3/method.js:142:25
      at node_modules/web3/lib/web3/requestmanager.js:89:9
      at Web3ProviderEngine._inspectResponseForNewBlock (node_modules/web3-provider-engine/index.js:217:12)
      at node_modules/web3-provider-engine/index.js:127:14
      at node_modules/async/lib/async.js:52:16
      at node_modules/async/lib/async.js:269:32
      at node_modules/async/lib/async.js:44:16
      at async.eachSeries.resultObj.id (node_modules/web3-provider-engine/index.js:108:9)
      at node_modules/async/lib/async.js:181:20
      at Immediate.iterate [as _onImmediate] (node_modules/async/lib/async.js:262:13)

but I can now see the log mentionning the snapshot saving and restore.

Saved snapshot #1

and

Reverting to snapshot #1

Not sure what is wrong here.

from ganache-cli-archive.

wighawag avatar wighawag commented on August 15, 2024

no wait that's a different error, might be on my side. sorry

from ganache-cli-archive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.