1

I want to test off chain data input in truffle testing. So basically I kick off a test and then need to wait for another program to do something. In the old web3, this worked great:

function promisifyLogWatch(_event) {
  return new Promise((resolve, reject) => {
    _event.watch((error, log) => {
      _event.stopWatching();
      if (error !== null)
        reject(error);
      resolve(log);
    });
    });
}

And I test it in my js file like this:

await promisifyLogWatch(oracle.NewValue({ fromBlock: 'latest' }));

But now I get that _event.watch is not a function. How do I update this for web3 v1?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.