How to use the abi-decoder.getMethodIDs function in abi-decoder

To help you get started, we’ve selected a few abi-decoder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cgewecke / eth-gas-reporter / gasStats.js View on Github external
// Report the gas used during initial truffle migration too :
      const networkDeployment = contract.networks[networkId]
      if (networkDeployment && networkDeployment.transactionHash) {
        const code = sync.getCode(networkDeployment.address);
        const hash = sha1(code);
        contractNameFromCodeHash[hash] = name;
        const receipt = sync.getTransactionReceipt(networkDeployment.transactionHash);
        contractInfo.gasData.push(parseInt(receipt.gasUsed, 16));
      }

      abis.push(contract._json.abi)

      // Decode, getMethodIDs
      abiDecoder.addABI(contract._json.abi)
      const methodIDs = abiDecoder.getMethodIDs()

      // Create Method Map;
      Object.keys(methodIDs).forEach(key => {
        const isInterface = contract.unlinked_binary === '0x';
        const isConstant = methodIDs[key].constant
        const isEvent = methodIDs[key].type === 'event'
        const hasName = methodIDs[key].name

        if (hasName && !isConstant && !isEvent && !isInterface) {
          methodMap[name + '_' + key] = {
            key: key,
            contract: name,
            method: methodIDs[key].name,
            gasData: [],
            numberOfCalls: 0
          }

abi-decoder

Nodejs and Javascript library for decoding data params and events from ethereum transactions"

GPL-3.0
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis