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

List Nano (NANO) #32

Merged
merged 2 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/main/java/bisq/asset/coins/Nano.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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;

public class Nano extends Coin {

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
51 changes: 51 additions & 0 deletions src/test/java/bisq/asset/coins/NanoTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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;

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