@Override public Object getAccountDetails(String accountID) { System.out.println(" getAccountDetails - Starts "); btcClient = (BitcoinClient) btcClientMap.get(serverID); BitcoinDetails bitcoinDetails = new BitcoinDetails(); bitcoinDetails.setAccount(accountID); bitcoinDetails.setServerID(serverID); System.out.println(" getLabel - " + bitcoinDetails.getLabel()); btcClient.getServerInfo(); bitcoinDetails.setAddress(btcClient.getAccountAddress(accountID)); bitcoinDetails.setName(btcClient.getLabel(bitcoinDetails.getAddress())); bitcoinDetails.setBalance(String.valueOf(btcClient.getBalance())); bitcoinDetails.setCurrentBlockNumber(btcClient.getBlockNumber()); bitcoinDetails.setSentboxData(getSentBoxData(accountID)); bitcoinDetails.setReceivedboxData(getReceivedBoxData(accountID)); bitcoinDetails.setReceivedAddrboxData(getRecevingAddrBoxData(accountID)); System.out.println( "Block Count:" + btcClient.getBlockCount() + " btcClient.getBlockNumber():" + btcClient.getBlockNumber()); return bitcoinDetails; }
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; }
public String getLabel(String address) { btcClient = (BitcoinClient) btcClientMap.get(serverID); return btcClient.getLabel(address); }