Updated on 2026-08-14

This commit is contained in:
Tangem 2020-06-18 22:44:08 +03:00
parent e5f7a71555
commit e5a109b367
4 changed files with 29 additions and 2 deletions

View file

@ -367,6 +367,15 @@ public class XrpEngine extends CoinEngine {
destinationTag = decodedXAddress.getDestinationTag();
}
if (coinData.getResolvedPayIdTag() != null) {
int resolvedTag = Integer.parseInt(coinData.getResolvedPayIdTag());
if (destinationTag == null || destinationTag == resolvedTag) {
destinationTag = resolvedTag;
} else { // Different destination tags in PayID response and in X-address
throw new IllegalArgumentException("Conflicting destination tags found");
}
}
if (IncFee) {
amount = convertToInternalAmount(amountValue).subtract(convertToInternalAmount(feeValue)).setScale(0).toPlainString();
} else {
@ -621,15 +630,18 @@ public class XrpEngine extends CoinEngine {
public void onSuccess(PayIdResponse payIdResponse) {
try {
String resolvedAddress = null;
String resolvedTag = null;
for (PayIdAddress address : payIdResponse.getAddresses()) {
if (address.getPaymentNetwork().equals("XRPL") &&
address.getEnvironment().equals("MAINNET")) {
resolvedAddress = address.getAddressDetails().getAddress();
resolvedTag = address.getAddressDetails().getTag();
break;
}
}
if (validateAddress(resolvedAddress)) {
coinData.setResolvedPayIdAddress(resolvedAddress);
coinData.setResolvedPayIdTag(resolvedTag);
XrpXAddressDecoded xAddressDecoded = XrpXAddressService.Companion.decode(resolvedAddress);
if (xAddressDecoded == null) { // classic address