Updated on 2026-08-14

This commit is contained in:
Tangem 2020-03-18 12:11:09 +00:00
commit 4a33101527

View file

@ -342,21 +342,23 @@ public class XrpEngine extends CoinEngine {
public SignTask.TransactionToSign constructTransaction(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
checkBlockchainDataExists();
Amount reserve = convertToAmount(coinData.getReserveInInternalUnits());
if (!coinData.isTargetAccountCreated() && amountValue.compareTo(reserve) < 0) {
throw new Exception("Target account is not created. Amount should be " + reserve.toDescriptionString(getDecimals()) + " or more");
}
String amount, fee;
if (IncFee) {
amount = convertToInternalAmount(amountValue).subtract(convertToInternalAmount(feeValue)).setScale(0).toPlainString();
} else {
amount = Long.toString(convertToInternalAmount(amountValue).longValueExact());
amount = Long.toString(convertToInternalAmount(amountValue).longValue());
}
fee = Long.toString(convertToInternalAmount(feeValue).longValueExact());
if (!coinData.isTargetAccountCreated() &&
Long.valueOf(amount).compareTo(coinData.getReserveInInternalUnits().longValue()) < 0
) {
String reserveDescription = convertToAmount(coinData.getReserveInInternalUnits()).toDescriptionString(getDecimals());
throw new Exception("Target account is not created. Amount should be " + reserveDescription + " or more");
}
XrpPayment payment = new XrpPayment();
// Put `as` AccountID field Account, `Object` o