Create SolanaAddressValidator.java

Adding solana address validation, uses a base58 regex filter
This commit is contained in:
XMRZombie 2024-12-08 05:45:10 +00:00 committed by GitHub
parent 99bbf8474b
commit 0b93930d19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,35 @@
/*
* 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 Solana address using the regular expression for Solana's Base58 encoding format.
* Solana addresses are typically represented as a 44-character Base58 string.
* The address must be a valid Base58 string of length 44.
*/
public class SolanaAddressValidator extends RegexAddressValidator {
// Regular expression for a valid Solana address (Base58 encoded, 44 characters long)
public SolanaAddressValidator() {
super("^[1-9A-HJ-NP-Za-km-z]{32,44}$");
}
public SolanaAddressValidator(String errorMessageI18nKey) {
super("^[1-9A-HJ-NP-Za-km-z]{32,44}$", errorMessageI18nKey);
}
}