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

List Wavi (WAVI) #36

Merged
merged 1 commit into from
Jun 22, 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
55 changes: 55 additions & 0 deletions src/main/java/bisq/asset/coins/Wavi.java
Original file line number Diff line number Diff line change
@@ -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 Wavi extends Coin {

public Wavi() {
super("Wavi", "WAVI", new WaviAddressValidator());
}


public static class WaviAddressValidator extends Base58BitcoinAddressValidator {

public WaviAddressValidator() {
super(new WaviParams());
}

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

return super.validate(address);
}
}

public static class WaviParams extends NetworkParametersAdapter {

public WaviParams() {
addressHeader = 73;
p2shHeader = 15;
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
}
}
}
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 @@ -98,6 +98,7 @@ bisq.asset.coins.Ubiq
bisq.asset.coins.Unobtanium
bisq.asset.coins.VDinar
bisq.asset.coins.Wacoin
bisq.asset.coins.Wavi
bisq.asset.coins.WorldMobileCoin
bisq.asset.coins.Wownero
bisq.asset.coins.Xuez
Expand Down
43 changes: 43 additions & 0 deletions src/test/java/bisq/asset/coins/WaviTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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 WaviTest extends AbstractAssetTest {

public WaviTest() {
super(new Wavi());
}

@Test
public void testValidAddresses() {
assertValidAddress("WbdqBhmbkhYSYpjzKFuWRKhw7k1tN1oNrr");
assertValidAddress("WU7HUe2RjxjKFWXmNVWyeYvByfWyefp8tZ");
}

@Test
public void testInvalidAddresses() {
assertInvalidAddress("69dqBhmbkhYSYpjzKFuWRKhw7k1tN1oNrr");
assertInvalidAddress("WbdqBhmbkhYSYpjzKFuWRKhw7k1tN1oNrr37");
assertInvalidAddress("WU7HUe2RjxjKFWXmNVWyeYvByfWyefp869");
assertInvalidAddress("Qc7HUe2RjxjKFWXmNVWyeYvByfWyefp8tZ");
}
}