From be257da2592987c3c7325a1d7ab818198daefa26 Mon Sep 17 00:00:00 2001 From: LitecoinZ Date: Tue, 8 Jan 2019 14:48:12 +0100 Subject: [PATCH] List LitecoinZ (LTZ) --- .../main/java/bisq/asset/coins/LitecoinZ.java | 31 +++++++++++++ .../META-INF/services/bisq.asset.Asset | 3 +- .../java/bisq/asset/coins/LitecoinZTest.java | 43 +++++++++++++++++++ .../resources/i18n/displayStrings.properties | 1 + 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 assets/src/main/java/bisq/asset/coins/LitecoinZ.java create mode 100644 assets/src/test/java/bisq/asset/coins/LitecoinZTest.java diff --git a/assets/src/main/java/bisq/asset/coins/LitecoinZ.java b/assets/src/main/java/bisq/asset/coins/LitecoinZ.java new file mode 100644 index 00000000000..735834cb830 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/LitecoinZ.java @@ -0,0 +1,31 @@ +/* + * 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.AltCoinAccountDisclaimer; +import bisq.asset.Coin; +import bisq.asset.RegexAddressValidator; + +@AltCoinAccountDisclaimer("account.altcoin.popup.LTZ.msg") +public class LitecoinZ extends Coin { + + public LitecoinZ() { + super("LitecoinZ", "LTZ", new RegexAddressValidator("^L.*", "validation.altcoin.ltz.zAddressesNotSupported")); + } + +} 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 6b24510dcb6..7e1321894a1 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -42,6 +42,7 @@ bisq.asset.coins.IdaPay bisq.asset.coins.Iridium bisq.asset.coins.Kekcoin bisq.asset.coins.Litecoin +bisq.asset.coins.LitecoinZ bisq.asset.coins.Lytix bisq.asset.coins.Mask bisq.asset.coins.Mile @@ -79,4 +80,4 @@ bisq.asset.coins.Zero bisq.asset.coins.ZeroOneCoin bisq.asset.tokens.AugmintEuro bisq.asset.tokens.EtherStone -bisq.asset.tokens.VectorspaceAI \ No newline at end of file +bisq.asset.tokens.VectorspaceAI diff --git a/assets/src/test/java/bisq/asset/coins/LitecoinZTest.java b/assets/src/test/java/bisq/asset/coins/LitecoinZTest.java new file mode 100644 index 00000000000..e8f2e63ed0b --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/LitecoinZTest.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 LitecoinZTest extends AbstractAssetTest { + + public LitecoinZTest() { + super(new LitecoinZ()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("L17opZaVcRK4h9MV4KhkCmzUBa56BxSRb8A"); + assertValidAddress("L1EjNbAPVtg8jE9EyvbsA7epibZ9j8bdYmV"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem"); + assertInvalidAddress("38NwrYsD1HxQW5zfLT0QcUUXGMPvQgzTSn"); + assertInvalidAddress("8tP9rh3SH6n9cSLmV22vnSNNw56LKGpLrB"); + assertInvalidAddress("8Zbvjr"); + } +} diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index e158cc57986..895b45be37f 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -2574,6 +2574,7 @@ validation.nationalAccountId={0} must consist of {1} numbers. validation.invalidInput=Invalid input: {0} validation.accountNrFormat=Account number must be of format: {0} validation.altcoin.wrongStructure=Address validation failed because it does not match the structure of a {0} address. +validation.altcoin.ltz.zAddressesNotSupported=LTZ address need to start with L. Addresses starting with z are not supported. validation.altcoin.zAddressesNotSupported=ZEC address need to start with t. Addresses starting with z are not supported. validation.altcoin.invalidAddress=Address is not a valid {0} address! {1} validation.bic.invalidLength=Input length is neither 8 nor 11