From 1670e404ee264a2b9cb4c7a4ac0acdcb6b4c8f9e Mon Sep 17 00:00:00 2001 From: wrkzdev <40448869+wrkzdev@users.noreply.github.com> Date: Sun, 23 Dec 2018 20:31:22 -0500 Subject: [PATCH] List WrkzCoin (WRKZ) Author: wrkzdev <40448869+wrkzdev@users.noreply.github.com> Date: Wed Dec 19 21:44:27 2018 +0700 --- .../main/java/bisq/asset/coins/WrkzCoin.java | 28 +++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../java/bisq/asset/coins/WrkzCoinTest.java | 46 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 assets/src/main/java/bisq/asset/coins/WrkzCoin.java create mode 100644 assets/src/test/java/bisq/asset/coins/WrkzCoinTest.java diff --git a/assets/src/main/java/bisq/asset/coins/WrkzCoin.java b/assets/src/main/java/bisq/asset/coins/WrkzCoin.java new file mode 100644 index 00000000000..69d20360b68 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/WrkzCoin.java @@ -0,0 +1,28 @@ +/* + * 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.Coin; +import bisq.asset.RegexAddressValidator; + +public class WrkzCoin extends Coin { + + public WrkzCoin() { + super("WrkzCoin", "WRKZ", new RegexAddressValidator("^Wrkz[1-9A-Za-z^OIl]{94}")); + } +} 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 ed964bfcc88..ec1d49ea47f 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -57,6 +57,7 @@ bisq.asset.coins.TurtleCoin bisq.asset.coins.UnitedCommunityCoin bisq.asset.coins.Unobtanium bisq.asset.coins.Webchain +bisq.asset.coins.WrkzCoin bisq.asset.coins.Zcash bisq.asset.coins.Zcoin bisq.asset.coins.Zero diff --git a/assets/src/test/java/bisq/asset/coins/WrkzCoinTest.java b/assets/src/test/java/bisq/asset/coins/WrkzCoinTest.java new file mode 100644 index 00000000000..3647f5cb278 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/WrkzCoinTest.java @@ -0,0 +1,46 @@ +/* + * 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 WrkzCoinTest extends AbstractAssetTest { + + public WrkzCoinTest() { + super(new WrkzCoin()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("WrkzjsomAAfH8kotfaTyVYfya7PNQt2oL4regF1VpTV9TSezdyxcQpRW2jGptwPP6zLgQUa7Lem1dBWfGM7LfJqs719UZhX9Hg"); + assertValidAddress("WrkzpRgV26G8p8FUfFzaYbd15Nmq3SsRSVbG8yPjvt4W4D5KBHTV2RHbzQVE1TAt1NV21Tp6xiFATJT8QXoxeEUQ8DPY1Zkjnf"); + assertValidAddress("WrkzmetNqgJG5SwtaVhyTxijdx6JGtUeHELTpwfgC9Ym1Ps4JdQtanXLK8Xk5TeMUTEbsmDJ8taXYiyYZpPHSg5X1wC8ij7fdG"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("WrkzQokcStLUSALE5Ra17v2n6ad65h8wL5vqABKkoWy7Xicz9znqPSgS2MRVkuYtRAaJiMFuyDCFF1oJgT7PHb8i9yM"); + assertInvalidAddress("WrkskixT63cYzLFmDoA5WN7RbihYBwbzJJmjR9zgjD3ZUotbFGBgv1RaUAu1fWWT4QeEEktQfZK9AFPh19t2U8uG49EH3WSVEn"); + assertInvalidAddress(""); + assertInvalidAddress("WrkzUAxg9TSdkh6tfh5pk84XgKeyNe8T4TvaSgk87kk6iCUEitkk2sk6wVtKJXk5BM3kwh2ftnkaVfBWfBPr8igZ2xkn#RoUxF"); + assertInvalidAddress("WrkzXTU4REbRijuLPpds2k4BhcBGgXFpeEaXKs49D7$PFuqBYpQw2tQbAApoQLAp2iWVsoxiPmcERXhHrhtCLnzL4ezB8kAbxH"); + assertInvalidAddress("cccd2bd37455350e7586cf9315c7f3acd3de56321aa356ff3391bd21f0bbf502"); + } +}