Merge pull request #1657 from neoscoin/list-neos-coin

List Neos (NEOS)
This commit is contained in:
Manfred Karrer 2018-10-05 15:19:45 -05:00 committed by GitHub
commit e2c830e632
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 102 additions and 0 deletions

View 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};
}
}
}

View file

@ -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

View 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");
}
}