Skip to content

Commit

Permalink
Merge pull request #3110 from oneiro-ndev/list-ndau
Browse files Browse the repository at this point in the history
List Ndau (XND)
  • Loading branch information
ripcurlx authored Oct 18, 2019
2 parents 1557a7b + 1e40bb0 commit c91c40c
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
37 changes: 37 additions & 0 deletions assets/src/main/java/bisq/asset/coins/Ndau.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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/>.
*/

/*
* Copyright © 2019 Oneiro NA, Inc.
*/

package bisq.asset.coins;

import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;


public class Ndau extends Coin {

public Ndau() {
// note: ndau addresses contain an internal checksum which was deemed too complicated to include here.
// this regex performs superficial validation, but there is a large space of addresses marked valid
// by this regex which are not in fact valid ndau addresses. For actual ndau address validation,
// use the Address class in github.com/oneiro-ndev/ndauj (java) or github.com/oneiro-ndev/ndaumath/pkg/address (go).
super("ndau", "XND", new RegexAddressValidator("nd[anexbm][abcdefghijkmnpqrstuvwxyz23456789]{45}"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ bisq.asset.coins.MoX
bisq.asset.coins.Myce
bisq.asset.coins.Namecoin
bisq.asset.coins.Navcoin
bisq.asset.coins.Ndau
bisq.asset.coins.Noir
bisq.asset.coins.NoteBlockchain
bisq.asset.coins.ParsiCoin
Expand Down
50 changes: 50 additions & 0 deletions assets/src/test/java/bisq/asset/coins/NdauTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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/>.
*/

/*
* Copyright © 2019 Oneiro NA, Inc.
*/

package bisq.asset.coins;

import bisq.asset.AbstractAssetTest;

import org.junit.Test;

public class NdauTest extends AbstractAssetTest {
public NdauTest() {super(new Ndau());}

@Test
public void testValidAddresses() {
assertValidAddress("ndaaacj4gbv5xgwikt6adcujqyvd37ksadj4mg9v3jqtbe9f");
assertValidAddress("ndnbeju3vmcxf9n96rb652eaeri79anqz47budnw8vwv3nyv");
assertValidAddress("ndeatpdkx5stu28n3v6pie96bma5k8pzbvbdpu8dchyn46nw");
assertValidAddress("ndxix97gyubjrkqbu4a5m3kpxyz4qhap3c3ui7359pzskwv4");
assertValidAddress("ndbjhkkcvj88beqcamr439z6d6icm5mjwth5r7vrgfbnxktr");
assertValidAddress("ndmpdkab97bi4ea73scjh6xpt8njjjhha4rarpr2zzzrv88u");
}

@Test
public void testInvalidAddresses() {
assertInvalidAddress("ndaaacj4gbv5xgwikt6adcujqyvd37ksadj4mg9v3jqtbe9");
assertInvalidAddress("ndnbeju3vmcxf9n96rb652eaeri79anqz47budnw8vwv3nyvw");
assertInvalidAddress("ndpatpdkx5stu28n3v6pie96bma5k8pzbvbdpu8dchyn46nw");
assertInvalidAddress("ndx1x97gyubjrkqbu4a5m3kpxyz4qhap3c3ui7359pzskwv4");
assertInvalidAddress("ndbjhklcvj88beqcamr439z6d6icm5mjwth5r7vrgfbnxktr");
assertInvalidAddress("ndmpdkab97bi4ea73scjh6xpt8njjjhhaArarpr2zzzrv88u");
}
}

0 comments on commit c91c40c

Please sign in to comment.