From f71cf15e2ed25d347e4b8818e0204d56001d1559 Mon Sep 17 00:00:00 2001 From: Kariyama Saiko Date: Sat, 28 Sep 2019 14:18:59 +0300 Subject: [PATCH] List Animecoin (ANI) --- .../main/java/bisq/asset/coins/Animecoin.java | 36 +++++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../java/bisq/asset/coins/AnimecoinTest.java | 44 +++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 assets/src/main/java/bisq/asset/coins/Animecoin.java create mode 100644 assets/src/test/java/bisq/asset/coins/AnimecoinTest.java diff --git a/assets/src/main/java/bisq/asset/coins/Animecoin.java b/assets/src/main/java/bisq/asset/coins/Animecoin.java new file mode 100644 index 00000000000..7ddbe6db364 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Animecoin.java @@ -0,0 +1,36 @@ +/* + * 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 . + */ + +package bisq.asset.coins; + +import bisq.asset.Base58BitcoinAddressValidator; +import bisq.asset.Coin; +import bisq.asset.NetworkParametersAdapter; + +public class Animecoin extends Coin { + public Animecoin() { + super("Animecoin", "ANI", new Base58BitcoinAddressValidator(new AnimecoinMainNetParams())); + } + + public static class AnimecoinMainNetParams extends NetworkParametersAdapter { + public AnimecoinMainNetParams() { + this.addressHeader = 23; + this.p2shHeader = 9; + this.acceptableAddressCodes = new int[]{this.addressHeader, this.p2shHeader}; + } + } +} diff --git a/assets/src/main/resources/META-INF/services/bisq.asset.Asset b/assets/src/main/resources/META-INF/services/bisq.asset.Asset index f1c7e0b0dae..61ce31e710e 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -6,6 +6,7 @@ bisq.asset.coins.Actinium bisq.asset.coins.Adeptio bisq.asset.coins.Aeon bisq.asset.coins.Amitycoin +bisq.asset.coins.Animecoin bisq.asset.coins.Arqma bisq.asset.coins.Askcoin bisq.asset.coins.Australiacash diff --git a/assets/src/test/java/bisq/asset/coins/AnimecoinTest.java b/assets/src/test/java/bisq/asset/coins/AnimecoinTest.java new file mode 100644 index 00000000000..7538294578c --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/AnimecoinTest.java @@ -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 . + */ + +package bisq.asset.coins; + +import bisq.asset.AbstractAssetTest; + +import org.junit.Test; + +public class AnimecoinTest extends AbstractAssetTest { + + public AnimecoinTest() { + super(new Animecoin()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("Aa6TDuudiNh7DRzs11wEzZWiw9QBZY3Qw1"); + assertValidAddress("AdsdUhnPsJwg5NvAuyxs4EsaE2GoSHohoq"); + assertValidAddress("4s2peLxJJ2atz1tnAKpFshnVPKTmR312fr"); + + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("aa6TDuudiNh7DRzs11wEzZWiw9QBZY3Qw1"); + assertInvalidAddress("3s2peLxJJ2atz1tnAKpFshnVPKTmR312fr"); + assertInvalidAddress("ANNPzjj2ZYEhpyJ6p6sWeH1JXbkCSmNSd#"); + } +}