From 65ac486e2a6007796477bfcc115ab12c663ddae6 Mon Sep 17 00:00:00 2001 From: Lilith645 Date: Sun, 27 Oct 2019 17:25:56 +1000 Subject: [PATCH] List ZBit (ZBT) --- .../src/main/java/bisq/asset/coins/ZBit.java | 38 +++++++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../test/java/bisq/asset/coins/ZBitTest.java | 41 +++++++++++++++++++ 3 files changed, 80 insertions(+) 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..f2e1ceccaad --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/ZBit.java @@ -0,0 +1,38 @@ +/* + * 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 ZbtAddressValidator()); + } + + public static class ZbtAddressValidator extends RegexAddressValidator { + + public ZbtAddressValidator() { + super("^a?[a-zA-Z0-9]{33}", I18n.DISPLAY_STRINGS.getString("account.altcoin.popup.validation.ZBT")); + } + } +} 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/test/java/bisq/asset/coins/ZBitTest.java b/assets/src/test/java/bisq/asset/coins/ZBitTest.java new file mode 100644 index 00000000000..7588fe08cfa --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/ZBitTest.java @@ -0,0 +1,41 @@ +/* + * 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; + +public class ZBitTest extends AbstractAssetTest { + + public ZBitTest() { + super(new ZBit()); + } + + @Override + public void testValidAddresses() { + assertValidAddress("8Hu897ivzmeFuLNB6956X6gyGeVNHUBRgD"); + assertValidAddress("81HwTdCmQV3NspP2QqCGpehoFpi8NY4Zg3"); + assertValidAddress("8Hu897ivzmeFuLNB6956X6gyGeVNHUBRgD"); + } + + @Override + public void testInvalidAddresses() { + assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); + assertInvalidAddress("N22FRU9f3fx7Hty641D5cg95kRK6S3sbf3"); + assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); + } +}