<commit_before>const ENSJS = require("ethereum-ens");

module.exports = {
  getNewENSJS: function(provider) {
    return new ENSJS(provider);
  },

  resolveNameToAddress: function(name, ensjs) {
    return ensjs.resolver(name).addr();
  },

  convertENSNames: function(inputArgs, methodABI, web3) {
    if (methodABI.inputs.length === 0) return inputArgs;
    const { isAddress } = web3.utils;
    const ensjs = this.getNewENSJS(web3.currentProvider);

    const convertedNames = inputArgs.map((argument, index) => {
      if (index + 1 >= methodABI.inputs.length) {
        return argument;
      } else if (methodABI.inputs[index].type === "address") {
        // Check all address arguments for ENS names
        const argIsAddress = isAddress(argument);
        if (argIsAddress) return argument;
        return this.resolveNameToAddress(argument, ensjs);
      } else {
        return argument;
      }
    });
    return Promise.all(convertedNames);
  },

  convertENSParamsNames: async function(params, web3) {
    const { isAddress } = web3.utils;
    if (params.from && !isAddress(params.from)) {
      const ensjs = this.getNewENSJS(web3.currentProvider);
      const newFrom = await this.resolveNameToAddress(params.from, ensjs);
      return Object.assign({}, params, { from: newFrom });
    } else {
      return params;
    }
  }
};<commit_msg>WIP - Edit indexing error<commit_after>const ENSJS = require("ethereum-ens");

module.exports = {
  getNewENSJS: function(provider) {
    return new ENSJS(provider);
  },

  resolveNameToAddress: function(name, ensjs) {
    return ensjs.resolver(name).addr();
  },

  convertENSNames: function(inputArgs, methodABI, web3) {
    if (methodABI.inputs.length === 0) return inputArgs;
    const { isAddress } = web3.utils;
    const ensjs = this.getNewENSJS(web3.currentProvider);

    const convertedNames = inputArgs.map((argument, index) => {
      if (index + 1 > methodABI.inputs.length) {
        return argument;
      } else if (methodABI.inputs[index].type === "address") {
        // Check all address arguments for ENS names
        const argIsAddress = isAddress(argument);
        if (argIsAddress) return argument;
        return this.resolveNameToAddress(argument, ensjs);
      } else {
        return argument;
      }
    });
    return Promise.all(convertedNames);
  },

  convertENSParamsNames: async function(params, web3) {
    const { isAddress } = web3.utils;
    if (params.from && !isAddress(params.from)) {
      const ensjs = this.getNewENSJS(web3.currentProvider);
      const newFrom = await this.resolveNameToAddress(params.from, ensjs);
      return Object.assign({}, params, { from: newFrom });
    } else {
      return params;
    }
  }
};
{'fraction_non_alphanumeric': 0.12458776108464639, 'fraction_numerical': 0.005862953462806889, 'mean_word_length': 3.1615853658536586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5205583', 'n_tokens_mistral': 841, 'n_tokens_neox': 827, 'n_words': 185}