diff --git a/assets/src/main/java/bisq/asset/coins/Sovereign.java b/assets/src/main/java/bisq/asset/coins/Sovereign.java new file mode 100644 index 00000000000..d6ad0867f10 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Sovereign.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 Sovereign extends Coin { + + public Sovereign() { + super("Sovereign", "SOV", new Base58BitcoinAddressValidator(new SovereignParams())); + } + + + public static class SovereignParams extends NetworkParametersAdapter { + + public SovereignParams() { + addressHeader = 63; + p2shHeader = 18; + acceptableAddressCodes = new int[]{addressHeader, 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 e99268b9267..89e707bcb88 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -66,6 +66,8 @@ bisq.asset.coins.QRL bisq.asset.coins.Radium bisq.asset.coins.Ryo bisq.asset.coins.Siafund +bisq.asset.coins.Sibcoin +bisq.asset.coins.Sovereign bisq.asset.coins.Spectrecoin bisq.asset.coins.Starwels bisq.asset.coins.SUB1X diff --git a/assets/src/test/java/bisq/asset/coins/SovereignTest.java b/assets/src/test/java/bisq/asset/coins/SovereignTest.java new file mode 100644 index 00000000000..c33430def9a --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/SovereignTest.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 SovereignTest extends AbstractAssetTest { + + public SovereignTest() { + super(new Sovereign()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("SQCTmrDAhPnrEpjBGv4exaqGBTdbNe85JY"); + assertValidAddress("SctX918ChPXd6V698sr6ZUpLB5bWYk1Jbu"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("JctX918ChPXd66V98sr6ZUpLB5bWYk1Sbu"); + assertInvalidAddress("SCtJ918ChWYd6V698ur6ZUpLB5bXXk1Pbs"); + assertInvalidAddress("Sht91dCcPX86V698sr6ZUpLBbbWYk1J5u#"); + assertInvalidAddress("XctX918ChPSd6V698sr6uUpLB5bWYJ1kbZ"); + assertInvalidAddress("9ctXS18ChPX6d86BVsr6ZUpL95bWYk1Jbu"); + } +}