Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Commit

Permalink
List Nano (NANO)
Browse files Browse the repository at this point in the history
  • Loading branch information
n9Mtq4 committed Jun 28, 2018
1 parent ef62dc3 commit e040cc0
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/main/java/bisq/asset/coins/Nano.java
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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));
}

}
1 change: 1 addition & 0 deletions src/main/resources/META-INF/services/bisq.asset.Asset
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 57 additions & 0 deletions src/test/java/bisq/asset/coins/NanoTest.java
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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
}

}

0 comments on commit e040cc0

Please sign in to comment.