Пример #1
0
  public Map getSentBoxData(String account) {
    HashMap data = new HashMap();
    btcClient = (BitcoinClient) btcClientMap.get(serverID);
    List listOfTransactions = btcClient.listTransactions(account);
    System.out.println(" listOfTransactions.size(): " + listOfTransactions.size());
    for (int i = 0; i < listOfTransactions.size(); i++) {
      TransactionInfo trnInfo = (TransactionInfo) listOfTransactions.get(i);
      /*System.out.println(" ------------------------------------ " + trnInfo);
      System.out.println("confirm:" + trnInfo.getConfirmations());
      System.out.println("amout:" + trnInfo.getAmount());
      System.out.println("Address:" + trnInfo.getAddress());
      System.out.println("mess:" + trnInfo.getMessage());
      System.out.println("cat:" + trnInfo.getCategory());
      System.out.println("other acct:" + trnInfo.getOtherAccount());
      System.out.println("fees:" + trnInfo.getFee());
      System.out.println("ID:" + trnInfo.getTxId());
      System.out.println("Date:" + trnInfo.getTimestamp());
      System.out.println("Formatted Date:" + new Date(trnInfo.getTimestamp() * 1000));*/

      if ("send".equalsIgnoreCase(trnInfo.getCategory())) {
        String[] row = new String[6];
        row[0] = String.valueOf(trnInfo.getConfirmations() + " Confirmations");
        row[1] = String.valueOf(new Date(trnInfo.getTimestamp() * 1000));
        row[2] = String.valueOf(trnInfo.getAmount() * -1);
        row[3] = String.valueOf(trnInfo.getAddress());
        row[4] = trnInfo.getMessage() == null ? "" : trnInfo.getMessage();
        row[5] = String.valueOf(trnInfo.getTxId());

        data.put(row[5], row);
      }
    }
    return data;
  }
Пример #2
0
  public Map getRecevingAddrBoxData(String account) {

    HashMap data = new HashMap();
    btcClient = (BitcoinClient) btcClientMap.get(serverID);
    List listOfAddress = btcClient.getAddressesByAccount(account);

    for (int i = 0; i < listOfAddress.size(); i++) {
      String address = (String) listOfAddress.get(i);
      boolean addAddress = true;
      double amount = 0.0;
      List list = btcClient.listTransactions(account);
      for (int j = 0; j < list.size(); j++) {
        TransactionInfo info = (TransactionInfo) list.get(j);

        if (address != null
            && address.equals(info.getAddress())
            && "send".equalsIgnoreCase(info.getCategory())) {
          addAddress = false;
          break;
        } else if (address != null
            && address.equals(info.getAddress())
            && "receive".equalsIgnoreCase(info.getCategory())) {
          amount += info.getAmount();
        }
      }
      if (addAddress) {

        String[] row = new String[3];

        row[0] = btcClient.getLabel(address);
        row[1] = address;
        row[2] = String.valueOf(Utility.roundTwoDecimals(amount));

        data.put(row[1], row);
      }
    }
    return data;
  }