From 57a5cd5357162044ef1e8249690e7fa85c0e3a7b Mon Sep 17 00:00:00 2001 From: MidoriDaria Date: Tue, 5 Nov 2019 15:01:52 +1000 Subject: [PATCH] List ZBit (ZBT) --- .../src/main/java/bisq/asset/coins/ZBit.java | 30 ++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../i18n/displayStrings-assets.properties | 3 +- .../test/java/bisq/asset/coins/ZBitTest.java | 49 +++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 assets/src/main/java/bisq/asset/coins/ZBit.java create mode 100644 assets/src/test/java/bisq/asset/coins/ZBitTest.java diff --git a/assets/src/main/java/bisq/asset/coins/ZBit.java b/assets/src/main/java/bisq/asset/coins/ZBit.java new file mode 100644 index 00000000000..97f398093fb --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/ZBit.java @@ -0,0 +1,30 @@ +/* + * 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.I18n; +import bisq.asset.RegexAddressValidator; + +@AltCoinAccountDisclaimer("account.altcoin.popup.ZBT.msg") +public class ZBit extends Coin { + public ZBit() { + super("ZBit", "ZBT", new RegexAddressValidator("^8[a-zA-Z0-9]{33}")); + } +} 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 2128b5b1fa0..183941dea34 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -113,6 +113,7 @@ bisq.asset.coins.Webchain bisq.asset.coins.WORX bisq.asset.coins.WrkzCoin bisq.asset.coins.XDR +bisq.asset.coins.ZBit bisq.asset.coins.Zcash bisq.asset.coins.Zcoin bisq.asset.coins.ZelCash diff --git a/assets/src/main/resources/i18n/displayStrings-assets.properties b/assets/src/main/resources/i18n/displayStrings-assets.properties index beabf782fbf..9935dec05b4 100644 --- a/assets/src/main/resources/i18n/displayStrings-assets.properties +++ b/assets/src/main/resources/i18n/displayStrings-assets.properties @@ -25,4 +25,5 @@ account.altcoin.popup.validation.ETC=ETC address must start with '0x' and made u account.altcoin.popup.validation.NMC=NMC address must start with 'N' or 'M' and must be 34 characters long. account.altcoin.popup.validation.SF= Siafund address must be made up of letters A to F and numbers which are 76 characters long. account.altcoin.popup.validation.UNO=UNO address must start with 'u' and must have 34 characters. -account.altcoin.popup.validation.XZC=XZC address must start with 'a' and must have 34 characters. \ No newline at end of file +account.altcoin.popup.validation.XZC=XZC address must start with 'a' and must have 34 characters. +account.altcoin.popup.validation.ZBT=ZBT address must start with '8' and must have 34 characters. diff --git a/assets/src/test/java/bisq/asset/coins/ZBitTest.java b/assets/src/test/java/bisq/asset/coins/ZBitTest.java new file mode 100644 index 00000000000..233b5a07ea3 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/ZBitTest.java @@ -0,0 +1,49 @@ +/* + * 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 ZBitTest extends AbstractAssetTest { + + public ZBitTest() { + super(new ZBit()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("8Hu897ivzmeFuLNB6956X6gyGeVNHUBRgD"); + assertValidAddress("81HwTdCmQV3NspP2QqCGpehoFpi8NY4Zg3"); + assertValidAddress("8Hu897ivzmeFuLNB6956X6gyGfhj676784"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress(""); + assertInvalidAddress("8"); + assertInvalidAddress("822FRU9f3fx7Hty641D5cg95kRK6sH0rT"); + assertInvalidAddress("822FRU9f3fx7Hty641D5cg95kRK6S3sbfISTOOLONG"); + + assertInvalidAddress("MHu897ivzmeFuLNB6956X6gyGfhj676784"); + assertInvalidAddress("M"); + assertInvalidAddress("M22FRU9f3fx7Hty641D5cg95kRK6sH0rT"); + assertInvalidAddress("M22FRU9f3fx7Hty641D5cg95kRK6S3sbfISTOOLONG"); + } +}