0

I want to check if a specific contract deployed at an address is an erc721 contract. I found out that most of the erc721 contracts should have safeTransferFrom function implemented. (except cryptokitties)

So, basically I want to check if safeTransferFrom function exists in the contract. I think that this https://ethereum.stackexchange.com/a/50091/42466 would help.

However, I am using an older version of web3.js (0.20.6) and it does not have this function w3.eth.abi.encodeFunctionSignature(signature);

TypeError: Cannot read property 'encodeFunctionSignature' of undefined

How can I use it to make it work for my current version of web3.js

PS: I found that the latest version of web3.js has different function signatures for many functions. So, I would not want to upgrade web3.js.

kosta
  • 283
  • 3
  • 12

1 Answers1

1

web3.sha3(signature).substring(0, 10) should do the trick.

user19510
  • 27,999
  • 2
  • 30
  • 48