diff --git a/src/main/java/bisq/asset/coins/Compass.java b/src/main/java/bisq/asset/coins/Compass.java new file mode 100644 index 0000000..2754a3c --- /dev/null +++ b/src/main/java/bisq/asset/coins/Compass.java @@ -0,0 +1,39 @@ +/* + * 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 Compass extends Coin { + + public Compass() { + super("Compass", "CSS", new Base58BitcoinAddressValidator(new CompassParams())); + } + + + public static class CompassParams extends NetworkParametersAdapter { + + public CompassParams() { + addressHeader = 0x57; + p2shHeader = 0x1b; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } +} diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index ea8a817..3c32fe8 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -25,6 +25,7 @@ bisq.asset.coins.Burstcoin bisq.asset.coins.Byteball bisq.asset.coins.Cagecoin bisq.asset.coins.CassubianDetk +bisq.asset.coins.Compass bisq.asset.coins.Counterparty bisq.asset.coins.Creativecoin bisq.asset.coins.Credits diff --git a/src/test/java/bisq/asset/coins/CompassTest.java b/src/test/java/bisq/asset/coins/CompassTest.java new file mode 100644 index 0000000..b45ff00 --- /dev/null +++ b/src/test/java/bisq/asset/coins/CompassTest.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 CompassTest extends AbstractAssetTest { + + public CompassTest() { + super(new Compass()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWoo"); + assertValidAddress("BvQpKvb1SswwxVTuyZocHWCVsUeGq7MwoR"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWooX"); + assertInvalidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWo"); + assertInvalidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWoo#"); + assertInvalidAddress("bvQpKvb1SswwxVTuyZocHWCVsUeGq7MwoR"); + assertInvalidAddress("yidkVmR8GaT3oQthbm6jVxG5R7LnLVAvKwX"); + } +}