Updated on 2026-08-14

This commit is contained in:
Tangem 2019-12-18 12:39:02 +03:00
parent b3b5ee7f9a
commit 9e067e324d
9 changed files with 66 additions and 23 deletions

View file

@ -24,6 +24,7 @@ import com.tangem.wallet.TangemContext;
import com.tangem.wallet.Transaction;
import com.tangem.wallet.UnspentOutputInfo;
import com.tangem.wallet.btc.BtcData;
import com.tangem.wallet.btc.Unspents;
import org.json.JSONArray;
import org.json.JSONException;
@ -424,7 +425,15 @@ public class BtcCashEngine extends CoinEngine {
@Override
public String getUnspentInputsDescription() {
return coinData.getUnspentInputsDescription();
Unspents unspents = coinData.getUnspentInputsDescription();
if (unspents == null) {
return "";
} else {
return String.format(
ctx.getContext().getString(R.string.details_unspents_number),
unspents.getUnspetns(),
unspents.getGatheredUnspents());
}
}
@Override

View file

@ -22,18 +22,19 @@ public class BtcData extends CoinData {
//for blockchain.info
private boolean hasUnconfirmed = false;
public String getUnspentInputsDescription() {
public Unspents getUnspentInputsDescription() {
try {
int gatheredUnspents = 0;
if (unspentTransactions == null) return "";
if (unspentTransactions == null) return null;
for (int i = 0; i < unspentTransactions.size(); i++) {
if (unspentTransactions.get(i).script != null && unspentTransactions.get(i).script.length() > 1)
gatheredUnspents++;
}
return unspentTransactions.size() + " unspents (" + gatheredUnspents + " received)";
return new Unspents(unspentTransactions.size(), gatheredUnspents);
} catch (Exception e) {
e.printStackTrace();
return "";
return null;
}
}

View file

@ -437,7 +437,15 @@ public class BtcEngine extends CoinEngine {
@Override
public String getUnspentInputsDescription() {
return coinData.getUnspentInputsDescription();
Unspents unspents = coinData.getUnspentInputsDescription();
if (unspents == null) {
return "";
} else {
return String.format(
ctx.getContext().getString(R.string.details_unspents_number),
unspents.getUnspetns(),
unspents.getGatheredUnspents());
}
}
@Override

View file

@ -0,0 +1,3 @@
package com.tangem.wallet.btc
data class Unspents(val unspetns: Int, val gatheredUnspents: Int)

View file

@ -25,6 +25,7 @@ import com.tangem.wallet.Transaction;
import com.tangem.wallet.UnspentOutputInfo;
import com.tangem.wallet.btc.BtcData;
import com.tangem.wallet.btc.BtcEngine;
import com.tangem.wallet.btc.Unspents;
import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
@ -377,7 +378,15 @@ public class DucatusEngine extends BtcEngine {
@Override
public String getUnspentInputsDescription() {
return coinData.getUnspentInputsDescription();
Unspents unspents = coinData.getUnspentInputsDescription();
if (unspents == null) {
return "";
} else {
return String.format(
ctx.getContext().getString(R.string.details_unspents_number),
unspents.getUnspetns(),
unspents.getGatheredUnspents());
}
}
@Override

View file

@ -31,6 +31,7 @@ import com.tangem.wallet.Transaction;
import com.tangem.wallet.UnspentOutputInfo;
import com.tangem.wallet.btc.BtcData;
import com.tangem.wallet.btc.BtcEngine;
import com.tangem.wallet.btc.Unspents;
import org.json.JSONException;
@ -389,7 +390,15 @@ public class LtcEngine extends BtcEngine {
@Override
public String getUnspentInputsDescription() {
return coinData.getUnspentInputsDescription();
Unspents unspents = coinData.getUnspentInputsDescription();
if (unspents == null) {
return "";
} else {
return String.format(
ctx.getContext().getString(R.string.details_unspents_number),
unspents.getUnspetns(),
unspents.getGatheredUnspents());
}
}
@Override