fixed LTC wallet lookup

This commit is contained in:
Radek Davidek 2023-01-29 13:17:38 +01:00
parent a8ff76de58
commit 05045cc37e

View File

@ -109,13 +109,12 @@ public class MiningBean {
try {
if (ltcWallet != null && !"null".equals(ltcWallet) && ltcWallet.length() > 0) {
restRequest = getStringResponse(
"https://chain.so/api/v2/get_address_balance/LTC/".concat(ltcWallet));
if (restRequest != null && restRequest.length() > 0) {
JSONObject full = new JSONObject(restRequest);
JSONObject data = (JSONObject) full.get("data");
String confirmedBalance = (String) data.get("confirmed_balance");
"https://live.blockcypher.com/ltc/address/".concat(ltcWallet));
if (restRequest != null && restRequest.length() > 0 && restRequest.contains("<span class=\"dash-label\">Balance</span>")) {
int index = restRequest.indexOf("<span class=\"dash-label\">Balance</span>")+"<span class=\"dash-label\">Balance</span>".length();
String text = restRequest.substring(index+4, index+15);
double res = Double.parseDouble(confirmedBalance);
double res = Double.parseDouble(text);
if (res > 0d) {
resultStr = res + " LTC " + curSym + String.format("%.2f", (res * lastPrices[1]));
} else