mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #2919 from nikchis/list-particl-asset
List Particl (PART)
This commit is contained in:
commit
a6ab3e0865
53
assets/src/main/java/bisq/asset/coins/Particl.java
Normal file
53
assets/src/main/java/bisq/asset/coins/Particl.java
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.NetworkParametersAdapter;
|
||||
import bisq.asset.AddressValidationResult;
|
||||
|
||||
|
||||
public class Particl extends Coin {
|
||||
public Particl() {
|
||||
super("Particl", "PART", new ParticlMainNetAddressValidator());
|
||||
}
|
||||
|
||||
public static class ParticlMainNetParams extends NetworkParametersAdapter {
|
||||
public ParticlMainNetParams() {
|
||||
this.addressHeader = 56;
|
||||
this.p2shHeader = 60;
|
||||
this.acceptableAddressCodes = new int[]{this.addressHeader, this.p2shHeader};
|
||||
}
|
||||
}
|
||||
public static class ParticlMainNetAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public ParticlMainNetAddressValidator() {
|
||||
super(new ParticlMainNetParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (!address.matches("^[RP][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
||||
return AddressValidationResult.invalidStructure();
|
||||
|
||||
return super.validate(address);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -70,6 +70,7 @@ bisq.asset.coins.Navcoin
|
||||
bisq.asset.coins.Neos
|
||||
bisq.asset.coins.Noir
|
||||
bisq.asset.coins.ParsiCoin
|
||||
bisq.asset.coins.Particl
|
||||
bisq.asset.coins.Persona
|
||||
bisq.asset.coins.Pinkcoin
|
||||
bisq.asset.coins.PIVX
|
||||
|
44
assets/src/test/java/bisq/asset/coins/ParticlTest.java
Normal file
44
assets/src/test/java/bisq/asset/coins/ParticlTest.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 ParticlTest extends AbstractAssetTest {
|
||||
|
||||
public ParticlTest() {
|
||||
super(new Particl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidAddresses() {
|
||||
assertValidAddress("PZdYWHgyhuG7NHVCzEkkx3dcLKurTpvmo6");
|
||||
assertValidAddress("RJAPhgckEgRGVPZa9WoGSWW24spskSfLTQ");
|
||||
assertValidAddress("PaqMewoBY4vufTkKeSy91su3CNwviGg4EK");
|
||||
assertValidAddress("PpWHwrkUKRYvbZbTic57YZ1zjmsV9X9Wu7");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidAddresses() {
|
||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
|
||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user