Updated on 2026-08-14
This commit is contained in:
parent
e5f7a71555
commit
e5a109b367
4 changed files with 29 additions and 2 deletions
|
|
@ -20,5 +20,8 @@ data class PayIdAddress(
|
|||
|
||||
data class PayIdAddressDetails(
|
||||
@SerializedName("address")
|
||||
var address: String? = null
|
||||
var address: String? = null,
|
||||
|
||||
@SerializedName("tag")
|
||||
var tag: String? = null
|
||||
)
|
||||
|
|
@ -19,7 +19,7 @@ public class XrpData extends CoinData {
|
|||
|
||||
private Boolean accountNotFound, targetAccountCreated = false;
|
||||
|
||||
private String resolvedPayIdAddress = null;
|
||||
private String resolvedPayIdAddress, resolvedPayIdTag = null;
|
||||
|
||||
@Override
|
||||
public void loadFromBundle(Bundle B) {
|
||||
|
|
@ -39,6 +39,8 @@ public class XrpData extends CoinData {
|
|||
else targetAccountCreated = false;
|
||||
if (B.containsKey("ResolvedPayIdAddress")) resolvedPayIdAddress = B.getString("ResolvedPayIdAddress");
|
||||
else resolvedPayIdAddress = null;
|
||||
if (B.containsKey("ResolvedPayIdTag")) resolvedPayIdTag = B.getString("ResolvedPayIdTag");
|
||||
else resolvedPayIdAddress = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,6 +54,7 @@ public class XrpData extends CoinData {
|
|||
if (accountNotFound != null) B.putBoolean("AccoundNotFound", accountNotFound);
|
||||
if (targetAccountCreated != null) B.putBoolean("TargetAccountCreated", targetAccountCreated);
|
||||
if (resolvedPayIdAddress != null) B.putString("ResolvedPayIdAddress", resolvedPayIdAddress);
|
||||
if (resolvedPayIdTag != null) B.putString("ResolvedPayIdTag", resolvedPayIdTag);
|
||||
} catch (Exception e) {
|
||||
Log.e("Can't save to bundle ", e.getMessage());
|
||||
}
|
||||
|
|
@ -67,6 +70,7 @@ public class XrpData extends CoinData {
|
|||
accountNotFound = false;
|
||||
targetAccountCreated = false;
|
||||
resolvedPayIdAddress = null;
|
||||
resolvedPayIdTag = null;
|
||||
}
|
||||
|
||||
// balanceUnconfirmed is just the latest balance, it equals balanceConfirmed if no unconfirmed transaction present
|
||||
|
|
@ -138,4 +142,12 @@ public class XrpData extends CoinData {
|
|||
public void setResolvedPayIdAddress(String resolvedPayIdAddress) {
|
||||
this.resolvedPayIdAddress = resolvedPayIdAddress;
|
||||
}
|
||||
|
||||
public String getResolvedPayIdTag() {
|
||||
return resolvedPayIdTag;
|
||||
}
|
||||
|
||||
public void setResolvedPayIdTag(String resolvedPayIdTag) {
|
||||
this.resolvedPayIdTag = resolvedPayIdTag;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue