mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
List Qbase (QBS)
This commit is contained in:
parent
cd616ffaf3
commit
6ec318cf7c
38
assets/src/main/java/bisq/asset/coins/Qbase.java
Normal file
38
assets/src/main/java/bisq/asset/coins/Qbase.java
Normal file
@ -0,0 +1,38 @@
|
||||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.AddressValidationResult;
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.NetworkParametersAdapter;
|
||||
|
||||
public class Qbase extends Coin {
|
||||
public Qbase() {
|
||||
super("Qbase", "QBS", new Qbase.QbaseAddressValidator());
|
||||
}
|
||||
|
||||
|
||||
public static class QbaseAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public QbaseAddressValidator() {
|
||||
super(new Qbase.QbaseParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (!address.matches("^[B][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
||||
return AddressValidationResult.invalidStructure();
|
||||
|
||||
return super.validate(address);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class QbaseParams extends NetworkParametersAdapter {
|
||||
|
||||
public QbaseParams() {
|
||||
addressHeader = 25;
|
||||
p2shHeader = 5;
|
||||
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
|
||||
}
|
||||
}
|
||||
}
|
@ -61,6 +61,7 @@ bisq.asset.coins.Nimiq
|
||||
bisq.asset.coins.PIVX
|
||||
bisq.asset.coins.PRiVCY
|
||||
bisq.asset.coins.PZDC
|
||||
bisq.asset.coins.Qbase
|
||||
bisq.asset.coins.QMCoin
|
||||
bisq.asset.coins.QRL
|
||||
bisq.asset.coins.Radium
|
||||
|
28
assets/src/test/java/bisq/asset/coins/QbaseTest.java
Normal file
28
assets/src/test/java/bisq/asset/coins/QbaseTest.java
Normal file
@ -0,0 +1,28 @@
|
||||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.AbstractAssetTest;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class QbaseTest extends AbstractAssetTest {
|
||||
public QbaseTest() {
|
||||
super(new Qbase());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidAddresses() {
|
||||
assertValidAddress("BBrv1uUkQxpWayMvaVSw9Gr4X7CcdWUtcC");
|
||||
assertValidAddress("BNMFjkDk9qqcF2rtoAbqbqWiHa41GPkQ2G");
|
||||
assertValidAddress("B73WdFQXx8VGNg8h1BeJj6H2BEa1xrbtsT");
|
||||
assertValidAddress("BGq4DH2BnS4kFWuNNQqfmiDLZvjaWtvnWX");
|
||||
assertValidAddress("B9b8iTbVVcQrohrEnJ9ho4QUftHS3svB84");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidAddresses() {
|
||||
assertInvalidAddress("bBrv1uUkQxpWayMvaVSw9Gr4X7CcdWUtcC");
|
||||
assertInvalidAddress("B3rv1uUkQxpWayMvaVSw9Gr4X7CcdWUtcC");
|
||||
assertInvalidAddress("PXP75NnwDryYswQb9RaPFBchqLRSvBmDP");
|
||||
assertInvalidAddress("PKr3vQ7S");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user