Coverage Summary for Class: LogFilterElement (org.ethereum.rpc)

Class Class, % Method, % Line, %
LogFilterElement 0% (0/1) 0% (0/2) 0% (0/14)


1 /* 2  * This file is part of RskJ 3  * Copyright (C) 2017 RSK Labs Ltd. 4  * 5  * This program is free software: you can redistribute it and/or modify 6  * it under the terms of the GNU Lesser General Public License as published by 7  * the Free Software Foundation, either version 3 of the License, or 8  * (at your option) any later version. 9  * 10  * This program is distributed in the hope that it will be useful, 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13  * GNU Lesser General Public License for more details. 14  * 15  * You should have received a copy of the GNU Lesser General Public License 16  * along with this program. If not, see <http://www.gnu.org/licenses/>. 17  */ 18  19 package org.ethereum.rpc; 20  21 import org.ethereum.core.Block; 22 import org.ethereum.core.Transaction; 23 import org.ethereum.vm.LogInfo; 24  25 import java.util.Arrays; 26  27 import static org.ethereum.rpc.TypeConverter.toJsonHex; 28 import static org.ethereum.rpc.TypeConverter.toUnformattedJsonHex; 29  30 /** 31  * Created by ajlopez on 5/4/2016. 32  */ 33 public class LogFilterElement { 34  public String logIndex; 35  public String blockNumber; 36  public String blockHash; 37  public String transactionHash; 38  public String transactionIndex; 39  public String address; 40  public String data; 41  public String[] topics; 42  43  public LogFilterElement(LogInfo logInfo, Block b, int txIndex, Transaction tx, int logIdx) { 44  logIndex = TypeConverter.toQuantityJsonHex(logIdx); 45  blockNumber = b == null ? null : TypeConverter.toQuantityJsonHex(b.getNumber()); 46  blockHash = b == null ? null : toJsonHex(b.getHash().getBytes()); 47  transactionIndex = b == null ? null : TypeConverter.toQuantityJsonHex(txIndex); 48  transactionHash = tx.getHash().toJsonString(); 49  address = toUnformattedJsonHex(logInfo.getAddress()); 50  data = toUnformattedJsonHex(logInfo.getData()); 51  topics = new String[logInfo.getTopics().size()]; 52  for (int i = 0; i < topics.length; i++) { 53  topics[i] = toUnformattedJsonHex(logInfo.getTopics().get(i).getData()); 54  } 55  } 56  57  @Override 58  public String toString() { 59  return "LogFilterElement{" + 60  "logIndex='" + logIndex + '\'' + 61  ", blockNumber='" + blockNumber + '\'' + 62  ", blockHash='" + blockHash + '\'' + 63  ", transactionHash='" + transactionHash + '\'' + 64  ", transactionIndex='" + transactionIndex + '\'' + 65  ", address='" + address + '\'' + 66  ", data='" + data + '\'' + 67  ", topics=" + Arrays.toString(topics) + 68  '}'; 69  } 70 }