private async getContractNameByAddress()

in src/debugAdapter/transaction/transactionProvider.ts [79:96]


  private async getContractNameByAddress(address?: string): Promise<string> {
    const contractJsons = await this.getContractJsons();
    if (!address) { return ''; }
    const currentNetworkId = await this._web3.getNetworkId();
    const contractNames = Object.keys(contractJsons);
    for (const contractName of contractNames) {
      const contractJson = contractJsons[contractName];
      const networks = contractJson.networks;
      if (networks) {
        const network = networks[currentNetworkId];
        if (network && network.address
          && network.address.toLowerCase() === address.toLowerCase()) {
          return contractName;
        }
      }
    }
    return '';
  }