diff --git a/assets/src/main/java/bisq/asset/coins/BitDaric.java b/assets/src/main/java/bisq/asset/coins/BitDaric.java new file mode 100644 index 00000000000..4c5f4c75bed --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/BitDaric.java @@ -0,0 +1,33 @@ +/* + * 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.AddressValidator; +import bisq.asset.Coin; +public class BitDaric extends Coin { + public BitDaric() { + super("BitDaric", "DARX", new BitDaricAddressValidator()); + } + public static class BitDaricAddressValidator implements AddressValidator { + @Override + public AddressValidationResult validate(String address) { + if (!address.startsWith("R")) + return AddressValidationResult.invalidAddress("", "validation.altcoin.BitDaricAddressesNotSupported"); + return AddressValidationResult.validAddress(); + } + } +} 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..b4a8ebe3dba 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -11,6 +11,7 @@ bisq.asset.coins.BitcoinClashic bisq.asset.coins.BitcoinCore bisq.asset.coins.BitcoinInstant bisq.asset.coins.BitcoinRhodium +bisq.asset.coins.BitDaric bisq.asset.coins.Bitcoin$Mainnet bisq.asset.coins.Bitcoin$Regtest bisq.asset.coins.Bitcoin$Testnet diff --git a/assets/src/test/java/bisq/asset/coins/BitDaricTest.java b/assets/src/test/java/bisq/asset/coins/BitDaricTest.java new file mode 100644 index 00000000000..a21f1d8afcd --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/BitDaricTest.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.AbstractAssetTest; +import org.junit.Test; +public class BitDaricTest extends AbstractAssetTest { + public BitDaricTest() { + super(new BitDaric()); + } + @Test + public void testValidAddresses() { + assertValidAddress("RKWuQUtmV3em1MyB7QKdshgDEAwKQXuifa"); + assertValidAddress("RG9YuDw7fa21a8h4E3Z2z2tgHrFNN27NnG"); + } + @Test + public void testInvalidAddresses() { + assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem"); + assertInvalidAddress("38NwrYsD1HxQW5zfLT0QcUUXGMPvQgzTSn"); + assertInvalidAddress("8tP9rh3SH6n9cSLmV22vnSNNw56LKGpLrB"); + assertInvalidAddress("8Zbvjr"); + } +}