mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 14:42:37 +01:00
Merge pull request #1723 from blur-network/list-blur-asset
List Blur (BLUR)
This commit is contained in:
commit
6a6f648142
4 changed files with 107 additions and 11 deletions
|
@ -40,16 +40,39 @@ public class CryptonoteAddressValidator implements AddressValidator {
|
|||
// Invalid characters
|
||||
return AddressValidationResult.invalidStructure();
|
||||
}
|
||||
|
||||
if (address.startsWith(prefix) && address.length() == 94 + prefix.length()) {
|
||||
// Standard address
|
||||
return AddressValidationResult.validAddress();
|
||||
} else if (address.startsWith(subAddressPrefix) && address.length() == 94 + subAddressPrefix.length()) {
|
||||
// Subaddress
|
||||
return AddressValidationResult.validAddress();
|
||||
} else {
|
||||
// Integrated? Invalid? Doesn't matter
|
||||
if (address.startsWith(prefix)) {
|
||||
if (prefix.length() == 1 && address.length() == 94 + prefix.length()) {
|
||||
// XMR-type Standard address
|
||||
return AddressValidationResult.validAddress();
|
||||
}
|
||||
else if (prefix.length() == 2 && address.length() == 95 + prefix.length()) {
|
||||
//Aeon & Blur-type addresses
|
||||
return AddressValidationResult.validAddress();
|
||||
}
|
||||
else {
|
||||
//Non-supported prefix
|
||||
return AddressValidationResult.invalidStructure();
|
||||
}
|
||||
}
|
||||
if (address.startsWith(subAddressPrefix)) {
|
||||
if (subAddressPrefix.length() == 1 && address.length() == 94 + subAddressPrefix.length()) {
|
||||
// XMR-type subaddress
|
||||
return AddressValidationResult.validAddress();
|
||||
}
|
||||
else if (subAddressPrefix.length() == 2 && address.length() == 95 + subAddressPrefix.length()) {
|
||||
// Aeon & Blur-type subaddress
|
||||
return AddressValidationResult.validAddress();
|
||||
}
|
||||
else {
|
||||
// Non-supported subAddress
|
||||
return AddressValidationResult.invalidStructure();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Integrated? Invalid? Doesn't matter
|
||||
return AddressValidationResult.invalidStructure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
28
assets/src/main/java/bisq/asset/coins/Blur.java
Normal file
28
assets/src/main/java/bisq/asset/coins/Blur.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq 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.
|
||||
*
|
||||
* Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.CryptonoteAddressValidator;
|
||||
|
||||
public class Blur extends Coin {
|
||||
|
||||
public Blur() {
|
||||
super("Blur", "BLUR", new CryptonoteAddressValidator("bL", "Ry"));
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ bisq.asset.coins.Bitcoin$Testnet
|
|||
bisq.asset.coins.Bitcore
|
||||
bisq.asset.coins.BitDaric
|
||||
bisq.asset.coins.BitZeny
|
||||
bisq.asset.coins.Blur
|
||||
bisq.asset.coins.BSQ$Mainnet
|
||||
bisq.asset.coins.BSQ$Regtest
|
||||
bisq.asset.coins.BSQ$Testnet
|
||||
|
|
44
assets/src/test/java/bisq/asset/coins/BlurTest.java
Normal file
44
assets/src/test/java/bisq/asset/coins/BlurTest.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq 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.
|
||||
*
|
||||
* Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.AbstractAssetTest;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BlurTest extends AbstractAssetTest {
|
||||
|
||||
public BlurTest() {
|
||||
super(new Blur());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidAddresses() {
|
||||
assertValidAddress("bL3W1g1d12sbxQDTQ6q8bgU2bBp2rkfFFKfNvQuUQTHqgQHRaxKTHqK5Nqdm53BU3ibPnsqbdYAnnJMyqJ6FfN9m3CSZSNqDE");
|
||||
assertValidAddress("bL2zBGUBDkQdyYasdoAdvQCxWLa9Mk5Q1PW8Zk7S38vx9xu7T7NMPPWNfieXqUyswo544ZSB3C1n9jLMfsUvR6p91rnrSdx9h");
|
||||
assertValidAddress("Ry49oErHtqyHucxADDT2DfEJ9pRv2ciSpKV9XseCuWmx1PK1CZi4gbPKxhWBdtvLJNNc94c4yDutmZrD3WrsHPYV1nvE9X4Cc");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidAddresses() {
|
||||
assertInvalidAddress("");
|
||||
assertInvalidAddress("bl4E2BCFY31DPLjeqF6Gu7TEUM5v2JwpmudFX64AubQtFDYEPBvgvQPzidaawDhjAmHeZSw92wEBnUfdfY5144Sad2ZCknZzC");
|
||||
assertInvalidAddress("Ry49oErHtqyHucxADDT2DfEJ9pRv2ciSpKV9XseCuWmx1PK1CZi4gbPKxhWBdtvLJNNc94c4yDutmZrD3WrsHPYV1nvE9X40");
|
||||
assertInvalidAddress("bLNHRh8pFh5Y14bhBVAoD4cvqHyoPsQJqB3dr49zoF6bNDFrts96tuuj#RoUKWRwpTHmYt4Kf78FES7LCXAXKXFf6bMsx1sdgz");
|
||||
assertInvalidAddress("82zBGUBDkQdyYasdoAdvQCxWLa9Mk5Q1PW#8Zk7S38vx9xu7T7NMPPWNfieXqUyswo544ZSB3C1n9jLMfsUvR6p91rnrSdxwd");
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue