From 5a8c95a2f68abbffbd1955b4a86fea034d4ede3b Mon Sep 17 00:00:00 2001 From: Khaled Alam Date: Thu, 27 Dec 2018 23:11:32 +0200 Subject: [PATCH] List Webchain (WEB) --- .../main/java/bisq/asset/coins/Webchain.java | 29 ++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../java/bisq/asset/coins/WebchainTest.java | 46 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 assets/src/main/java/bisq/asset/coins/Webchain.java create mode 100644 assets/src/test/java/bisq/asset/coins/WebchainTest.java diff --git a/assets/src/main/java/bisq/asset/coins/Webchain.java b/assets/src/main/java/bisq/asset/coins/Webchain.java new file mode 100644 index 00000000000..38c90b23621 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Webchain.java @@ -0,0 +1,29 @@ +/* + * 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 Webchain extends Coin { + + public Webchain() { + super("Webchain", "WEB", new RegexAddressValidator("^0x[0-9a-fA-F]{40}$")); + } +} + 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 5d537067eef..2c3215df4b3 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -55,6 +55,7 @@ bisq.asset.coins.SUB1X bisq.asset.coins.TurtleCoin bisq.asset.coins.UnitedCommunityCoin bisq.asset.coins.Unobtanium +bisq.asset.coins.Webchain bisq.asset.coins.Zcash bisq.asset.coins.Zcoin bisq.asset.coins.Zero diff --git a/assets/src/test/java/bisq/asset/coins/WebchainTest.java b/assets/src/test/java/bisq/asset/coins/WebchainTest.java new file mode 100644 index 00000000000..4cee0c62782 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/WebchainTest.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 WebchainTest extends AbstractAssetTest { + + public WebchainTest() { + super(new Webchain()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("0x8d1ba0497c3e3db17143604ab7f5e93a3cbac68b"); + assertValidAddress("0x23c9c5ae8c854e9634a610af82924a5366a360a3"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress(""); + assertInvalidAddress("8d1ba0497c3e3db17143604ab7f5e93a3cbac68b"); + assertInvalidAddress("0x8d1ba0497c3e3db17143604ab7f5e93a3cbac68"); + assertInvalidAddress("0x8d1ba0497c3e3db17143604ab7f5e93a3cbac68k"); + assertInvalidAddress("098d1ba0497c3e3db17143604ab7f5e93a3cbac68b"); + assertInvalidAddress("098d1ba0497c3e3db17143604ab7f5e93a3cbac68b"); + } +} +