As stated in ABI specs that 0xcdcd77c0: the Method ID. This is derived as the first 4 bytes of the Keccak hash of the ASCII form of the signature baz(uint32,bool).
So, I have to create method IDs (function selectors) of my contract functions through javascript/nodejs/web3js. Suppose i have an array of functions name and their parameters (extracted from ABI JSON file)- i.e. funcNameAndParams[]
. One of its element is as follow;
{
contractNo: 0,
funcName: 'getSupplyRate',
params: [ 'address', 'uint256', 'uint256' ]
}
- Is it possible to generate Method IDs, having above information ? if yes, how could i proceed ? I have read ABI specs but could not found how to code it in JavaScript/Nodejs/web3.js
- If I have contract source code as well, then could i proceed ? Means generating Methods IDs from json ABIs will be easy or from .sol file ?