From e040cc02fb9f3ad6d47e8e9f97e9efc6a3a0eec8 Mon Sep 17 00:00:00 2001 From: Will Bresnahan Date: Sat, 9 Jun 2018 01:58:19 -0400 Subject: [PATCH 1/2] List Nano (NANO) --- src/main/java/bisq/asset/coins/Nano.java | 38 +++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + src/test/java/bisq/asset/coins/NanoTest.java | 57 +++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 src/main/java/bisq/asset/coins/Nano.java create mode 100644 src/test/java/bisq/asset/coins/NanoTest.java diff --git a/src/main/java/bisq/asset/coins/Nano.java b/src/main/java/bisq/asset/coins/Nano.java new file mode 100644 index 0000000..46d11cc --- /dev/null +++ b/src/main/java/bisq/asset/coins/Nano.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.Coin; +import bisq.asset.RegexAddressValidator; +import org.intellij.lang.annotations.Language; + +/** + * Created by will on 6/8/18 at 11:52 PM. + * + * @author Will "n9Mtq4" Bresnahan + */ +public class Nano extends Coin { + + @Language("RegExp") + private static final String NANO_REGEX = "^(nano_|xrb_)[13456789abcdefghijkmnopqrstuwxyz]{60}"; + + public Nano() { + super("Nano", "NANO", new RegexAddressValidator(NANO_REGEX)); + } + +} diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index 445a4f4..4dc22f8 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -64,6 +64,7 @@ bisq.asset.coins.MFCoin bisq.asset.coins.MicroCoin bisq.asset.coins.Monero bisq.asset.coins.Namecoin +bisq.asset.coins.Nano bisq.asset.coins.NavCoin bisq.asset.coins.NEETCOIN bisq.asset.coins.Nilu diff --git a/src/test/java/bisq/asset/coins/NanoTest.java b/src/test/java/bisq/asset/coins/NanoTest.java new file mode 100644 index 0000000..186c9f3 --- /dev/null +++ b/src/test/java/bisq/asset/coins/NanoTest.java @@ -0,0 +1,57 @@ +/* + * 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; + +/** + * Created by will on 6/9/18 at 12:03 AM. + * + * @author Will "n9Mtq4" Bresnahan + */ +public class NanoTest extends AbstractAssetTest { + + public NanoTest() { + super(new Nano()); + } + + @Override + public void testValidAddresses() { + assertValidAddress("xrb_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3"); + assertValidAddress("xrb_35jjmmmh81kydepzeuf9oec8hzkay7msr6yxagzxpcht7thwa5bus5tomgz9"); + assertValidAddress("xrb_1111111111111111111111111111111111111111111111111111hifc8npp"); + assertValidAddress("nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3"); + assertValidAddress("nano_35jjmmmh81kydepzeuf9oec8hzkay7msr6yxagzxpcht7thwa5bus5tomgz9"); + assertValidAddress("nano_1111111111111111111111111111111111111111111111111111hifc8npp"); + } + + @Override + public void testInvalidAddresses() { + assertInvalidAddress("abc_1111111111111111111111111111111111111111111111111111hifc8npp"); // invalid prefix + assertInvalidAddress("xrb_1211111111111111111111111111111111111111111111111111hifc8npp"); // invalid character + assertInvalidAddress("XRB_1111111111111111111111111111111111111111111111111111HIFC8NPX"); // not lowercase + assertInvalidAddress("xrb_1111111111111111111111111111111111111111111111111111111hifc8npp"); // too long + assertInvalidAddress("xrb_11111111111111111111111111111111111111111111111hifc8npp"); // too short + assertInvalidAddress("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"); // not a nano address + assertInvalidAddress("just completely wrong"); // not an address + // checksum tests + // assertInvalidAddress("xrb_1111111111111111111111111111111111111111111111111111hifc8npx"); // invalid checksum + // assertInvalidAddress("xrb_1311111111111111111111111111111111111111111111111111hifc8npp"); // invalid checksum + } + +} From 62f664c464e83e162c909d75011c706daa34b0f3 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Thu, 28 Jun 2018 10:14:54 +0200 Subject: [PATCH 2/2] Apply code style --- src/main/java/bisq/asset/coins/Nano.java | 8 -------- src/test/java/bisq/asset/coins/NanoTest.java | 6 ------ 2 files changed, 14 deletions(-) diff --git a/src/main/java/bisq/asset/coins/Nano.java b/src/main/java/bisq/asset/coins/Nano.java index 46d11cc..ed0c957 100644 --- a/src/main/java/bisq/asset/coins/Nano.java +++ b/src/main/java/bisq/asset/coins/Nano.java @@ -19,20 +19,12 @@ import bisq.asset.Coin; import bisq.asset.RegexAddressValidator; -import org.intellij.lang.annotations.Language; -/** - * Created by will on 6/8/18 at 11:52 PM. - * - * @author Will "n9Mtq4" Bresnahan - */ public class Nano extends Coin { - @Language("RegExp") private static final String NANO_REGEX = "^(nano_|xrb_)[13456789abcdefghijkmnopqrstuwxyz]{60}"; public Nano() { super("Nano", "NANO", new RegexAddressValidator(NANO_REGEX)); } - } diff --git a/src/test/java/bisq/asset/coins/NanoTest.java b/src/test/java/bisq/asset/coins/NanoTest.java index 186c9f3..7d62d16 100644 --- a/src/test/java/bisq/asset/coins/NanoTest.java +++ b/src/test/java/bisq/asset/coins/NanoTest.java @@ -19,11 +19,6 @@ import bisq.asset.AbstractAssetTest; -/** - * Created by will on 6/9/18 at 12:03 AM. - * - * @author Will "n9Mtq4" Bresnahan - */ public class NanoTest extends AbstractAssetTest { public NanoTest() { @@ -53,5 +48,4 @@ public void testInvalidAddresses() { // assertInvalidAddress("xrb_1111111111111111111111111111111111111111111111111111hifc8npx"); // invalid checksum // assertInvalidAddress("xrb_1311111111111111111111111111111111111111111111111111hifc8npp"); // invalid checksum } - }