mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 22:45:21 +01:00
commit
e2c830e632
3 changed files with 102 additions and 0 deletions
56
assets/src/main/java/bisq/asset/coins/Neos.java
Normal file
56
assets/src/main/java/bisq/asset/coins/Neos.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.AddressValidationResult;
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.NetworkParametersAdapter;
|
||||
|
||||
public class Neos extends Coin {
|
||||
|
||||
public Neos() {
|
||||
super("Neos", "NEOS", new NeosAddressValidator());
|
||||
}
|
||||
|
||||
|
||||
public static class NeosAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public NeosAddressValidator() {
|
||||
super(new NeosParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (!address.matches("^[N][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
||||
return AddressValidationResult.invalidStructure();
|
||||
|
||||
return super.validate(address);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class NeosParams extends NetworkParametersAdapter {
|
||||
|
||||
public NeosParams() {
|
||||
addressHeader = 53;
|
||||
p2shHeader = 5;
|
||||
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -86,6 +86,7 @@ bisq.asset.coins.Namecoin
|
|||
bisq.asset.coins.Nano
|
||||
bisq.asset.coins.NavCoin
|
||||
bisq.asset.coins.NEETCOIN
|
||||
bisq.asset.coins.Neos
|
||||
bisq.asset.coins.NewPowerCoin
|
||||
bisq.asset.coins.Nilu
|
||||
bisq.asset.coins.Nimiq
|
||||
|
|
45
assets/src/test/java/bisq/asset/coins/NeosTest.java
Normal file
45
assets/src/test/java/bisq/asset/coins/NeosTest.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 NeosTest extends AbstractAssetTest {
|
||||
|
||||
public NeosTest() {
|
||||
super(new Neos());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidAddresses() {
|
||||
assertValidAddress("NS5cGWdERahJ11pn12GoV5Jb7nsLzdr3kP");
|
||||
assertValidAddress("NU7nCzyQiAtTxzXLnDsJu4NhwQqrnPyJZj");
|
||||
assertValidAddress("NeeAy35aQirpmTARHEXpP8uTmpPCcSD9Qn");
|
||||
assertValidAddress("NScgetCW5bqDTVWFH3EYNMtTo5RcvDxD6B");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidAddresses() {
|
||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
||||
assertInvalidAddress("NScgetCW5bqDTVWFH3EYNMtTo5Rc#DxD6B");
|
||||
assertInvalidAddress("NeeAy35a0irpmTARHEXpP8uTmpPCcSD9Qn");
|
||||
assertInvalidAddress("NScgetCWRcvDxD6B");
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue