Updated on 2026-08-14
This commit is contained in:
parent
47d731ffe2
commit
d6a2d677ee
8 changed files with 50 additions and 60 deletions
|
|
@ -9,7 +9,6 @@ import com.tangem.util.BTCUtils;
|
|||
import com.tangem.util.CryptoUtil;
|
||||
import com.tangem.util.DecimalDigitsInputFilter;
|
||||
import com.tangem.util.DerEncodingUtil;
|
||||
import com.tangem.util.FormatUtil;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
|
|
@ -194,7 +193,7 @@ public class BtcCashEngine extends CoinEngine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amountValue, Amount feeValue, Boolean isIncludeFee, InternalAmount minFeeInInternalUnits) {
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amountValue, Amount feeValue, Boolean isIncludeFee) {
|
||||
InternalAmount fee;
|
||||
InternalAmount amount;
|
||||
|
||||
|
|
@ -308,7 +307,9 @@ public class BtcCashEngine extends CoinEngine {
|
|||
@Override
|
||||
public String getBalanceEquivalent() {
|
||||
if (coinData == null || !coinData.getAmountEquivalentDescriptionAvailable()) return "";
|
||||
return getBalance().toEquivalentString(coinData.getRate());
|
||||
Amount balance=getBalance();
|
||||
if( balance==null ) return "";
|
||||
return balance.toEquivalentString(coinData.getRate());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -3,15 +3,12 @@ package com.tangem.domain.wallet;
|
|||
import android.net.Uri;
|
||||
import android.text.InputFilter;
|
||||
|
||||
import com.tangem.domain.BitcoinNode;
|
||||
import com.tangem.domain.BitcoinNodeTestNet;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.TLV;
|
||||
import com.tangem.util.BTCUtils;
|
||||
import com.tangem.util.CryptoUtil;
|
||||
import com.tangem.util.DecimalDigitsInputFilter;
|
||||
import com.tangem.util.DerEncodingUtil;
|
||||
import com.tangem.util.FormatUtil;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
|
|
@ -199,7 +196,7 @@ public class BtcEngine extends CoinEngine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amountValue, Amount feeValue, Boolean isIncludeFee, InternalAmount minFeeInInternalUnits) {
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amountValue, Amount feeValue, Boolean isIncludeFee) {
|
||||
InternalAmount fee;
|
||||
InternalAmount amount;
|
||||
|
||||
|
|
@ -316,7 +313,9 @@ public class BtcEngine extends CoinEngine {
|
|||
@Override
|
||||
public String getBalanceEquivalent() {
|
||||
if( coinData ==null || !coinData.getAmountEquivalentDescriptionAvailable() ) return "";
|
||||
return getBalance().toEquivalentString(coinData.getRate());
|
||||
Amount balance=getBalance();
|
||||
if( balance==null ) return "";
|
||||
return balance.toEquivalentString(coinData.getRate());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -367,7 +366,7 @@ public class BtcEngine extends CoinEngine {
|
|||
@Override
|
||||
public InternalAmount convertToInternalAmount(Amount amount) throws Exception {
|
||||
BigDecimal d=amount.multiply(new BigDecimal("100000000"));
|
||||
return new InternalAmount(d, getBalanceCurrency());
|
||||
return new InternalAmount(d, "Satoshi");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ import android.text.InputFilter;
|
|||
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
|
|
@ -196,7 +193,7 @@ public abstract class CoinEngine {
|
|||
public abstract boolean checkNewTransactionAmount(Amount amount);
|
||||
|
||||
// TODO - move minFeeInInternalUnits to CoinData
|
||||
public abstract boolean checkNewTransactionAmountAndFee(Amount amount, Amount fee, Boolean isFeeIncluded, InternalAmount minFeeInInternalUnits);
|
||||
public abstract boolean checkNewTransactionAmountAndFee(Amount amount, Amount fee, Boolean isFeeIncluded);
|
||||
|
||||
public abstract boolean validateBalance(BalanceValidator balanceValidator);
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,9 @@ public class EthEngine extends CoinEngine {
|
|||
|
||||
@Override
|
||||
public String getBalanceEquivalent() {
|
||||
return getBalance().toEquivalentString(coinData.getRate());
|
||||
Amount balance=getBalance();
|
||||
if( balance==null ) return "";
|
||||
return balance.toEquivalentString(coinData.getRate());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -258,7 +260,7 @@ public class EthEngine extends CoinEngine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amount, Amount fee, Boolean isFeeIncluded, InternalAmount minFeeInInternalUnits) {
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amount, Amount fee, Boolean isFeeIncluded) {
|
||||
// Long fee = null;
|
||||
// Long amount = null;
|
||||
// try {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class TokenData extends EthData {
|
|||
public void loadFromBundle(Bundle B) {
|
||||
super.loadFromBundle(B);
|
||||
|
||||
balanceAlter = new CoinEngine.InternalAmount(B.getString("BalanceDecimalAlter"),"ETH");
|
||||
balanceAlter = new CoinEngine.InternalAmount(B.getString("BalanceDecimalAlter"),"wei");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -172,8 +172,10 @@ public class TokenEngine extends CoinEngine {
|
|||
}
|
||||
try {
|
||||
if (coinData.getBalanceInInternalUnits().notZero()) {
|
||||
return convertToAmount(coinData.getBalanceInInternalUnits()).toEquivalentString(coinData.getRate());
|
||||
// TODO: check why Rate=EthRate
|
||||
return "";//convertToAmount(coinData.getBalanceInInternalUnits()).toEquivalentString(coinData.getRate());
|
||||
} else {
|
||||
if( coinData.getBalanceAlterInInternalUnits()==null ) return "";
|
||||
return convertToAmount(coinData.getBalanceAlterInInternalUnits()).toEquivalentString(coinData.getRateAlter());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -318,7 +320,7 @@ public class TokenEngine extends CoinEngine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amount, Amount fee, Boolean isFeeIncluded, InternalAmount minFeeInInternalUnits) {
|
||||
public boolean checkNewTransactionAmountAndFee(Amount amount, Amount fee, Boolean isFeeIncluded) {
|
||||
if (!hasBalanceInfo()) return false;
|
||||
|
||||
try {
|
||||
|
|
@ -330,14 +332,8 @@ public class TokenEngine extends CoinEngine {
|
|||
|
||||
if (amount.getCurrency().equals(ctx.getCard().tokenSymbol)) {
|
||||
// token transaction
|
||||
//TODO ???
|
||||
// BigDecimal tmpFee = new BigDecimal(feeValue);
|
||||
// BigDecimal tmpAmount = amount;
|
||||
// tmpAmount = tmpAmount.multiply(new BigDecimal("1000000000"));
|
||||
//
|
||||
// if (tmpFee.compareTo(tmpAmount) > 0)
|
||||
// return false;
|
||||
|
||||
if( fee.compareTo(balance)>0 )
|
||||
return false;
|
||||
} else if (amount.getCurrency().equals("ETH") && coinData.getBalanceInInternalUnits().isZero()) {
|
||||
// standart ETH transaction
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue