Updated on 2026-08-14
This commit is contained in:
parent
608753d937
commit
1da1c903a1
3 changed files with 15 additions and 13 deletions
|
|
@ -194,9 +194,9 @@ public class EthEngine extends CoinEngine {
|
|||
throw new Exception("Not implemented");
|
||||
}
|
||||
|
||||
public String getAmountEquivalentDescriptor(TangemCard mCard, String value) {
|
||||
public String getAmountEquivalentDescriptor(TangemCard card, String value) {
|
||||
BigDecimal d = new BigDecimal(value);
|
||||
return getAmountEquivalentDescriptionETH(d, mCard.getRate());
|
||||
return getAmountEquivalentDescriptionETH(d, card.getRate());
|
||||
}
|
||||
|
||||
public BigDecimal GetBalanceAlterValueBigDecimal(TangemCard mCard) {
|
||||
|
|
@ -276,11 +276,11 @@ public class EthEngine extends CoinEngine {
|
|||
return true;
|
||||
}
|
||||
|
||||
public String evaluateFeeEquivalent(TangemCard mCard, String fee) {
|
||||
public String evaluateFeeEquivalent(TangemCard card, String fee) {
|
||||
BigDecimal gweFee = new BigDecimal(fee);
|
||||
gweFee = gweFee.divide(new BigDecimal("1000000000"));
|
||||
gweFee = gweFee.setScale(18, RoundingMode.DOWN);
|
||||
return getAmountEquivalentDescriptor(mCard, gweFee.toString());
|
||||
return getAmountEquivalentDescriptor(card, gweFee.toString());
|
||||
}
|
||||
|
||||
public String calculateAddress(TangemCard mCard, byte[] pkUncompressed) throws NoSuchProviderException, NoSuchAlgorithmException {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
var card: TangemCard? = null
|
||||
var feeRequestSuccess = false
|
||||
var balanceRequestSuccess = false
|
||||
private var tvFeeEquivalent: TextView? = null
|
||||
var etAmount: EditText? = null
|
||||
var etFee: EditText? = null
|
||||
var rgFee: RadioGroup? = null
|
||||
|
|
@ -73,7 +72,6 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
btnSend = findViewById(R.id.btnSend)
|
||||
etAmount = findViewById(R.id.etAmount)
|
||||
etFee = findViewById(R.id.etFee)
|
||||
tvFeeEquivalent = findViewById(R.id.tvFeeEquivalent)
|
||||
rgFee = findViewById(R.id.rgFee)
|
||||
|
||||
val engine = CoinEngineFactory.create(card!!.blockchain)
|
||||
|
|
@ -144,16 +142,20 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
try {
|
||||
val engine = CoinEngineFactory.create(card!!.blockchain)
|
||||
val eqFee = engine!!.evaluateFeeEquivalent(card, etFee!!.text.toString())
|
||||
tvFeeEquivalent!!.text = eqFee
|
||||
tvFeeEquivalent.text = eqFee
|
||||
|
||||
if (!card!!.amountEquivalentDescriptionAvailable) {
|
||||
tvFeeEquivalent!!.error = "Service unavailable"
|
||||
} else {
|
||||
tvFeeEquivalent!!.error = null
|
||||
}
|
||||
tvFeeEquivalent.error = "Service unavailable"
|
||||
tvCurrency2.visibility = View.GONE
|
||||
tvFeeEquivalent.visibility = View.GONE
|
||||
} else
|
||||
tvFeeEquivalent.error = null
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
tvFeeEquivalent!!.text = ""
|
||||
tvFeeEquivalent.text = ""
|
||||
tvCurrency2.visibility = View.GONE
|
||||
tvFeeEquivalent.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue