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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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