Remove 'monero:' prefix when adding a XMR account

Some wallets copy the address with a 'monero:' prefix. If user pastes
that directly into the form he gets a validation error. We remove now
that prefix so the input is automatically adjusted to the address only.
This commit is contained in:
chimp1984 2020-09-04 14:33:30 -05:00
parent 57bed13cf8
commit 9a57525a46
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3

View file

@ -38,6 +38,7 @@ import bisq.core.payment.validation.AltCoinAddressValidator;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.validation.InputValidator;
import bisq.common.UserThread;
import bisq.common.util.Tuple3;
import org.apache.commons.lang3.StringUtils;
@ -123,6 +124,13 @@ public class AssetsForm extends PaymentMethodForm {
addressInputTextField.setValidator(altCoinAddressValidator);
addressInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
if (newValue.startsWith("monero:")) {
UserThread.execute(() -> {
String addressWithoutPrefix = newValue.replace("monero:", "");
addressInputTextField.setText(addressWithoutPrefix);
});
return;
}
assetAccount.setAddress(newValue);
updateFromInputs();
});