3

From the web3 documentation I use this code sample:

var subscription = web3.eth.subscribe('logs', {
    address: '0x123456..',
    topics: ['0x12345...'] }, function(error, result){
    if (!error)
        console.log(log);
});

and I got this error:

TypeError: web3.eth.subscribe is not a function

is "subscribe" deprecated ? Is there a replacement for it ?

1

2 Answers 2

3

The documentation you are referring to says -

This documentation is work in progress and web3.js 1.0 is not yet released! You can find the current documentation for web3 0.x.x at github.com/ethereum/wiki/wiki/JavaScript-API.

That is the reason you are getting this error, you can follow this link for web3 js latest documentation.

Hope this helps.

0
0

also address must be a contract address and not an account https://github.com/ethereum/web3.js/issues/1752#issuecomment-404385542

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.