0

I have followed Web3 documentation to subscribe an evnet, I have created Instance of web3 using infura url as argument.

Created contract object using,

const contract = web3.eth.contract(abi, address)

Where abi and address containing Contract ABI and Contract Address respectively.

All documents and tutorials used web3.eth.Contract but it give TypeError: web3.eth.Contract is not a Constructor, so I have replaced it with 'c' web3.eth.contract.

The contract object returns, ContractFactory -> eth -> (List of functions) -> abi -> new In object structure.

I am not able to get an Event as object structure. Referred this tutorial also.

I have web3 version: 0.20.7, is there any problem with web3 version?

3
  • 1
    This web3 version is a few years old you should probably use a new one. Not sure if this is the error.
    – cqx
    Aug 30, 2019 at 6:38
  • @Pave, Yes Exactly it's just a version issue. Now it works as given in web3 documentation and references.
    – Rudrika
    Aug 30, 2019 at 7:13
  • 1
    Would be great if you could mark this question as solved!
    – cqx
    Aug 30, 2019 at 8:26

1 Answer 1

5

This web3 version is a few years old you should probably use a new one.

Make sure to update!

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.