diff --git a/assets/src/main/java/bisq/asset/coins/Ittrium.java b/assets/src/main/java/bisq/asset/coins/Ittrium.java new file mode 100644 index 00000000000..6403b4b4d9d --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Ittrium.java @@ -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 . + */ + +package bisq.asset.coins; + +import bisq.asset.AddressValidationResult; +import bisq.asset.Base58BitcoinAddressValidator; +import bisq.asset.Coin; +import bisq.asset.NetworkParametersAdapter; + +public class Ittrium extends Coin { + + public Ittrium() { + super("Ittrium", "XIT", new IttriumAddressValidator()); + } + + + public static class IttriumAddressValidator extends Base58BitcoinAddressValidator { + + public IttriumAddressValidator() { + super(new IttriumParams()); + } + + @Override + public AddressValidationResult validate(String address) { + if (!address.matches("^[i][a-km-zA-HJ-NP-Z1-9]{25,34}$")) + return AddressValidationResult.invalidStructure(); + + return super.validate(address); + } + } + + + public static class IttriumParams extends NetworkParametersAdapter { + + public IttriumParams() { + addressHeader = 103; + p2shHeader = 6; + 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 95a18eaa688..2ed5ac905eb 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -36,6 +36,7 @@ bisq.asset.coins.EtherClassic bisq.asset.coins.FuturoCoin bisq.asset.coins.Graft bisq.asset.coins.Gridcoin +bisq.asset.coins.Ittrium bisq.asset.coins.Kekcoin bisq.asset.coins.Litecoin$Mainnet bisq.asset.coins.Litecoin$Regtest @@ -80,4 +81,4 @@ bisq.asset.tokens.GreenBlockCoin bisq.asset.tokens.LikeCoin bisq.asset.tokens.Pix bisq.asset.tokens.PixelPropertyToken -bisq.asset.tokens.Tari +bisq.asset.tokens.Tari \ No newline at end of file diff --git a/assets/src/test/java/bisq/asset/coins/IttriumTest.java b/assets/src/test/java/bisq/asset/coins/IttriumTest.java new file mode 100644 index 00000000000..50427d5df3e --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/IttriumTest.java @@ -0,0 +1,43 @@ +/* + * 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 IttriumTest extends AbstractAssetTest { + + public IttriumTest() { + super(new Ittrium()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("iZq7G99wBdTcvLpPCFnykARznHpNiZ5NPX"); + assertValidAddress("ikY6Q1VKasvAn3eDS5zhk34zYGuZZQRDca"); + assertValidAddress("ipmyTn65qJXJ6EVwMnB9WZAZxrNbanmkhp"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhmqq"); + assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhO"); + assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhe#"); + } +}