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

Commit

Permalink
List BitCloud (BTDX)
Browse files Browse the repository at this point in the history
  • Loading branch information
dalijolijo committed May 28, 2018
1 parent 87036ca commit 44f04cd
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/main/java/bisq/asset/coins/BitCloud.java
@@ -0,0 +1,55 @@
/*
* 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.AddressValidationResult;
import bisq.asset.Base58BitcoinAddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;

public class BitCloud extends Coin {

public BitCloud() {
super("BitCloud", "BTDX", new BitCloudAddressValidator());
}


public static class BitCloudAddressValidator extends Base58BitcoinAddressValidator {

public BitCloudAddressValidator() {
super(new BitCloudParams());
}

@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[B][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
return AddressValidationResult.invalidStructure();

return super.validate(address);
}
}

public static class BitCloudParams extends NetworkParametersAdapter {

public BitCloudParams() {
addressHeader = 25;
p2shHeader = 5;
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/META-INF/services/bisq.asset.Asset
Expand Up @@ -6,6 +6,7 @@ bisq.asset.coins.Achievecoin
bisq.asset.coins.Angelcoin
bisq.asset.coins.Aquachain
bisq.asset.coins.Arto
bisq.asset.coins.BitCloud
bisq.asset.coins.BitcoinCash
bisq.asset.coins.BitcoinClashic
bisq.asset.coins.BitcoinCore
Expand Down
44 changes: 44 additions & 0 deletions src/test/java/bisq/asset/coins/BitCloudTest.java
@@ -0,0 +1,44 @@
/*
* 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;

import org.junit.Test;

public class BitCloudTest extends AbstractAssetTest {

public BitCloudTest() {
super(new BitCloud());
}

@Test
public void testValidAddresses() {
assertValidAddress("B7dtuCkeYcQQiTdr9wAK7HZtmvvrM24jEH");
assertValidAddress("BGp8DmF5wwpaDUsK9Mi3SByTDuvgy6XJGS");
assertValidAddress("BDL6jpyNge8VB8LL8dEDX1bxfZ3jHGYzS3");
assertValidAddress("BKuvEvMrXmPFPC3YGGHHnZoTVYxeddxAjC");
}

@Test
public void testInvalidAddresses() {
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
}
}

0 comments on commit 44f04cd

Please sign in to comment.