I want to fetch the list of all functions with their parameters which are present in any smart contract.

  • const myContract = new web3.eth.Contract(...); – goodvibration Apr 26 '19 at 8:38
  • console.log(JSON.stringify(myContract, null, 4)); – goodvibration Apr 26 '19 at 8:40

This can be done only for contracts for which you have the ABI. Etherscan allows people to verify the contracts and the ABI becomes available through Etherscan API. Then you just need to read the JSON file to find the function names and the types.

Hope this helps.

|improve this answer|||||
  • Thank you. Can you please elaborate this using any specific example, that would be much more appreciable. – John Carter Apr 25 '19 at 10:31

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.