Create DogecoinAddressValidator.java

Validates a dogecoin address
This commit is contained in:
XMRZombie 2024-12-08 05:55:44 +00:00 committed by GitHub
parent 8e717f9100
commit 32e23cb721
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,39 @@
/*
* This file is part of Haveno.
*
* Haveno is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Haveno is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
*/
package haveno.asset;
/**
* Validates a Dogecoin address using the regular expression for Dogecoin's Base58 encoding format.
* Dogecoin addresses are typically represented as Base58 strings starting with either "D" (for P2PKH)
* or "9" (for P2SH). The address should be 34 characters long.
*
* @author Your Name
* @since 1.0.0
*/
public class DogecoinAddressValidator extends RegexAddressValidator {
// Regular expression for a valid Dogecoin address (Base58 encoded, 34 characters long)
// Dogecoin addresses start with 'D' (P2PKH) or '9' (P2SH), followed by 33 characters
public DogecoinAddressValidator() {
super("^[D9][A-HJ-NP-Za-km-z1-9]{33}$");
}
public DogecoinAddressValidator(String errorMessageI18nKey) {
super("^[D9][A-HJ-NP-Za-km-z1-9]{33}$", errorMessageI18nKey);
}
}