diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index af939e65..76e08734 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -25,6 +25,8 @@
+
+
diff --git a/src/main/java/bisq/asset/AbstractAsset.java b/src/main/java/bisq/asset/AbstractAsset.java
new file mode 100644
index 00000000..3cabaa2e
--- /dev/null
+++ b/src/main/java/bisq/asset/AbstractAsset.java
@@ -0,0 +1,62 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+import static org.apache.commons.lang3.Validate.notBlank;
+import static org.apache.commons.lang3.Validate.notNull;
+
+/**
+ * Abstract base class for {@link Asset} implementations. Most implementations should not
+ * extend this class directly, but should rather extend {@link Coin}, {@link Token} or one
+ * of their subtypes.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+public abstract class AbstractAsset implements Asset {
+
+ private final String name;
+ private final String tickerSymbol;
+ private final AddressValidator addressValidator;
+
+ public AbstractAsset(String name, String tickerSymbol, AddressValidator addressValidator) {
+ this.name = notBlank(name);
+ this.tickerSymbol = notBlank(tickerSymbol);
+ this.addressValidator = notNull(addressValidator);
+ }
+
+ @Override
+ public final String getName() {
+ return name;
+ }
+
+ @Override
+ public final String getTickerSymbol() {
+ return tickerSymbol;
+ }
+
+ @Override
+ public final AddressValidationResult validateAddress(String address) {
+ return addressValidator.validate(address);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getName();
+ }
+}
diff --git a/src/main/java/bisq/asset/AddressValidationResult.java b/src/main/java/bisq/asset/AddressValidationResult.java
new file mode 100644
index 00000000..04abb184
--- /dev/null
+++ b/src/main/java/bisq/asset/AddressValidationResult.java
@@ -0,0 +1,73 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+/**
+ * Value object representing the result of validating an {@link Asset} address. Various
+ * factory methods are provided for typical use cases.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ * @see Asset#validateAddress(String)
+ */
+public class AddressValidationResult {
+
+ private static AddressValidationResult VALID_ADDRESS = new AddressValidationResult(true, "", "");
+
+ private final boolean isValid;
+ private final String message;
+ private final String i18nKey;
+
+ private AddressValidationResult(boolean isValid, String message, String i18nKey) {
+ this.isValid = isValid;
+ this.message = message;
+ this.i18nKey = i18nKey;
+ }
+
+ public boolean isValid() {
+ return isValid;
+ }
+
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public static AddressValidationResult validAddress() {
+ return VALID_ADDRESS;
+ }
+
+ public static AddressValidationResult invalidAddress(Throwable cause) {
+ return invalidAddress(cause.getMessage());
+ }
+
+ public static AddressValidationResult invalidAddress(String cause) {
+ return invalidAddress(cause, "validation.altcoin.invalidAddress");
+ }
+
+ public static AddressValidationResult invalidAddress(String cause, String i18nKey) {
+ return new AddressValidationResult(false, cause, i18nKey);
+ }
+
+ public static AddressValidationResult invalidStructure() {
+ return invalidAddress("", "validation.altcoin.wrongStructure");
+ }
+}
diff --git a/src/main/java/bisq/asset/AddressValidator.java b/src/main/java/bisq/asset/AddressValidator.java
new file mode 100644
index 00000000..8cf65608
--- /dev/null
+++ b/src/main/java/bisq/asset/AddressValidator.java
@@ -0,0 +1,29 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+/**
+ * An {@link Asset} address validation function.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+public interface AddressValidator {
+
+ AddressValidationResult validate(String address);
+}
diff --git a/src/main/java/bisq/asset/Asset.java b/src/main/java/bisq/asset/Asset.java
new file mode 100644
index 00000000..b67d0376
--- /dev/null
+++ b/src/main/java/bisq/asset/Asset.java
@@ -0,0 +1,46 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+/**
+ * Interface representing a given ("crypto") asset in its most abstract form, having a
+ * {@link #getName() name}, e.g. "Bitcoin", a {@link #getTickerSymbol() ticker symbol},
+ * e.g. "BTC", and an address validation function. Together, these properties represent
+ * the minimum information and functionality required to register and trade an asset on
+ * the Bisq network.
+ *
+ * Implementations typically extend either the {@link Coin} or {@link Token} base
+ * classes, and must be registered in the {@code META-INF/services/bisq.asset.Asset} file
+ * in order to be available in the {@link AssetRegistry} at runtime.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ * @see AbstractAsset
+ * @see Coin
+ * @see Token
+ * @see Erc20Token
+ * @see AssetRegistry
+ */
+public interface Asset {
+
+ String getName();
+
+ String getTickerSymbol();
+
+ AddressValidationResult validateAddress(String address);
+}
diff --git a/src/main/java/bisq/asset/AssetRegistry.java b/src/main/java/bisq/asset/AssetRegistry.java
new file mode 100644
index 00000000..c6a0c7b3
--- /dev/null
+++ b/src/main/java/bisq/asset/AssetRegistry.java
@@ -0,0 +1,46 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.stream.Stream;
+
+/**
+ * Provides {@link Stream}-based access to {@link Asset} implementations registered in
+ * the {@code META-INF/services/bisq.asset.Asset} provider-configuration file.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ * @see ServiceLoader
+ */
+public class AssetRegistry {
+
+ private static final List registeredAssets = new ArrayList<>();
+
+ static {
+ for (Asset asset : ServiceLoader.load(Asset.class)) {
+ registeredAssets.add(asset);
+ }
+ }
+
+ public Stream stream() {
+ return registeredAssets.stream();
+ }
+}
diff --git a/src/main/java/bisq/asset/Base58BitcoinAddressValidator.java b/src/main/java/bisq/asset/Base58BitcoinAddressValidator.java
new file mode 100644
index 00000000..9a99385f
--- /dev/null
+++ b/src/main/java/bisq/asset/Base58BitcoinAddressValidator.java
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+import org.bitcoinj.core.Address;
+import org.bitcoinj.core.AddressFormatException;
+import org.bitcoinj.core.NetworkParameters;
+import org.bitcoinj.params.MainNetParams;
+
+/**
+ * {@link AddressValidator} for Base58-encoded Bitcoin addresses.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ * @see org.bitcoinj.core.Address#fromBase58(NetworkParameters, String)
+ */
+public class Base58BitcoinAddressValidator implements AddressValidator {
+
+ private final NetworkParameters networkParameters;
+
+ public Base58BitcoinAddressValidator() {
+ this(MainNetParams.get());
+ }
+
+ public Base58BitcoinAddressValidator(NetworkParameters networkParameters) {
+ this.networkParameters = networkParameters;
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ try {
+ Address.fromBase58(networkParameters, address);
+ } catch (AddressFormatException ex) {
+ return AddressValidationResult.invalidAddress(ex);
+ }
+
+ return AddressValidationResult.validAddress();
+ }
+}
diff --git a/src/main/java/bisq/asset/Coin.java b/src/main/java/bisq/asset/Coin.java
new file mode 100644
index 00000000..5eb596e4
--- /dev/null
+++ b/src/main/java/bisq/asset/Coin.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 .
+ */
+
+package bisq.asset;
+
+/**
+ * Abstract base class for {@link Asset}s with their own dedicated blockchain, such as
+ * {@link bisq.asset.coins.Bitcoin} itself or one of its many derivatives, competitors and
+ * alternatives, often called "altcoins", such as {@link bisq.asset.coins.Litecoin},
+ * {@link bisq.asset.coins.Ether}, {@link bisq.asset.coins.Monero} and
+ * {@link bisq.asset.coins.Zcash}.
+ *
+ * In addition to the usual {@code Asset} properties, a {@code Coin} maintains information
+ * about which {@link Network} it may be used on. By default, coins are constructed with
+ * the assumption they are for use on that coin's "main network", or "main blockchain",
+ * i.e. that they are "real" coins for use in a production environment. In testing
+ * scenarios, however, a coin may be constructed for use only on "testnet" or "regtest"
+ * networks.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+public abstract class Coin extends AbstractAsset {
+
+ public enum Network { MAINNET, TESTNET, REGTEST }
+
+ private final Network network;
+
+ public Coin(String name, String tickerSymbol, AddressValidator addressValidator) {
+ this(name, tickerSymbol, addressValidator, Network.MAINNET);
+ }
+
+ public Coin(String name, String tickerSymbol, AddressValidator addressValidator, Network network) {
+ super(name, tickerSymbol, addressValidator);
+ this.network = network;
+ }
+
+ public Network getNetwork() {
+ return network;
+ }
+}
diff --git a/src/main/java/bisq/asset/DefaultAddressValidator.java b/src/main/java/bisq/asset/DefaultAddressValidator.java
new file mode 100644
index 00000000..17131035
--- /dev/null
+++ b/src/main/java/bisq/asset/DefaultAddressValidator.java
@@ -0,0 +1,41 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+/**
+ * {@link AddressValidator} for use when no more specific address validation function is
+ * available. This implementation only checks that a given address is non-null and
+ * non-empty; it exists for legacy purposes and is deprecated to indicate that new
+ * {@link Asset} implementations should NOT use it, but should rather provide their own
+ * {@link AddressValidator} implementation.
+ *
+ * @author Chris Beams
+ * @author Bernard Labno
+ * @since 0.7.0
+ */
+@Deprecated
+public class DefaultAddressValidator implements AddressValidator {
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (address == null || address.length() == 0)
+ return AddressValidationResult.invalidAddress("Address may not be empty");
+
+ return AddressValidationResult.validAddress();
+ }
+}
diff --git a/src/main/java/bisq/asset/Erc20Token.java b/src/main/java/bisq/asset/Erc20Token.java
new file mode 100644
index 00000000..33213a65
--- /dev/null
+++ b/src/main/java/bisq/asset/Erc20Token.java
@@ -0,0 +1,33 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+/**
+ * Abstract base class for Ethereum-based {@link Token}s that implement the
+ * ERC-20 Token
+ * Standard.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+public abstract class Erc20Token extends Token {
+
+ public Erc20Token(String name, String tickerSymbol) {
+ super(name, tickerSymbol, new EtherAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/EtherAddressValidator.java b/src/main/java/bisq/asset/EtherAddressValidator.java
new file mode 100644
index 00000000..f646ed57
--- /dev/null
+++ b/src/main/java/bisq/asset/EtherAddressValidator.java
@@ -0,0 +1,36 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+/**
+ * Validates an Ethereum address using the regular expression on record in the
+ *
+ * ethereum/web3.js project. Note that this implementation is widely used, not just
+ * for actual {@link bisq.asset.coins.Ether} address validation, but also for
+ * {@link Erc20Token} implementations and other Ethereum-based {@link Asset}
+ * implementations.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+public class EtherAddressValidator extends RegexAddressValidator {
+
+ public EtherAddressValidator() {
+ super("^(0x)?[0-9a-fA-F]{40}$");
+ }
+}
diff --git a/src/main/java/bisq/core/payment/validation/params/PNCParams.java b/src/main/java/bisq/asset/NetworkParametersAdapter.java
similarity index 74%
rename from src/main/java/bisq/core/payment/validation/params/PNCParams.java
rename to src/main/java/bisq/asset/NetworkParametersAdapter.java
index 904e91a4..184b7dbf 100644
--- a/src/main/java/bisq/core/payment/validation/params/PNCParams.java
+++ b/src/main/java/bisq/asset/NetworkParametersAdapter.java
@@ -15,7 +15,7 @@
* along with Bisq. If not, see .
*/
-package bisq.core.payment.validation.params;
+package bisq.asset;
import org.bitcoinj.core.BitcoinSerializer;
import org.bitcoinj.core.Block;
@@ -24,26 +24,17 @@
import org.bitcoinj.core.StoredBlock;
import org.bitcoinj.core.VerificationException;
import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
import org.bitcoinj.utils.MonetaryFormat;
-public class PNCParams extends NetworkParameters {
-
- private static PNCParams instance;
-
- public static synchronized PNCParams get() {
- if (instance == null) {
- instance = new PNCParams();
- }
- return instance;
- }
-
- public PNCParams() {
- super();
- addressHeader = 55;
- p2shHeader = 5;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
+/**
+ * Convenient abstract {@link NetworkParameters} base class providing no-op
+ * implementations of all methods that are not required for address validation
+ * purposes.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+public abstract class NetworkParametersAdapter extends NetworkParameters {
@Override
public String getPaymentProtocolId() {
@@ -51,7 +42,8 @@ public String getPaymentProtocolId() {
}
@Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
+ public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore)
+ throws VerificationException {
}
@Override
@@ -88,5 +80,4 @@ public BitcoinSerializer getSerializer(boolean parseRetain) {
public int getProtocolVersionNum(ProtocolVersion version) {
return 0;
}
-
}
diff --git a/src/main/java/bisq/asset/RegexAddressValidator.java b/src/main/java/bisq/asset/RegexAddressValidator.java
new file mode 100644
index 00000000..38b5f13d
--- /dev/null
+++ b/src/main/java/bisq/asset/RegexAddressValidator.java
@@ -0,0 +1,41 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+/**
+ * Validates an {@link Asset} address against a given regular expression.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+public class RegexAddressValidator implements AddressValidator {
+
+ private final String regex;
+
+ public RegexAddressValidator(String regex) {
+ this.regex = regex;
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches(regex))
+ return AddressValidationResult.invalidStructure();
+
+ return AddressValidationResult.validAddress();
+ }
+}
diff --git a/src/main/java/bisq/asset/Token.java b/src/main/java/bisq/asset/Token.java
new file mode 100644
index 00000000..2c162e52
--- /dev/null
+++ b/src/main/java/bisq/asset/Token.java
@@ -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 .
+ */
+
+package bisq.asset;
+
+/**
+ * Abstract base class for {@link Asset}s that do not have their own dedicated blockchain,
+ * but are rather based on or derived from another blockchain. Contrast with {@link Coin}.
+ * Note that this is essentially a "marker" base class in the sense that it (currently)
+ * exposes no additional information or functionality beyond that found in
+ * {@link AbstractAsset}, but it is nevertheless useful in distinguishing between major
+ * different {@code Asset} types.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ * @see Erc20Token
+ */
+public abstract class Token extends AbstractAsset {
+
+ public Token(String name, String tickerSymbol, AddressValidator addressValidator) {
+ super(name, tickerSymbol, addressValidator);
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Achievecoin.java b/src/main/java/bisq/asset/coins/Achievecoin.java
new file mode 100644
index 00000000..726d0bdc
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Achievecoin.java
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+import org.bitcoinj.core.Utils;
+
+public class Achievecoin extends Coin {
+
+ public Achievecoin() {
+ super("AchieveCoin", "ACH", new Base58BitcoinAddressValidator(new AchievecoinParams()));
+ }
+
+
+ public static class AchievecoinParams extends NetworkParametersAdapter {
+
+ public AchievecoinParams() {
+ interval = INTERVAL;
+ targetTimespan = TARGET_TIMESPAN;
+ maxTarget = Utils.decodeCompactBits(0x1d00ffffL);
+ dumpedPrivateKeyHeader = 128;
+
+ // Address format is different to BTC, rest is the same
+ addressHeader = 23; //BTG 38;
+ p2shHeader = 34; //BTG 23;
+
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ port = 7337; //BTC and BTG 8333
+ packetMagic = 0x1461de3cL; //BTG 0xe1476d44L, BTC 0xf9beb4d9L;
+ bip32HeaderPub = 0x02651F71; //BTG and BTC 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub".
+ bip32HeaderPriv = 0x02355E56; //BTG and BTC 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv"
+
+ id = ID_MAINNET;
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Angelcoin.java b/src/main/java/bisq/asset/coins/Angelcoin.java
new file mode 100644
index 00000000..72ef9a33
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Angelcoin.java
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Angelcoin extends Coin {
+
+ public Angelcoin() {
+ super("Angelcoin", "ALC", new AngelcoinAddressValidator());
+ }
+
+ public static class AngelcoinAddressValidator extends Base58BitcoinAddressValidator {
+
+ public AngelcoinAddressValidator() {
+ super(new AngelcoinParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[A][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ return super.validate(address);
+ }
+ }
+
+ public static class AngelcoinParams extends NetworkParametersAdapter {
+
+ public AngelcoinParams() {
+ addressHeader = 23;
+ p2shHeader = 5;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Arto.java b/src/main/java/bisq/asset/coins/Arto.java
new file mode 100644
index 00000000..9e4b75e8
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Arto.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class Arto extends Coin {
+
+ public Arto() {
+ super("Arto", "RTO", new RegexAddressValidator("^[A][0-9A-Za-z]{94}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/BSQ.java b/src/main/java/bisq/asset/coins/BSQ.java
new file mode 100644
index 00000000..86f39f6e
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/BSQ.java
@@ -0,0 +1,76 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+
+import org.bitcoinj.core.NetworkParameters;
+import org.bitcoinj.params.MainNetParams;
+import org.bitcoinj.params.RegTestParams;
+import org.bitcoinj.params.TestNet3Params;
+
+public class BSQ extends Coin {
+
+ public BSQ(Network network, NetworkParameters networkParameters) {
+ super("BSQ", "BSQ", new BSQAddressValidator(networkParameters), network);
+ }
+
+
+ public static class Mainnet extends BSQ {
+
+ public Mainnet() {
+ super(Network.MAINNET, MainNetParams.get());
+ }
+ }
+
+
+ public static class Testnet extends BSQ {
+
+ public Testnet() {
+ super(Network.TESTNET, TestNet3Params.get());
+ }
+ }
+
+
+ public static class Regtest extends BSQ {
+
+ public Regtest() {
+ super(Network.REGTEST, RegTestParams.get());
+ }
+ }
+
+
+ public static class BSQAddressValidator extends Base58BitcoinAddressValidator {
+
+ public BSQAddressValidator(NetworkParameters networkParameters) {
+ super(networkParameters);
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.startsWith("B"))
+ return AddressValidationResult.invalidAddress("BSQ address must start with 'B'");
+
+ String addressAsBtc = address.substring(1, address.length());
+
+ return super.validate(addressAsBtc);
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/BitDaric.java b/src/main/java/bisq/asset/coins/BitDaric.java
new file mode 100644
index 00000000..a035d381
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/BitDaric.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class BitDaric extends Coin {
+
+ public BitDaric() {
+ super("BitDaric", "DARX", new RegexAddressValidator("^[R][a-km-zA-HJ-NP-Z1-9]{25,34}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Bitcoin.java b/src/main/java/bisq/asset/coins/Bitcoin.java
new file mode 100644
index 00000000..74154062
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Bitcoin.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+
+import org.bitcoinj.core.NetworkParameters;
+import org.bitcoinj.params.MainNetParams;
+import org.bitcoinj.params.RegTestParams;
+import org.bitcoinj.params.TestNet3Params;
+
+public abstract class Bitcoin extends Coin {
+
+ public Bitcoin(Network network, NetworkParameters networkParameters) {
+ super("Bitcoin", "BTC", new Base58BitcoinAddressValidator(networkParameters), network);
+ }
+
+
+ public static class Mainnet extends Bitcoin {
+
+ public Mainnet() {
+ super(Network.MAINNET, MainNetParams.get());
+ }
+ }
+
+
+ public static class Testnet extends Bitcoin {
+
+ public Testnet() {
+ super(Network.TESTNET, TestNet3Params.get());
+ }
+ }
+
+
+ public static class Regtest extends Bitcoin {
+
+ public Regtest() {
+ super(Network.REGTEST, RegTestParams.get());
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/BitcoinCash.java b/src/main/java/bisq/asset/coins/BitcoinCash.java
new file mode 100644
index 00000000..b8a609ec
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/BitcoinCash.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+
+public class BitcoinCash extends Coin {
+
+ public BitcoinCash() {
+ super("Bitcoin Cash", "BCH", new Base58BitcoinAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/BitcoinClashic.java b/src/main/java/bisq/asset/coins/BitcoinClashic.java
new file mode 100644
index 00000000..2517213d
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/BitcoinClashic.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+
+public class BitcoinClashic extends Coin {
+
+ public BitcoinClashic() {
+ super("Bitcoin Clashic", "BCHC", new Base58BitcoinAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/BitcoinGold.java b/src/main/java/bisq/asset/coins/BitcoinGold.java
new file mode 100644
index 00000000..95ad7706
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/BitcoinGold.java
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+import org.bitcoinj.core.Utils;
+
+public class BitcoinGold extends Coin {
+
+ public BitcoinGold() {
+ super("Bitcoin Gold", "BTG", new Base58BitcoinAddressValidator(new BitcoinGoldParams()));
+ }
+
+
+ private static class BitcoinGoldParams extends NetworkParametersAdapter {
+
+ public BitcoinGoldParams() {
+ interval = INTERVAL;
+ targetTimespan = TARGET_TIMESPAN;
+ maxTarget = Utils.decodeCompactBits(0x1d00ffffL);
+ dumpedPrivateKeyHeader = 128;
+
+ // Address format is different to BTC, rest is the same
+ addressHeader = 38;
+ p2shHeader = 23;
+
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ port = 8333;
+ packetMagic = 0xf9beb4d9L;
+ bip32HeaderPub = 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub".
+ bip32HeaderPriv = 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv"
+
+ id = ID_MAINNET;
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Burstcoin.java b/src/main/java/bisq/asset/coins/Burstcoin.java
new file mode 100644
index 00000000..f3f4bc74
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Burstcoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Burstcoin extends Coin {
+
+ public Burstcoin() {
+ super("Burstcoin", "BURST", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Byteball.java b/src/main/java/bisq/asset/coins/Byteball.java
new file mode 100644
index 00000000..d4baec09
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Byteball.java
@@ -0,0 +1,198 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+
+import org.apache.commons.codec.binary.Base32;
+import org.apache.commons.codec.binary.Base64;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Byteball extends Coin {
+
+ public Byteball() {
+ super("Byte", "GBYTE", new ByteballAddressValidator());
+ }
+
+
+ public static class ByteballAddressValidator implements AddressValidator {
+ private static final Base32 base32 = new Base32();
+ private static final Base64 base64 = new Base64();
+ private static final String PI = "14159265358979323846264338327950288419716939937510";
+ private static final String[] arrRelativeOffsets = PI.split("");
+ @SuppressWarnings("CanBeFinal")
+ private static Integer[] arrOffsets160;
+ @SuppressWarnings("CanBeFinal")
+ private static Integer[] arrOffsets288;
+
+ static {
+ try {
+ arrOffsets160 = calcOffsets(160);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ arrOffsets288 = calcOffsets(288);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public AddressValidationResult validate(String input) {
+ if (!isValidAddress(input)) {
+ return AddressValidationResult.invalidStructure();
+ }
+ return AddressValidationResult.validAddress();
+ }
+
+ private static boolean isValidAddress(String address) {
+ return isValidChash(address, 32);
+ }
+
+ private static boolean isValidChash(String str, int len) {
+ return (isStringOfLength(str, len) && isChashValid(str));
+ }
+
+ private static boolean isStringOfLength(String str, int len) {
+ return str.length() == len;
+ }
+
+ private static void checkLength(int chash_length) throws Exception {
+ if (chash_length != 160 && chash_length != 288)
+ throw new Exception("unsupported c-hash length: " + chash_length);
+ }
+
+ private static Integer[] calcOffsets(int chash_length) throws Exception {
+ checkLength(chash_length);
+ List arrOffsets = new ArrayList<>(chash_length);
+ int offset = 0;
+ int index = 0;
+
+ for (int i = 0; offset < chash_length; i++) {
+ int relative_offset = Integer.parseInt(arrRelativeOffsets[i]);
+ if (relative_offset == 0)
+ continue;
+ offset += relative_offset;
+ if (chash_length == 288)
+ offset += 4;
+ if (offset >= chash_length)
+ break;
+ arrOffsets.add(offset);
+ //console.log("index="+index+", offset="+offset);
+ index++;
+ }
+
+ if (index != 32)
+ throw new Exception("wrong number of checksum bits");
+
+ //noinspection ToArrayCallWithZeroLengthArrayArgument
+ return arrOffsets.toArray(new Integer[0]);
+ }
+
+ private static ByteballAddressValidator.SeparatedData separateIntoCleanDataAndChecksum(String bin)
+ throws Exception {
+
+ int len = bin.length();
+ Integer[] arrOffsets;
+ if (len == 160)
+ arrOffsets = arrOffsets160;
+ else if (len == 288)
+ arrOffsets = arrOffsets288;
+ else
+ throw new Exception("bad length");
+ StringBuilder arrFrags = new StringBuilder();
+ StringBuilder arrChecksumBits = new StringBuilder();
+ int start = 0;
+ //noinspection ForLoopReplaceableByForEach
+ for (int i = 0; i < arrOffsets.length; i++) {
+ arrFrags.append(bin.substring(start, arrOffsets[i]));
+ arrChecksumBits.append(bin.substring(arrOffsets[i], arrOffsets[i] + 1));
+ start = arrOffsets[i] + 1;
+ }
+ // add last frag
+ if (start < bin.length())
+ arrFrags.append(bin.substring(start));
+ String binCleanData = arrFrags.toString();
+ String binChecksum = arrChecksumBits.toString();
+ return new ByteballAddressValidator.SeparatedData(binCleanData, binChecksum);
+ }
+
+ private static String buffer2bin(byte[] buf) {
+ StringBuilder bytes = new StringBuilder();
+ //noinspection ForLoopReplaceableByForEach
+ for (int i = 0; i < buf.length; i++) {
+ String bin = String.format("%8s", Integer.toBinaryString(buf[i] & 0xFF)).replace(' ', '0');
+ bytes.append(bin);
+ }
+ return bytes.toString();
+ }
+
+ private static byte[] bin2buffer(String bin) {
+ int len = bin.length() / 8;
+ byte[] buf = new byte[len];
+ for (int i = 0; i < len; i++)
+ buf[i] = (byte) Integer.parseInt(bin.substring(i * 8, (i + 1) * 8), 2);
+ return buf;
+ }
+
+ private static boolean isChashValid(String encoded) {
+ int encoded_len = encoded.length();
+ if (encoded_len != 32 && encoded_len != 48) // 160/5 = 32, 288/6 = 48
+ return false;
+ byte[] chash = (encoded_len == 32) ? base32.decode(encoded) : base64.decode(encoded);
+ String binChash = buffer2bin(chash);
+ ByteballAddressValidator.SeparatedData separated;
+ try {
+ separated = separateIntoCleanDataAndChecksum(binChash);
+ } catch (Exception e) {
+ return false;
+ }
+ byte[] clean_data = bin2buffer(separated.clean_data);
+ byte[] checksum = bin2buffer(separated.checksum);
+ return Arrays.equals(getChecksum(clean_data), checksum);
+ }
+
+ private static byte[] getChecksum(byte[] clean_data) {
+
+ try {
+ byte[] full_checksum = MessageDigest.getInstance("SHA-256").digest(clean_data);
+ return new byte[]{full_checksum[5], full_checksum[13], full_checksum[21], full_checksum[29]};
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ }
+
+ private static class SeparatedData {
+ final String clean_data;
+ final String checksum;
+
+ public SeparatedData(String clean_data, String checksum) {
+ this.clean_data = clean_data;
+ this.checksum = checksum;
+ }
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Cagecoin.java b/src/main/java/bisq/asset/coins/Cagecoin.java
new file mode 100644
index 00000000..2511ce62
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Cagecoin.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Cagecoin extends Coin {
+
+ public Cagecoin() {
+ super("Cagecoin", "CAGE", new CagecoinAddressValidator());
+ }
+
+
+ public static class CagecoinAddressValidator extends Base58BitcoinAddressValidator {
+
+ public CagecoinAddressValidator() {
+ super(new CagecoinParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[D][a-zA-Z0-9]{26,34}$"))
+ return AddressValidationResult.invalidStructure();
+ return super.validate(address);
+ }
+ }
+
+
+ public static class CagecoinParams extends NetworkParametersAdapter {
+
+ public CagecoinParams() {
+ addressHeader = 31;
+ p2shHeader = 13;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/CassubianDetk.java b/src/main/java/bisq/asset/coins/CassubianDetk.java
new file mode 100644
index 00000000..786e66e0
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/CassubianDetk.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class CassubianDetk extends Coin {
+
+ public CassubianDetk() {
+ super("Cassubian Detk", "CDT", new RegexAddressValidator("^D.*"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Counterparty.java b/src/main/java/bisq/asset/coins/Counterparty.java
new file mode 100644
index 00000000..d08542fc
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Counterparty.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Counterparty extends Coin {
+
+ public Counterparty() {
+ super("Counterparty", "XCP", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Creativecoin.java b/src/main/java/bisq/asset/coins/Creativecoin.java
new file mode 100644
index 00000000..aebe324b
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Creativecoin.java
@@ -0,0 +1,40 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Creativecoin extends Coin {
+
+ public Creativecoin() {
+ super("Creativecoin", "CREA", new Base58BitcoinAddressValidator(new CreativecoinParams()));
+ }
+
+
+ public static class CreativecoinParams extends NetworkParametersAdapter {
+
+ public CreativecoinParams() {
+ int segwitHeader = 35;
+ addressHeader = 28;
+ p2shHeader = 5;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader, segwitHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Cryptonite.java b/src/main/java/bisq/asset/coins/Cryptonite.java
new file mode 100644
index 00000000..33560f1b
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Cryptonite.java
@@ -0,0 +1,92 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import java.util.Arrays;
+
+public class Cryptonite extends Coin {
+
+ public Cryptonite() {
+ super("Cryptonite", "XCN", new CryptoniteAddressValidator());
+ }
+
+
+ public static class CryptoniteAddressValidator implements AddressValidator {
+
+ private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ // https://bitcointalk.org/index.php?topic=1801595
+ if (address.length() != 34)
+ return AddressValidationResult.invalidAddress("XCN_Addr_Invalid: Length must be 34!");
+
+ if (!address.startsWith("C"))
+ return AddressValidationResult.invalidAddress("XCN_Addr_Invalid: must start with 'C'!");
+
+ byte[] decoded = decodeBase58(address);
+ if (decoded == null)
+ return AddressValidationResult.invalidAddress("XCN_Addr_Invalid: Base58 decoder error!");
+
+ byte[] hash = getSha256(decoded, 21, 2);
+ if (hash == null || !Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 21, 25)))
+ return AddressValidationResult.invalidAddress("XCN_Addr_Invalid: Checksum error!");
+
+ return AddressValidationResult.validAddress();
+ }
+
+ private static byte[] decodeBase58(String input) {
+ byte[] output = new byte[25];
+ for (int i = 0; i < input.length(); i++) {
+ char t = input.charAt(i);
+
+ int p = ALPHABET.indexOf(t);
+ if (p == -1)
+ return null;
+ for (int j = 25 - 1; j >= 0; j--, p /= 256) {
+ p += 58 * (output[j] & 0xFF);
+ output[j] = (byte) (p % 256);
+ }
+ if (p != 0)
+ return null;
+ }
+
+ return output;
+ }
+
+ private static byte[] getSha256(byte[] data, int len, int recursion) {
+ if (recursion == 0)
+ return data;
+
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ md.update(Arrays.copyOfRange(data, 0, len));
+ return getSha256(md.digest(), 32, recursion - 1);
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/DarkNet.java b/src/main/java/bisq/asset/coins/DarkNet.java
new file mode 100644
index 00000000..807e9f49
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/DarkNet.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class DarkNet extends Coin {
+
+ public DarkNet() {
+ super("DarkNet", "DNET", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Dash.java b/src/main/java/bisq/asset/coins/Dash.java
new file mode 100644
index 00000000..3f9b7941
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Dash.java
@@ -0,0 +1,58 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+
+import org.libdohj.params.DashMainNetParams;
+import org.libdohj.params.DashRegTestParams;
+import org.libdohj.params.DashTestNet3Params;
+
+import org.bitcoinj.core.NetworkParameters;
+
+public abstract class Dash extends Coin {
+
+ public Dash(Network network, NetworkParameters networkParameters) {
+ super("Dash", "DASH", new Base58BitcoinAddressValidator(networkParameters), network);
+ }
+
+
+ public static class Mainnet extends Dash {
+
+ public Mainnet() {
+ super(Network.MAINNET, DashMainNetParams.get());
+ }
+ }
+
+
+ public static class Testnet extends Dash {
+
+ public Testnet() {
+ super(Network.TESTNET, DashTestNet3Params.get());
+ }
+ }
+
+
+ public static class Regtest extends Dash {
+
+ public Regtest() {
+ super(Network.REGTEST, DashRegTestParams.get());
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Decent.java b/src/main/java/bisq/asset/coins/Decent.java
new file mode 100644
index 00000000..95f70fe2
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Decent.java
@@ -0,0 +1,36 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class Decent extends Coin {
+
+ public Decent() {
+ super("Decent", "DCT", new DecentAddressValidator());
+ }
+
+
+ public static class DecentAddressValidator extends RegexAddressValidator {
+
+ public DecentAddressValidator() {
+ super("^(?=.{5,63}$)([a-z][a-z0-9-]+[a-z0-9])(\\.[a-z][a-z0-9-]+[a-z0-9])*$");
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Decred.java b/src/main/java/bisq/asset/coins/Decred.java
new file mode 100644
index 00000000..c3a8bc93
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Decred.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Decred extends Coin {
+
+ public Decred() {
+ super("Decred", "DCR", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/DeepOnion.java b/src/main/java/bisq/asset/coins/DeepOnion.java
new file mode 100644
index 00000000..f811b3a3
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/DeepOnion.java
@@ -0,0 +1,39 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class DeepOnion extends Coin {
+
+ public DeepOnion() {
+ super("DeepOnion", "ONION", new Base58BitcoinAddressValidator(new DeepOnionParams()));
+ }
+
+
+ public static class DeepOnionParams extends NetworkParametersAdapter {
+
+ public DeepOnionParams() {
+ addressHeader = 31;
+ p2shHeader = 78;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/DigiMoney.java b/src/main/java/bisq/asset/coins/DigiMoney.java
new file mode 100644
index 00000000..37957435
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/DigiMoney.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class DigiMoney extends Coin {
+
+ public DigiMoney() {
+ super("DigiMoney", "DGM", new RegexAddressValidator("^[D-E][a-zA-Z0-9]{33}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Dinero.java b/src/main/java/bisq/asset/coins/Dinero.java
new file mode 100644
index 00000000..c043ef11
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Dinero.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class Dinero extends Coin {
+
+ public Dinero() {
+ super("Dinero", "DIN", new RegexAddressValidator("^[D][0-9a-zA-Z]{33}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Dogecoin.java b/src/main/java/bisq/asset/coins/Dogecoin.java
new file mode 100644
index 00000000..159803e1
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Dogecoin.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+
+import org.libdohj.params.DogecoinMainNetParams;
+
+public class Dogecoin extends Coin {
+
+ public Dogecoin() {
+ super("Dogecoin", "DOGE", new Base58BitcoinAddressValidator(DogecoinMainNetParams.get()));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/DynamicCoin.java b/src/main/java/bisq/asset/coins/DynamicCoin.java
new file mode 100644
index 00000000..221c720b
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/DynamicCoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class DynamicCoin extends Coin {
+
+ public DynamicCoin() {
+ super("DynamicCoin", "DMC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Espers.java b/src/main/java/bisq/asset/coins/Espers.java
new file mode 100644
index 00000000..be981560
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Espers.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Espers extends Coin {
+
+ public Espers() {
+ super("Espers", "ESP", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Ether.java b/src/main/java/bisq/asset/coins/Ether.java
new file mode 100644
index 00000000..bb534c34
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Ether.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.EtherAddressValidator;
+
+public class Ether extends Coin {
+
+ public Ether() {
+ super("Ether", "ETH", new EtherAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/EtherClassic.java b/src/main/java/bisq/asset/coins/EtherClassic.java
new file mode 100644
index 00000000..14bcadc6
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/EtherClassic.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class EtherClassic extends Coin {
+
+ public EtherClassic() {
+ super("Ether Classic", "ETC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Gridcoin.java b/src/main/java/bisq/asset/coins/Gridcoin.java
new file mode 100644
index 00000000..71757361
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Gridcoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Gridcoin extends Coin {
+
+ public Gridcoin() {
+ super("Gridcoin", "GRC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/InfinityEconomics.java b/src/main/java/bisq/asset/coins/InfinityEconomics.java
new file mode 100644
index 00000000..b58a0e6a
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/InfinityEconomics.java
@@ -0,0 +1,29 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class InfinityEconomics extends Coin {
+
+ public InfinityEconomics() {
+ super("Infinity Economics", "XIN",
+ new RegexAddressValidator("^XIN-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{5}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Instacash.java b/src/main/java/bisq/asset/coins/Instacash.java
new file mode 100644
index 00000000..3b11eaa2
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Instacash.java
@@ -0,0 +1,61 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+import org.bitcoinj.core.Address;
+import org.bitcoinj.core.AddressFormatException;
+
+public class Instacash extends Coin {
+
+ public Instacash() {
+ super("Instacash", "ICH", new InstacashAddressValidator());
+ }
+
+
+ public static class InstacashAddressValidator implements AddressValidator {
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[A][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ try {
+ Address.fromBase58(new InstacashParams(), address);
+ } catch (AddressFormatException ex) {
+ return AddressValidationResult.invalidAddress(ex);
+ }
+
+ return AddressValidationResult.validAddress();
+ }
+ }
+
+
+ public static class InstacashParams extends NetworkParametersAdapter {
+
+ public InstacashParams() {
+ addressHeader = 23;
+ p2shHeader = 13;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/InternetOfPeople.java b/src/main/java/bisq/asset/coins/InternetOfPeople.java
new file mode 100644
index 00000000..126cb434
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/InternetOfPeople.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class InternetOfPeople extends Coin {
+
+ public InternetOfPeople() {
+ super("Internet of People", "IOP", new InternetOfPeopleAddressValidator());
+ }
+
+
+ public static class InternetOfPeopleAddressValidator extends Base58BitcoinAddressValidator {
+
+ public InternetOfPeopleAddressValidator() {
+ super(new InternetOfPeopleParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[p][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ return super.validate(address);
+ }
+ }
+
+
+ public static class InternetOfPeopleParams extends NetworkParametersAdapter {
+
+ public InternetOfPeopleParams() {
+ super();
+ addressHeader = 117;
+ p2shHeader = 174;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Koto.java b/src/main/java/bisq/asset/coins/Koto.java
new file mode 100644
index 00000000..f060c473
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Koto.java
@@ -0,0 +1,92 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import java.util.Arrays;
+
+public class Koto extends Coin {
+
+ public Koto() {
+ super("Koto", "KOTO", new KotoAddressValidator());
+ }
+
+
+ public static class KotoAddressValidator implements AddressValidator {
+
+ private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (address.startsWith("z"))
+ return AddressValidationResult.invalidAddress("KOTO_Addr_Invalid: z Address not supported!");
+ if (address.length() != 35)
+ return AddressValidationResult.invalidAddress("KOTO_Addr_Invalid: Length must be 35!");
+ if (!address.startsWith("k1") && !address.startsWith("jz"))
+ return AddressValidationResult.invalidAddress("KOTO_Addr_Invalid: must start with 'k1' or 'jz'!");
+ byte[] decoded = decodeBase58(address, 58, 26);
+ if (decoded == null)
+ return AddressValidationResult.invalidAddress("KOTO_Addr_Invalid: Base58 decoder error!");
+
+ byte[] hash = getSha256(decoded, 0, 22, 2);
+ if (hash == null || !Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 22, 26)))
+ return AddressValidationResult.invalidAddress("KOTO_Addr_Invalid: Checksum error!");
+
+ return AddressValidationResult.validAddress();
+
+ }
+
+ private static byte[] decodeBase58(String input, int base, int len) {
+ byte[] output = new byte[len];
+ for (int i = 0; i < input.length(); i++) {
+ char t = input.charAt(i);
+
+ int p = ALPHABET.indexOf(t);
+ if (p == -1)
+ return null;
+ for (int j = len - 1; j >= 0; j--, p /= 256) {
+ p += base * (output[j] & 0xFF);
+ output[j] = (byte) (p % 256);
+ }
+ if (p != 0)
+ return null;
+ }
+
+ return output;
+ }
+
+ private static byte[] getSha256(byte[] data, int start, int len, int recursion) {
+ if (recursion == 0)
+ return data;
+
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ md.update(Arrays.copyOfRange(data, start, start + len));
+ return getSha256(md.digest(), 0, 32, recursion - 1);
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/LBRY.java b/src/main/java/bisq/asset/coins/LBRY.java
new file mode 100644
index 00000000..00cadeb5
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/LBRY.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class LBRY extends Coin {
+
+ public LBRY() {
+ super("LBRY Credits", "LBC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Lisk.java b/src/main/java/bisq/asset/coins/Lisk.java
new file mode 100644
index 00000000..f9ecf504
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Lisk.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Lisk extends Coin {
+
+ public Lisk() {
+ super("Lisk", "LSK", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Litecoin.java b/src/main/java/bisq/asset/coins/Litecoin.java
new file mode 100644
index 00000000..f77d2f09
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Litecoin.java
@@ -0,0 +1,58 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+
+import org.libdohj.params.LitecoinMainNetParams;
+import org.libdohj.params.LitecoinRegTestParams;
+import org.libdohj.params.LitecoinTestNet3Params;
+
+import org.bitcoinj.core.NetworkParameters;
+
+public abstract class Litecoin extends Coin {
+
+ public Litecoin(Network network, NetworkParameters networkParameters) {
+ super("Litecoin", "LTC", new Base58BitcoinAddressValidator(networkParameters), network);
+ }
+
+
+ public static class Mainnet extends Litecoin {
+
+ public Mainnet() {
+ super(Network.MAINNET, LitecoinMainNetParams.get());
+ }
+ }
+
+
+ public static class Testnet extends Litecoin {
+
+ public Testnet() {
+ super(Network.TESTNET, LitecoinTestNet3Params.get());
+ }
+ }
+
+
+ public static class Regtest extends Litecoin {
+
+ public Regtest() {
+ super(Network.REGTEST, LitecoinRegTestParams.get());
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Madcoin.java b/src/main/java/bisq/asset/coins/Madcoin.java
new file mode 100644
index 00000000..92df10ed
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Madcoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class Madcoin extends Coin {
+
+ public Madcoin() {
+ super("Madcoin", "MDC", new RegexAddressValidator("^m[a-zA-Z0-9]{26,33}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/MaidSafeCoin.java b/src/main/java/bisq/asset/coins/MaidSafeCoin.java
new file mode 100644
index 00000000..1b9db574
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/MaidSafeCoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class MaidSafeCoin extends Coin {
+
+ public MaidSafeCoin() {
+ super("MaidSafeCoin", "MAID", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Monero.java b/src/main/java/bisq/asset/coins/Monero.java
new file mode 100644
index 00000000..477dddd0
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Monero.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Monero extends Coin {
+
+ public Monero() {
+ super("Monero", "XMR", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Namecoin.java b/src/main/java/bisq/asset/coins/Namecoin.java
new file mode 100644
index 00000000..3789ff04
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Namecoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Namecoin extends Coin {
+
+ public Namecoin() {
+ super("Namecoin", "NMC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/NavCoin.java b/src/main/java/bisq/asset/coins/NavCoin.java
new file mode 100644
index 00000000..9ca4fc1b
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/NavCoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class NavCoin extends Coin {
+
+ public NavCoin() {
+ super("Nav Coin", "NAV", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/NuBits.java b/src/main/java/bisq/asset/coins/NuBits.java
new file mode 100644
index 00000000..9d258989
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/NuBits.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class NuBits extends Coin {
+
+ public NuBits() {
+ super("NuBits", "NBT", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Nxt.java b/src/main/java/bisq/asset/coins/Nxt.java
new file mode 100644
index 00000000..6e1850c9
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Nxt.java
@@ -0,0 +1,227 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+
+public class Nxt extends Coin {
+
+ public Nxt() {
+ super("Nxt", "NXT", new NxtAddressValidator());
+ }
+
+
+ public static class NxtAddressValidator implements AddressValidator {
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.startsWith("NXT-") || !address.equals(address.toUpperCase()))
+ return AddressValidationResult.invalidStructure();
+
+ try {
+ long accountId = NxtReedSolomonValidator.decode(address.substring(4));
+ if (accountId == 0)
+ return AddressValidationResult.invalidStructure();
+ } catch (NxtReedSolomonValidator.DecodeException e) {
+ return AddressValidationResult.invalidAddress(e);
+ }
+
+ return AddressValidationResult.validAddress();
+ }
+ }
+
+ public static final class NxtReedSolomonValidator {
+
+ private static final int[] initial_codeword = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ private static final int[] gexp = {
+ 1, 2, 4, 8, 16, 5, 10, 20, 13, 26, 17, 7, 14, 28, 29, 31,
+ 27, 19, 3, 6, 12, 24, 21, 15, 30, 25, 23, 11, 22, 9, 18, 1};
+ private static final int[] glog = {
+ 0, 0, 1, 18, 2, 5, 19, 11, 3, 29, 6, 27, 20, 8, 12, 23, 4,
+ 10, 30, 17, 7, 22, 28, 26, 21, 25, 9, 16, 13, 14, 24, 15};
+ private static final int[] codeword_map = {3, 2, 1, 0, 7, 6, 5, 4, 13, 14, 15, 16, 12, 8, 9, 10, 11};
+ private static final String alphabet = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
+
+ private static final int base_32_length = 13;
+ private static final int base_10_length = 20;
+
+ public static String encode(long plain) {
+
+ String plain_string = Long.toUnsignedString(plain);
+ int length = plain_string.length();
+ int[] plain_string_10 = new int[NxtReedSolomonValidator.base_10_length];
+ for (int i = 0; i < length; i++) {
+ plain_string_10[i] = (int) plain_string.charAt(i) - (int) '0';
+ }
+
+ int codeword_length = 0;
+ int[] codeword = new int[NxtReedSolomonValidator.initial_codeword.length];
+
+ do { // base 10 to base 32 conversion
+ int new_length = 0;
+ int digit_32 = 0;
+ for (int i = 0; i < length; i++) {
+ digit_32 = digit_32 * 10 + plain_string_10[i];
+ if (digit_32 >= 32) {
+ plain_string_10[new_length] = digit_32 >> 5;
+ digit_32 &= 31;
+ new_length += 1;
+ } else if (new_length > 0) {
+ plain_string_10[new_length] = 0;
+ new_length += 1;
+ }
+ }
+ length = new_length;
+ codeword[codeword_length] = digit_32;
+ codeword_length += 1;
+ } while (length > 0);
+
+ int[] p = {0, 0, 0, 0};
+ for (int i = NxtReedSolomonValidator.base_32_length - 1; i >= 0; i--) {
+ final int fb = codeword[i] ^ p[3];
+ p[3] = p[2] ^ NxtReedSolomonValidator.gmult(30, fb);
+ p[2] = p[1] ^ NxtReedSolomonValidator.gmult(6, fb);
+ p[1] = p[0] ^ NxtReedSolomonValidator.gmult(9, fb);
+ p[0] = NxtReedSolomonValidator.gmult(17, fb);
+ }
+
+ System.arraycopy(
+ p, 0, codeword, NxtReedSolomonValidator.base_32_length,
+ NxtReedSolomonValidator.initial_codeword.length - NxtReedSolomonValidator.base_32_length);
+
+ StringBuilder cypher_string_builder = new StringBuilder();
+ for (int i = 0; i < 17; i++) {
+ final int codework_index = NxtReedSolomonValidator.codeword_map[i];
+ final int alphabet_index = codeword[codework_index];
+ cypher_string_builder.append(NxtReedSolomonValidator.alphabet.charAt(alphabet_index));
+
+ if ((i & 3) == 3 && i < 13) {
+ cypher_string_builder.append('-');
+ }
+ }
+ return cypher_string_builder.toString();
+ }
+
+ public static long decode(String cypher_string) throws DecodeException {
+
+ int[] codeword = new int[NxtReedSolomonValidator.initial_codeword.length];
+ System.arraycopy(
+ NxtReedSolomonValidator.initial_codeword, 0, codeword, 0,
+ NxtReedSolomonValidator.initial_codeword.length);
+
+ int codeword_length = 0;
+ for (int i = 0; i < cypher_string.length(); i++) {
+ int position_in_alphabet = NxtReedSolomonValidator.alphabet.indexOf(cypher_string.charAt(i));
+
+ if (position_in_alphabet <= -1 || position_in_alphabet > NxtReedSolomonValidator.alphabet.length()) {
+ continue;
+ }
+
+ if (codeword_length > 16) {
+ throw new CodewordTooLongException();
+ }
+
+ int codework_index = NxtReedSolomonValidator.codeword_map[codeword_length];
+ codeword[codework_index] = position_in_alphabet;
+ codeword_length += 1;
+ }
+
+ if (codeword_length == 17 && !NxtReedSolomonValidator.is_codeword_valid(codeword) || codeword_length != 17) {
+ throw new CodewordInvalidException();
+ }
+
+ int length = NxtReedSolomonValidator.base_32_length;
+ int[] cypher_string_32 = new int[length];
+ for (int i = 0; i < length; i++) {
+ cypher_string_32[i] = codeword[length - i - 1];
+ }
+
+ StringBuilder plain_string_builder = new StringBuilder();
+ do { // base 32 to base 10 conversion
+ int new_length = 0;
+ int digit_10 = 0;
+
+ for (int i = 0; i < length; i++) {
+ digit_10 = digit_10 * 32 + cypher_string_32[i];
+
+ if (digit_10 >= 10) {
+ cypher_string_32[new_length] = digit_10 / 10;
+ digit_10 %= 10;
+ new_length += 1;
+ } else if (new_length > 0) {
+ cypher_string_32[new_length] = 0;
+ new_length += 1;
+ }
+ }
+ length = new_length;
+ plain_string_builder.append((char) (digit_10 + (int) '0'));
+ } while (length > 0);
+
+ return Long.parseUnsignedLong(plain_string_builder.reverse().toString());
+ }
+
+ private static int gmult(int a, int b) {
+ if (a == 0 || b == 0) {
+ return 0;
+ }
+
+ int idx = (NxtReedSolomonValidator.glog[a] + NxtReedSolomonValidator.glog[b]) % 31;
+
+ return NxtReedSolomonValidator.gexp[idx];
+ }
+
+ private static boolean is_codeword_valid(int[] codeword) {
+ int sum = 0;
+
+ for (int i = 1; i < 5; i++) {
+ int t = 0;
+
+ for (int j = 0; j < 31; j++) {
+ if (j > 12 && j < 27) {
+ continue;
+ }
+
+ int pos = j;
+ if (j > 26) {
+ pos -= 14;
+ }
+
+ t ^= NxtReedSolomonValidator.gmult(codeword[pos], NxtReedSolomonValidator.gexp[(i * j) % 31]);
+ }
+
+ sum |= t;
+ }
+
+ return sum == 0;
+ }
+
+ public abstract static class DecodeException extends Exception {
+ }
+
+ static final class CodewordTooLongException extends DecodeException {
+ }
+
+ static final class CodewordInvalidException extends DecodeException {
+ }
+
+ private NxtReedSolomonValidator() {
+ } // never
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Obsidian.java b/src/main/java/bisq/asset/coins/Obsidian.java
new file mode 100644
index 00000000..0eebb7ce
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Obsidian.java
@@ -0,0 +1,39 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Obsidian extends Coin {
+
+ public Obsidian() {
+ super("Obsidian", "ODN", new Base58BitcoinAddressValidator(new ObsidianParams()));
+ }
+
+
+ public static class ObsidianParams extends NetworkParametersAdapter {
+
+ public ObsidianParams() {
+ addressHeader = 75;
+ p2shHeader = 125;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Octocoin.java b/src/main/java/bisq/asset/coins/Octocoin.java
new file mode 100644
index 00000000..6801c242
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Octocoin.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Octocoin extends Coin {
+
+ public Octocoin() {
+ super("Octocoin", "888", new OctocoinAddressValidator());
+ }
+
+
+ public static class OctocoinAddressValidator extends Base58BitcoinAddressValidator {
+
+ public OctocoinAddressValidator() {
+ super(new OctocoinParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[83][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ return super.validate(address);
+ }
+ }
+
+
+ public static class OctocoinParams extends NetworkParametersAdapter {
+
+ public OctocoinParams() {
+ addressHeader = 18;
+ p2shHeader = 5;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/PIVX.java b/src/main/java/bisq/asset/coins/PIVX.java
new file mode 100644
index 00000000..35f00ba3
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/PIVX.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class PIVX extends Coin {
+
+ public PIVX() {
+ super("PIVX", "PIVX", new PIVXAddressValidator());
+ }
+
+
+ public static class PIVXAddressValidator extends Base58BitcoinAddressValidator {
+
+ public PIVXAddressValidator() {
+ super(new PIVXParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ return super.validate(address);
+ }
+ }
+
+
+ public static class PIVXParams extends NetworkParametersAdapter {
+
+ public PIVXParams() {
+ addressHeader = 30;
+ p2shHeader = 13;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Particl.java b/src/main/java/bisq/asset/coins/Particl.java
new file mode 100644
index 00000000..edf26fd5
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Particl.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Particl extends Coin {
+
+ public Particl() {
+ super("Particl", "PART", new ParticlAddressValidator());
+ }
+
+
+ public static class ParticlAddressValidator extends Base58BitcoinAddressValidator {
+
+ public ParticlAddressValidator() {
+ super(new ParticlParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[RP][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ return super.validate(address);
+ }
+ }
+
+
+ public static class ParticlParams extends NetworkParametersAdapter {
+
+ public ParticlParams() {
+ addressHeader = 56;
+ p2shHeader = 60;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/PepeCash.java b/src/main/java/bisq/asset/coins/PepeCash.java
new file mode 100644
index 00000000..5fea385c
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/PepeCash.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class PepeCash extends Coin {
+
+ public PepeCash() {
+ super("Pepe Cash", "PEPECASH", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Phore.java b/src/main/java/bisq/asset/coins/Phore.java
new file mode 100644
index 00000000..0b02e822
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Phore.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Phore extends Coin {
+
+ public Phore() {
+ super("Phore", "PHR", new PhoreAddressValidator());
+ }
+
+
+ public static class PhoreAddressValidator extends Base58BitcoinAddressValidator {
+
+ public PhoreAddressValidator() {
+ super(new PhoreParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[P][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ return super.validate(address);
+ }
+ }
+
+ public static class PhoreParams extends NetworkParametersAdapter {
+
+ public PhoreParams() {
+ addressHeader = 55;
+ p2shHeader = 13;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/PostCoin.java b/src/main/java/bisq/asset/coins/PostCoin.java
new file mode 100644
index 00000000..76fb341d
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/PostCoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class PostCoin extends Coin {
+
+ public PostCoin() {
+ super("PostCoin", "POST", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Pranacoin.java b/src/main/java/bisq/asset/coins/Pranacoin.java
new file mode 100644
index 00000000..c56113b2
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Pranacoin.java
@@ -0,0 +1,102 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import java.util.Arrays;
+
+public class Pranacoin extends Coin {
+
+ public Pranacoin() {
+ super("Pranacoin", "PNC", new PranacoinAddressValidator());
+ }
+
+
+ public static class PranacoinAddressValidator extends Base58BitcoinAddressValidator {
+
+ private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+
+ public PranacoinAddressValidator() {
+ super(new Pranacoin.PranacoinParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[P3][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
+ return AddressValidationResult.invalidStructure();
+ if (!validateAddress(address))
+ return AddressValidationResult.invalidStructure();
+ return super.validate(address);
+ }
+
+ public static boolean validateAddress(String addr) {
+ if (addr.length() < 26 || addr.length() > 35) return false;
+ byte[] decoded = decodeBase58(addr, 58, 25);
+ if (decoded == null) return false;
+
+ byte[] hash = getSha256(decoded, 0, 21, 2);
+ return hash != null && Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 21, 25));
+ }
+
+ private static byte[] decodeBase58(String input, int base, int len) {
+ byte[] output = new byte[len];
+ for (int i = 0; i < input.length(); i++) {
+ char t = input.charAt(i);
+
+ int p = ALPHABET.indexOf(t);
+ if (p == -1) return null;
+ for (int j = len - 1; j >= 0; j--, p /= 256) {
+ p += base * (output[j] & 0xFF);
+ output[j] = (byte) (p % 256);
+ }
+ if (p != 0) return null;
+ }
+
+ return output;
+ }
+
+ private static byte[] getSha256(byte[] data, int start, int len, int recursion) {
+ if (recursion == 0) return data;
+
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ md.update(Arrays.copyOfRange(data, start, start + len));
+ return getSha256(md.digest(), 0, 32, recursion - 1);
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ }
+ }
+
+
+ public static class PranacoinParams extends NetworkParametersAdapter {
+
+ public PranacoinParams() {
+ addressHeader = 55;
+ p2shHeader = 5;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/ReddCoin.java b/src/main/java/bisq/asset/coins/ReddCoin.java
new file mode 100644
index 00000000..50f029e3
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/ReddCoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class ReddCoin extends Coin {
+
+ public ReddCoin() {
+ super("ReddCoin", "RDD", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Roicoin.java b/src/main/java/bisq/asset/coins/Roicoin.java
new file mode 100644
index 00000000..1b115e45
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Roicoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class Roicoin extends Coin {
+
+ public Roicoin() {
+ super("ROIcoin", "ROI", new RegexAddressValidator("^[R][0-9a-zA-Z]{33}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/STEEM.java b/src/main/java/bisq/asset/coins/STEEM.java
new file mode 100644
index 00000000..6d19a5c5
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/STEEM.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class STEEM extends Coin {
+
+ public STEEM() {
+ super("STEEM", "STEEM", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/SafeFileSystemCoin.java b/src/main/java/bisq/asset/coins/SafeFileSystemCoin.java
new file mode 100644
index 00000000..9c1de4c4
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/SafeFileSystemCoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class SafeFileSystemCoin extends Coin {
+
+ public SafeFileSystemCoin() {
+ super("Safe FileSystem Coin", "SFSC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Siacoin.java b/src/main/java/bisq/asset/coins/Siacoin.java
new file mode 100644
index 00000000..8dbf3418
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Siacoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Siacoin extends Coin {
+
+ public Siacoin() {
+ super("Siacoin", "SC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Siafund.java b/src/main/java/bisq/asset/coins/Siafund.java
new file mode 100644
index 00000000..f31ade51
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Siafund.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Siafund extends Coin {
+
+ public Siafund() {
+ super("Siafund", "SF", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Sibcoin.java b/src/main/java/bisq/asset/coins/Sibcoin.java
new file mode 100644
index 00000000..4bda3062
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Sibcoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Sibcoin extends Coin {
+
+ public Sibcoin() {
+ super("Sibcoin", "SIB", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Spectrecoin.java b/src/main/java/bisq/asset/coins/Spectrecoin.java
new file mode 100644
index 00000000..ee9f7a76
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Spectrecoin.java
@@ -0,0 +1,39 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Spectrecoin extends Coin {
+
+ public Spectrecoin() {
+ super("Spectrecoin", "XSPEC", new Base58BitcoinAddressValidator(new SpectrecoinParams()));
+ }
+
+
+ public static class SpectrecoinParams extends NetworkParametersAdapter {
+
+ public SpectrecoinParams() {
+ addressHeader = 63;
+ p2shHeader = 136;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/SpeedCash.java b/src/main/java/bisq/asset/coins/SpeedCash.java
new file mode 100644
index 00000000..3ecb35a1
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/SpeedCash.java
@@ -0,0 +1,39 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class SpeedCash extends Coin {
+
+ public SpeedCash() {
+ super("SpeedCash", "SCS", new Base58BitcoinAddressValidator(new SpeedCashParams()));
+ }
+
+
+ public static class SpeedCashParams extends NetworkParametersAdapter {
+
+ public SpeedCashParams() {
+ addressHeader = 63;
+ p2shHeader = 85;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Stellite.java b/src/main/java/bisq/asset/coins/Stellite.java
new file mode 100644
index 00000000..59dd349b
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Stellite.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class Stellite extends Coin {
+
+ public Stellite() {
+ super("Stellite", "STL", new RegexAddressValidator("^(Se)\\d[0-9A-Za-z]{94}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Strayacoin.java b/src/main/java/bisq/asset/coins/Strayacoin.java
new file mode 100644
index 00000000..cedaa60a
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Strayacoin.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Strayacoin extends Coin {
+
+ public Strayacoin() {
+ super("Strayacoin", "NAH", new StrayacoinAddressValidator());
+ }
+
+
+ public static class StrayacoinAddressValidator extends Base58BitcoinAddressValidator {
+
+ public StrayacoinAddressValidator() {
+ super(new StrayacoinParams());
+ }
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ if (!address.matches("^[S][a-zA-Z0-9]{26,34}$"))
+ return AddressValidationResult.invalidStructure();
+
+ return super.validate(address);
+ }
+ }
+
+
+ public static class StrayacoinParams extends NetworkParametersAdapter {
+
+ public StrayacoinParams() {
+ addressHeader = 63;
+ p2shHeader = 50;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Terracoin.java b/src/main/java/bisq/asset/coins/Terracoin.java
new file mode 100644
index 00000000..bc8070d1
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Terracoin.java
@@ -0,0 +1,40 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Terracoin extends Coin {
+
+ public Terracoin() {
+ super("Terracoin", "TRC", new Base58BitcoinAddressValidator(new TerracoinParams()));
+ }
+
+
+ public static class TerracoinParams extends NetworkParametersAdapter {
+
+ public TerracoinParams() {
+ super();
+ addressHeader = 0;
+ p2shHeader = 5;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Ubiq.java b/src/main/java/bisq/asset/coins/Ubiq.java
new file mode 100644
index 00000000..8c0b87f6
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Ubiq.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class Ubiq extends Coin {
+
+ public Ubiq() {
+ super("Ubiq", "UBQ", new RegexAddressValidator("^(0x)?[0-9a-fA-F]{40}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Unobtanium.java b/src/main/java/bisq/asset/coins/Unobtanium.java
new file mode 100644
index 00000000..079131cb
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Unobtanium.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Unobtanium extends Coin {
+
+ public Unobtanium() {
+ super("Unobtanium", "UNO", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/VDinar.java b/src/main/java/bisq/asset/coins/VDinar.java
new file mode 100644
index 00000000..5563d30d
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/VDinar.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.RegexAddressValidator;
+
+public class VDinar extends Coin {
+
+ public VDinar() {
+ super("vDinar", "VDN", new RegexAddressValidator("^[D][0-9a-zA-Z]{33}$"));
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Wacoin.java b/src/main/java/bisq/asset/coins/Wacoin.java
new file mode 100644
index 00000000..055467db
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Wacoin.java
@@ -0,0 +1,40 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+public class Wacoin extends Coin {
+
+ public Wacoin() {
+ super("WACoins", "WAC", new Base58BitcoinAddressValidator(new WacoinParams()));
+ }
+
+
+ public static class WacoinParams extends NetworkParametersAdapter {
+
+ public WacoinParams() {
+ super();
+ addressHeader = 73;
+ p2shHeader = 3;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/WorldMobileCoin.java b/src/main/java/bisq/asset/coins/WorldMobileCoin.java
new file mode 100644
index 00000000..2a71b14d
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/WorldMobileCoin.java
@@ -0,0 +1,266 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Base58BitcoinAddressValidator;
+import bisq.asset.Coin;
+import bisq.asset.NetworkParametersAdapter;
+
+import org.bitcoinj.core.AddressFormatException;
+import org.bitcoinj.core.NetworkParameters;
+import org.bitcoinj.core.VersionedChecksummedBytes;
+import org.bitcoinj.params.Networks;
+
+import java.io.ByteArrayOutputStream;
+
+import java.util.Arrays;
+import java.util.Locale;
+
+import javax.annotation.Nullable;
+
+public class WorldMobileCoin extends Coin {
+
+ public WorldMobileCoin() {
+ super("WorldMobileCoin", "WMCC", new WorldMobileCoinAddressValidator());
+ }
+
+
+ public static class WorldMobileCoinAddressValidator implements AddressValidator {
+
+ private final Base58BitcoinAddressValidator base58BitcoinAddressValidator;
+ private final NetworkParameters networkParameters;
+
+ public WorldMobileCoinAddressValidator() {
+ networkParameters = new WorldMobileCoinParams();
+ base58BitcoinAddressValidator = new Base58BitcoinAddressValidator(networkParameters);
+ }
+
+ public AddressValidationResult validate(String address) {
+ if (!isLowerCase(address)) {
+ return base58BitcoinAddressValidator.validate(address);
+ }
+
+ try {
+ WitnessAddress.fromBech32(networkParameters, address);
+ } catch (AddressFormatException ex) {
+ return AddressValidationResult.invalidAddress(ex);
+ }
+
+ return AddressValidationResult.validAddress();
+ }
+
+ private static boolean isLowerCase(String str) {
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ ch = str.charAt(i);
+ if (Character.isDigit(ch))
+ continue;
+ if (!Character.isLowerCase(ch))
+ return false;
+ }
+ return true;
+ }
+
+ }
+
+ public static class WorldMobileCoinParams extends NetworkParametersAdapter {
+
+ public WorldMobileCoinParams() {
+ addressHeader = 0x49;
+ p2shHeader = 0x4b;
+ acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
+
+ }
+ }
+
+ private static class WitnessAddress extends VersionedChecksummedBytes {
+ static final int PROGRAM_LENGTH_PKH = 20;
+ static final int PROGRAM_LENGTH_SH = 32;
+ static final int PROGRAM_MIN_LENGTH = 2;
+ static final int PROGRAM_MAX_LENGTH = 40;
+ static final String WITNESS_ADDRESS_HRP = "wc";
+
+ private WitnessAddress(NetworkParameters params, byte[] data) throws AddressFormatException {
+ super(params.getAddressHeader(), data);
+ if (data.length < 1)
+ throw new AddressFormatException("Zero data found");
+ final int version = getWitnessVersion();
+ if (version < 0 || version > 16)
+ throw new AddressFormatException("Invalid script version: " + version);
+ byte[] program = getWitnessProgram();
+ if (program.length < PROGRAM_MIN_LENGTH || program.length > PROGRAM_MAX_LENGTH)
+ throw new AddressFormatException("Invalid length: " + program.length);
+ if (version == 0 && program.length != PROGRAM_LENGTH_PKH
+ && program.length != PROGRAM_LENGTH_SH)
+ throw new AddressFormatException(
+ "Invalid length for address version 0: " + program.length);
+ }
+
+ int getWitnessVersion() {
+ return bytes[0] & 0xff;
+ }
+
+ byte[] getWitnessProgram() {
+ return convertBits(bytes, 1, bytes.length - 1, 5, 8, false);
+ }
+
+ static WitnessAddress fromBech32(@Nullable NetworkParameters params, String bech32)
+ throws AddressFormatException {
+ Bech32.Bech32Data bechData = Bech32.decode(bech32);
+ if (params == null) {
+ for (NetworkParameters p : Networks.get()) {
+ if (bechData.hrp.equals(WITNESS_ADDRESS_HRP))
+ return new WitnessAddress(p, bechData.data);
+ }
+ throw new AddressFormatException("Invalid Prefix: No network found for " + bech32);
+ } else {
+ if (bechData.hrp.equals(WITNESS_ADDRESS_HRP))
+ return new WitnessAddress(params, bechData.data);
+ throw new AddressFormatException("Wrong Network: " + bechData.hrp);
+ }
+ }
+
+ /**
+ * Helper
+ */
+ private static byte[] convertBits(final byte[] in, final int inStart, final int inLen, final int fromBits,
+ final int toBits, final boolean pad) throws AddressFormatException {
+ int acc = 0;
+ int bits = 0;
+ ByteArrayOutputStream out = new ByteArrayOutputStream(64);
+ final int maxv = (1 << toBits) - 1;
+ final int max_acc = (1 << (fromBits + toBits - 1)) - 1;
+ for (int i = 0; i < inLen; i++) {
+ int value = in[i + inStart] & 0xff;
+ if ((value >>> fromBits) != 0) {
+ throw new AddressFormatException(
+ String.format("Input value '%X' exceeds '%d' bit size", value, fromBits));
+ }
+ acc = ((acc << fromBits) | value) & max_acc;
+ bits += fromBits;
+ while (bits >= toBits) {
+ bits -= toBits;
+ out.write((acc >>> bits) & maxv);
+ }
+ }
+ if (pad) {
+ if (bits > 0)
+ out.write((acc << (toBits - bits)) & maxv);
+ } else if (bits >= fromBits || ((acc << (toBits - bits)) & maxv) != 0) {
+ throw new AddressFormatException("Could not convert bits, invalid padding");
+ }
+ return out.toByteArray();
+ }
+ }
+
+ private static class Bech32 {
+ private static final byte[] CHARSET_REV = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, 10, 17,
+ 21, 20, 26, 30, 7, 5, -1, -1, -1, -1, -1, -1, -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19,
+ -1, 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1, -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18,
+ 22, 31, 27, 19, -1, 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1
+ };
+
+ static class Bech32Data {
+ final String hrp;
+ final byte[] data;
+
+ private Bech32Data(final String hrp, final byte[] data) {
+ this.hrp = hrp;
+ this.data = data;
+ }
+ }
+
+ private static int polymod(final byte[] values) {
+ int c = 1;
+ for (byte v_i : values) {
+ int c0 = (c >>> 25) & 0xff;
+ c = ((c & 0x1ffffff) << 5) ^ (v_i & 0xff);
+ if ((c0 & 1) != 0) c ^= 0x3b6a57b2;
+ if ((c0 & 2) != 0) c ^= 0x26508e6d;
+ if ((c0 & 4) != 0) c ^= 0x1ea119fa;
+ if ((c0 & 8) != 0) c ^= 0x3d4233dd;
+ if ((c0 & 16) != 0) c ^= 0x2a1462b3;
+ }
+ return c;
+ }
+
+ private static byte[] expandHrp(final String hrp) {
+ int len = hrp.length();
+ byte ret[] = new byte[len * 2 + 1];
+ for (int i = 0; i < len; ++i) {
+ int c = hrp.charAt(i) & 0x7f;
+ ret[i] = (byte) ((c >>> 5) & 0x07);
+ ret[i + len + 1] = (byte) (c & 0x1f);
+ }
+ ret[len] = 0;
+ return ret;
+ }
+
+ private static boolean verifyChecksum(final String hrp, final byte[] values) {
+ byte[] exp = expandHrp(hrp);
+ byte[] combined = new byte[exp.length + values.length];
+ System.arraycopy(exp, 0, combined, 0, exp.length);
+ System.arraycopy(values, 0, combined, exp.length, values.length);
+ return polymod(combined) == 1;
+ }
+
+ public static Bech32Data decode(final String str) throws AddressFormatException {
+ boolean lower = false, upper = false;
+ int len = str.length();
+ if (len < 8)
+ throw new AddressFormatException("Input too short: " + len);
+ if (len > 90)
+ throw new AddressFormatException("Input too long: " + len);
+ for (int i = 0; i < len; ++i) {
+ char c = str.charAt(i);
+ if (c < 33 || c > 126) throw new AddressFormatException(invalidChar(c, i));
+ if (c >= 'a' && c <= 'z') {
+ if (upper)
+ throw new AddressFormatException(invalidChar(c, i));
+ lower = true;
+ }
+ if (c >= 'A' && c <= 'Z') {
+ if (lower)
+ throw new AddressFormatException(invalidChar(c, i));
+ upper = true;
+ }
+ }
+ final int pos = str.lastIndexOf('1');
+ if (pos < 1) throw new AddressFormatException("Invalid Prefix: Missing human-readable part");
+ final int dataLen = len - 1 - pos;
+ if (dataLen < 6) throw new AddressFormatException("Data part too short: " + dataLen);
+ byte[] values = new byte[dataLen];
+ for (int i = 0; i < dataLen; ++i) {
+ char c = str.charAt(i + pos + 1);
+ if (CHARSET_REV[c] == -1) throw new AddressFormatException(invalidChar(c, i + pos + 1));
+ values[i] = CHARSET_REV[c];
+ }
+ String hrp = str.substring(0, pos).toLowerCase(Locale.ROOT);
+ if (!verifyChecksum(hrp, values)) throw new AddressFormatException("Invalid Checksum");
+ return new Bech32Data(hrp, Arrays.copyOfRange(values, 0, values.length - 6));
+ }
+
+ private static String invalidChar(char c, int i) {
+ return "Invalid character '" + Character.toString(c) + "' at position " + i;
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Yenten.java b/src/main/java/bisq/asset/coins/Yenten.java
new file mode 100644
index 00000000..7a8a7fb2
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Yenten.java
@@ -0,0 +1,87 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import java.util.Arrays;
+
+public class Yenten extends Coin {
+
+ public Yenten() {
+ super("Yenten", "YTN", new YentenAddressValidator());
+ }
+
+
+ public static class YentenAddressValidator implements AddressValidator {
+
+ private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+
+ public AddressValidationResult validate(String addr) {
+ if (addr.length() != 34)
+ return AddressValidationResult.invalidAddress("YTN_Addr_Invalid: Length must be 34!");
+ if (!addr.startsWith("Y"))
+ return AddressValidationResult.invalidAddress("YTN_Addr_Invalid: must start with 'Y'!");
+ byte[] decoded = decodeBase58(addr);
+ if (decoded == null)
+ return AddressValidationResult.invalidAddress("YTN_Addr_Invalid: Base58 decoder error!");
+
+ byte[] hash = getSha256(decoded, 21, 2);
+ if (hash == null || !Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 21, 25)))
+ return AddressValidationResult.invalidAddress("YTN_Addr_Invalid: Checksum error!");
+ return AddressValidationResult.validAddress();
+ }
+
+ private static byte[] decodeBase58(String input) {
+ byte[] output = new byte[25];
+ for (int i = 0; i < input.length(); i++) {
+ char t = input.charAt(i);
+
+ int p = ALPHABET.indexOf(t);
+ if (p == -1)
+ return null;
+ for (int j = 25 - 1; j >= 0; j--, p /= 256) {
+ p += 58 * (output[j] & 0xFF);
+ output[j] = (byte) (p % 256);
+ }
+ if (p != 0)
+ return null;
+ }
+
+ return output;
+ }
+
+ private static byte[] getSha256(byte[] data, int len, int recursion) {
+ if (recursion == 0)
+ return data;
+
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ md.update(Arrays.copyOfRange(data, 0, len));
+ return getSha256(md.digest(), 32, recursion - 1);
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Zcash.java b/src/main/java/bisq/asset/coins/Zcash.java
new file mode 100644
index 00000000..0f790b46
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Zcash.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+
+public class Zcash extends Coin {
+
+ public Zcash() {
+ super("Zcash", "ZEC", new ZcashAddressValidator());
+ }
+
+
+ public static class ZcashAddressValidator implements AddressValidator {
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ // We only support t addresses (transparent transactions)
+ if (!address.startsWith("t"))
+ return AddressValidationResult.invalidAddress("", "validation.altcoin.zAddressesNotSupported");
+
+ return AddressValidationResult.validAddress();
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/Zcoin.java b/src/main/java/bisq/asset/coins/Zcoin.java
new file mode 100644
index 00000000..2c498bfe
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/Zcoin.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.Coin;
+import bisq.asset.DefaultAddressValidator;
+
+public class Zcoin extends Coin {
+
+ public Zcoin() {
+ super("Zcoin", "XZC", new DefaultAddressValidator());
+ }
+}
diff --git a/src/main/java/bisq/asset/coins/ZenCash.java b/src/main/java/bisq/asset/coins/ZenCash.java
new file mode 100644
index 00000000..1f588c21
--- /dev/null
+++ b/src/main/java/bisq/asset/coins/ZenCash.java
@@ -0,0 +1,69 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AddressValidationResult;
+import bisq.asset.AddressValidator;
+import bisq.asset.Coin;
+
+import org.bitcoinj.core.AddressFormatException;
+import org.bitcoinj.core.Base58;
+
+public class ZenCash extends Coin {
+
+ public ZenCash() {
+ super("ZenCash", "ZEN", new ZenCashAddressValidator());
+ }
+
+
+ public static class ZenCashAddressValidator implements AddressValidator {
+
+ @Override
+ public AddressValidationResult validate(String address) {
+ byte[] byteAddress;
+ try {
+ // Get the non Base58 form of the address and the bytecode of the first two bytes
+ byteAddress = Base58.decodeChecked(address);
+ } catch (AddressFormatException e) {
+ // Unhandled Exception (probably a checksum error)
+ return AddressValidationResult.invalidAddress(e);
+ }
+ int version0 = byteAddress[0] & 0xFF;
+ int version1 = byteAddress[1] & 0xFF;
+
+ // We only support public ("zn" (0x20,0x89), "t1" (0x1C,0xB8))
+ // and multisig ("zs" (0x20,0x96), "t3" (0x1C,0xBD)) addresses
+
+ // Fail for private addresses
+ if (version0 == 0x16 && version1 == 0x9A)
+ // Address starts with "zc"
+ return AddressValidationResult.invalidAddress("", "validation.altcoin.zAddressesNotSupported");
+
+ if (version0 == 0x1C && (version1 == 0xB8 || version1 == 0xBD))
+ // "t1" or "t3" address
+ return AddressValidationResult.validAddress();
+
+ if (version0 == 0x20 && (version1 == 0x89 || version1 == 0x96))
+ // "zn" or "zs" address
+ return AddressValidationResult.validAddress();
+
+ // Unknown Type
+ return AddressValidationResult.invalidStructure();
+ }
+ }
+}
diff --git a/src/main/java/bisq/asset/package-info.java b/src/main/java/bisq/asset/package-info.java
new file mode 100644
index 00000000..b466aedf
--- /dev/null
+++ b/src/main/java/bisq/asset/package-info.java
@@ -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 .
+ */
+
+/**
+ * Bisq's family of abstractions representing different ("crypto")
+ * {@link bisq.asset.Asset} types such as {@link bisq.asset.Coin},
+ * {@link bisq.asset.Token} and {@link bisq.asset.Erc20Token}, as well as concrete
+ * implementations of each, such as {@link bisq.asset.coins.Bitcoin} itself, altcoins like
+ * {@link bisq.asset.coins.Litecoin} and {@link bisq.asset.coins.Ether} and tokens like
+ * {@link bisq.asset.tokens.DaiStablecoin}.
+ *
+ * The purpose of this package is to provide everything necessary for registering
+ * ("listing") new assets and managing / accessing those assets within, e.g. the Bisq
+ * Desktop UI.
+ *
+ * Note that everything within this package is intentionally designed to be simple and
+ * low-level with no dependencies on any other Bisq packages or components.
+ *
+ * @author Chris Beams
+ * @since 0.7.0
+ */
+
+package bisq.asset;
diff --git a/src/main/java/bisq/asset/tokens/BetterBetting.java b/src/main/java/bisq/asset/tokens/BetterBetting.java
new file mode 100644
index 00000000..88021db8
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/BetterBetting.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class BetterBetting extends Erc20Token {
+
+ public BetterBetting() {
+ super("Better Betting", "BETR");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/DaiStablecoin.java b/src/main/java/bisq/asset/tokens/DaiStablecoin.java
new file mode 100644
index 00000000..f0f673c5
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/DaiStablecoin.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class DaiStablecoin extends Erc20Token {
+
+ public DaiStablecoin() {
+ super("Dai Stablecoin", "DAI");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/Ellaism.java b/src/main/java/bisq/asset/tokens/Ellaism.java
new file mode 100644
index 00000000..95dc40b2
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/Ellaism.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class Ellaism extends Erc20Token {
+
+ public Ellaism() {
+ super("Ellaism", "ELLA");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/GeoCoin.java b/src/main/java/bisq/asset/tokens/GeoCoin.java
new file mode 100644
index 00000000..a3e29529
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/GeoCoin.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class GeoCoin extends Erc20Token {
+
+ public GeoCoin() {
+ super("GeoCoin", "GEO");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/Grans.java b/src/main/java/bisq/asset/tokens/Grans.java
new file mode 100644
index 00000000..08f9e8ad
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/Grans.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class Grans extends Erc20Token {
+
+ public Grans() {
+ super("10grans", "GRANS");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/Internext.java b/src/main/java/bisq/asset/tokens/Internext.java
new file mode 100644
index 00000000..71072e5b
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/Internext.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class Internext extends Erc20Token {
+
+ public Internext() {
+ super("Internext", "INXT");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/Movement.java b/src/main/java/bisq/asset/tokens/Movement.java
new file mode 100644
index 00000000..4594b216
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/Movement.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class Movement extends Erc20Token {
+
+ public Movement() {
+ super("The Movement", "MVT");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/MyceliumToken.java b/src/main/java/bisq/asset/tokens/MyceliumToken.java
new file mode 100644
index 00000000..cc6642f4
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/MyceliumToken.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class MyceliumToken extends Erc20Token {
+
+ public MyceliumToken() {
+ super("Mycelium Token", "MT");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/PascalCoin.java b/src/main/java/bisq/asset/tokens/PascalCoin.java
new file mode 100644
index 00000000..d044112f
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/PascalCoin.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class PascalCoin extends Erc20Token {
+
+ public PascalCoin() {
+ super("Pascal Coin", "PASC");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/Qwark.java b/src/main/java/bisq/asset/tokens/Qwark.java
new file mode 100644
index 00000000..e09490bb
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/Qwark.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class Qwark extends Erc20Token {
+
+ public Qwark() {
+ super("Qwark", "QWARK");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/RefToken.java b/src/main/java/bisq/asset/tokens/RefToken.java
new file mode 100644
index 00000000..5bdadeb1
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/RefToken.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class RefToken extends Erc20Token {
+
+ public RefToken() {
+ super("RefToken", "REF");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/SosCoin.java b/src/main/java/bisq/asset/tokens/SosCoin.java
new file mode 100644
index 00000000..44f6ff2c
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/SosCoin.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class SosCoin extends Erc20Token {
+
+ public SosCoin() {
+ super("SOS Coin", "SOS");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/Verify.java b/src/main/java/bisq/asset/tokens/Verify.java
new file mode 100644
index 00000000..bff0aa62
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/Verify.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class Verify extends Erc20Token {
+
+ public Verify() {
+ super("Verify", "CRED");
+ }
+}
diff --git a/src/main/java/bisq/asset/tokens/WildToken.java b/src/main/java/bisq/asset/tokens/WildToken.java
new file mode 100644
index 00000000..a289dcad
--- /dev/null
+++ b/src/main/java/bisq/asset/tokens/WildToken.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.Erc20Token;
+
+public class WildToken extends Erc20Token {
+
+ public WildToken() {
+ super("WILD Token", "WILD");
+ }
+}
diff --git a/src/main/java/bisq/core/locale/CurrencyUtil.java b/src/main/java/bisq/core/locale/CurrencyUtil.java
index f2c42741..a4859d2a 100644
--- a/src/main/java/bisq/core/locale/CurrencyUtil.java
+++ b/src/main/java/bisq/core/locale/CurrencyUtil.java
@@ -17,6 +17,13 @@
package bisq.core.locale;
+import bisq.core.app.BisqEnvironment;
+
+import bisq.asset.Asset;
+import bisq.asset.AssetRegistry;
+import bisq.asset.Token;
+import bisq.asset.coins.BSQ;
+
import bisq.common.app.DevEnv;
import java.util.ArrayList;
@@ -34,13 +41,23 @@
@Slf4j
public class CurrencyUtil {
+
+ private static final AssetRegistry assetRegistry = new AssetRegistry();
+
private static String baseCurrencyCode = "BTC";
+ private static List allSortedFiatCurrencies;
+ private static List allSortedCryptoCurrencies;
public static void setBaseCurrencyCode(String baseCurrencyCode) {
CurrencyUtil.baseCurrencyCode = baseCurrencyCode;
}
- private static List allSortedFiatCurrencies;
+ public static List getAllSortedFiatCurrencies() {
+ if (Objects.isNull(allSortedFiatCurrencies))
+ allSortedFiatCurrencies = createAllSortedFiatCurrenciesList();
+
+ return allSortedFiatCurrencies;
+ }
private static List createAllSortedFiatCurrenciesList() {
Set set = CountryUtil.getAllCountries().stream()
@@ -51,14 +68,6 @@ private static List createAllSortedFiatCurrenciesList() {
return list;
}
- public static List getAllSortedFiatCurrencies() {
- if (Objects.isNull(allSortedFiatCurrencies)) {
- allSortedFiatCurrencies = createAllSortedFiatCurrenciesList();
- }
- return allSortedFiatCurrencies;
- }
-
-
public static List getMainFiatCurrencies() {
TradeCurrency defaultTradeCurrency = getDefaultTradeCurrency();
List list = new ArrayList<>();
@@ -73,7 +82,8 @@ public static List getMainFiatCurrencies() {
list.sort(TradeCurrency::compareTo);
- FiatCurrency defaultFiatCurrency = defaultTradeCurrency instanceof FiatCurrency ? (FiatCurrency) defaultTradeCurrency : null;
+ FiatCurrency defaultFiatCurrency =
+ defaultTradeCurrency instanceof FiatCurrency ? (FiatCurrency) defaultTradeCurrency : null;
if (defaultFiatCurrency != null && list.contains(defaultFiatCurrency)) {
//noinspection SuspiciousMethodCalls
list.remove(defaultTradeCurrency);
@@ -82,118 +92,19 @@ public static List getMainFiatCurrencies() {
return list;
}
- private static List allSortedCryptoCurrencies;
-
public static List getAllSortedCryptoCurrencies() {
if (allSortedCryptoCurrencies == null)
allSortedCryptoCurrencies = createAllSortedCryptoCurrenciesList();
return allSortedCryptoCurrencies;
}
- // Don't make a PR for adding a coin but follow the steps described here:
- // https://forum.bisq.network/t/how-to-add-your-favorite-altcoin/
- public static List createAllSortedCryptoCurrenciesList() {
- final List result = new ArrayList<>();
-
- result.add(new CryptoCurrency("BETR", "Better Betting", true));
- if (DevEnv.DAO_TRADING_ACTIVATED)
- result.add(new CryptoCurrency("BSQ", "Bisq Token"));
-
- if (!baseCurrencyCode.equals("BTC"))
- result.add(new CryptoCurrency("BTC", "Bitcoin"));
- result.add(new CryptoCurrency("BCH", "Bitcoin Cash"));
- result.add(new CryptoCurrency("BCHC", "Bitcoin Clashic"));
- result.add(new CryptoCurrency("BTG", "Bitcoin Gold"));
- result.add(new CryptoCurrency("BURST", "Burstcoin"));
- result.add(new CryptoCurrency("GBYTE", "Byte"));
- result.add(new CryptoCurrency("CAGE", "Cagecoin"));
- result.add(new CryptoCurrency("XCP", "Counterparty"));
- result.add(new CryptoCurrency("CREA", "Creativecoin"));
- result.add(new CryptoCurrency("XCN", "Cryptonite"));
- result.add(new CryptoCurrency("DNET", "DarkNet"));
- if (!baseCurrencyCode.equals("DASH"))
- result.add(new CryptoCurrency("DASH", "Dash"));
- result.add(new CryptoCurrency("DCT", "DECENT"));
- result.add(new CryptoCurrency("DCR", "Decred"));
- result.add(new CryptoCurrency("ONION", "DeepOnion"));
- result.add(new CryptoCurrency("DOGE", "Dogecoin"));
- result.add(new CryptoCurrency("DMC", "DynamicCoin"));
- result.add(new CryptoCurrency("ELLA", "Ellaism"));
- result.add(new CryptoCurrency("ESP", "Espers"));
- result.add(new CryptoCurrency("ETH", "Ether"));
- result.add(new CryptoCurrency("ETC", "Ether Classic"));
- result.add(new CryptoCurrency("XIN", "Infinity Economics"));
- result.add(new CryptoCurrency("IOP", "Internet Of People"));
- result.add(new CryptoCurrency("INXT", "Internext", true));
- result.add(new CryptoCurrency("GRC", "Gridcoin"));
- result.add(new CryptoCurrency("LBC", "LBRY Credits"));
- result.add(new CryptoCurrency("LSK", "Lisk"));
- if (!baseCurrencyCode.equals("LTC"))
- result.add(new CryptoCurrency("LTC", "Litecoin"));
- result.add(new CryptoCurrency("MAID", "MaidSafeCoin"));
- result.add(new CryptoCurrency("MDC", "Madcoin"));
- result.add(new CryptoCurrency("XMR", "Monero"));
- result.add(new CryptoCurrency("MT", "Mycelium Token", true));
- result.add(new CryptoCurrency("NAV", "Nav Coin"));
- result.add(new CryptoCurrency("NMC", "Namecoin"));
- result.add(new CryptoCurrency("NBT", "NuBits"));
- result.add(new CryptoCurrency("NXT", "Nxt"));
- result.add(new CryptoCurrency("888", "OctoCoin"));
- result.add(new CryptoCurrency("PART", "Particl"));
- result.add(new CryptoCurrency("PASC", "Pascal Coin", true));
- result.add(new CryptoCurrency("PEPECASH", "Pepe Cash"));
- result.add(new CryptoCurrency("PIVX", "PIVX"));
- result.add(new CryptoCurrency("POST", "PostCoin"));
- result.add(new CryptoCurrency("PNC", "Pranacoin"));
- result.add(new CryptoCurrency("RDD", "ReddCoin"));
- result.add(new CryptoCurrency("REF", "RefToken", true));
- result.add(new CryptoCurrency("SFSC", "Safe FileSystem Coin"));
- result.add(new CryptoCurrency("SC", "Siacoin"));
- result.add(new CryptoCurrency("SF", "Siafund"));
- result.add(new CryptoCurrency("SIB", "Sibcoin"));
- result.add(new CryptoCurrency("XSPEC", "Spectrecoin"));
- result.add(new CryptoCurrency("STEEM", "STEEM"));
-
- result.add(new CryptoCurrency("TRC", "Terracoin"));
- result.add(new CryptoCurrency("MVT", "The Movement", true));
-
- result.add(new CryptoCurrency("UNO", "Unobtanium"));
- result.add(new CryptoCurrency("CRED", "Verify", true));
- result.add(new CryptoCurrency("WAC", "WACoins"));
- result.add(new CryptoCurrency("WILD", "WILD Token", true));
- result.add(new CryptoCurrency("XZC", "Zcoin"));
- result.add(new CryptoCurrency("ZEC", "Zcash"));
- result.add(new CryptoCurrency("ZEN", "ZenCash"));
-
- // Added 0.6.6
- result.add(new CryptoCurrency("STL", "Stellite"));
- result.add(new CryptoCurrency("DAI", "Dai Stablecoin", true));
- result.add(new CryptoCurrency("YTN", "Yenten"));
- result.add(new CryptoCurrency("DARX", "BitDaric"));
- result.add(new CryptoCurrency("ODN", "Obsidian"));
- result.add(new CryptoCurrency("CDT", "Cassubian Detk"));
- result.add(new CryptoCurrency("DGM", "DigiMoney"));
- result.add(new CryptoCurrency("SCS", "SpeedCash"));
- result.add(new CryptoCurrency("SOS", "SOS Coin", true));
- result.add(new CryptoCurrency("ACH", "AchieveCoin"));
- result.add(new CryptoCurrency("VDN", "vDinar"));
- result.add(new CryptoCurrency("WMCC", "WorldMobileCoin"));
-
- // Added 0.7.0
- result.add(new CryptoCurrency("ALC", "Angelcoin"));
- result.add(new CryptoCurrency("DIN", "Dinero"));
- result.add(new CryptoCurrency("NAH", "Strayacoin"));
- result.add(new CryptoCurrency("ROI", "ROIcoin"));
- result.add(new CryptoCurrency("RTO", "Arto"));
- result.add(new CryptoCurrency("KOTO", "Koto"));
- result.add(new CryptoCurrency("UBQ", "Ubiq"));
- result.add(new CryptoCurrency("QWARK", "Qwark", true));
- result.add(new CryptoCurrency("GEO", "GeoCoin", true));
- result.add(new CryptoCurrency("GRANS", "10grans", true));
- result.add(new CryptoCurrency("ICH", "ICH"));
- result.add(new CryptoCurrency("PHR", "Phore"));
-
- result.sort(TradeCurrency::compareTo);
+ private static List createAllSortedCryptoCurrenciesList() {
+ List result = assetRegistry.stream()
+ .filter(CurrencyUtil::assetIsNotBaseCurrency)
+ .filter(CurrencyUtil::excludeBsqUnlessDaoTradingIsActive)
+ .map(CurrencyUtil::assetToCryptoCurrency)
+ .sorted(TradeCurrency::compareTo)
+ .collect(Collectors.toList());
// Util for printing all altcoins for adding to FAQ page
@@ -211,13 +122,12 @@ public static List createAllSortedCryptoCurrenciesList() {
public static List getMainCryptoCurrencies() {
final List result = new ArrayList<>();
if (DevEnv.DAO_TRADING_ACTIVATED)
- result.add(new CryptoCurrency("BSQ", "Bisq Token"));
+ result.add(new CryptoCurrency("BSQ", "BSQ"));
if (!baseCurrencyCode.equals("BTC"))
result.add(new CryptoCurrency("BTC", "Bitcoin"));
if (!baseCurrencyCode.equals("DASH"))
result.add(new CryptoCurrency("DASH", "Dash"));
result.add(new CryptoCurrency("DCR", "Decred"));
- result.add(new CryptoCurrency("ONION", "DeepOnion"));
result.add(new CryptoCurrency("ETH", "Ether"));
result.add(new CryptoCurrency("ETC", "Ether Classic"));
result.add(new CryptoCurrency("GRC", "Gridcoin"));
@@ -235,16 +145,6 @@ public static List getMainCryptoCurrencies() {
return result;
}
-
- /**
- * @return Sorted list of SEPA currencies with EUR as first item
- */
- private static Set getSortedSEPACurrencyCodes() {
- return CountryUtil.getAllSepaCountries().stream()
- .map(country -> getCurrencyByCountryCode(country.code))
- .collect(Collectors.toSet());
- }
-
// At OKPay you can exchange internally those currencies
public static List getAllOKPayCurrencies() {
ArrayList currencies = new ArrayList<>(Arrays.asList(
@@ -341,7 +241,10 @@ public static List getAllRevolutCurrencies() {
public static boolean isFiatCurrency(String currencyCode) {
try {
- return currencyCode != null && !currencyCode.isEmpty() && !isCryptoCurrency(currencyCode) && Currency.getInstance(currencyCode) != null;
+ return currencyCode != null
+ && !currencyCode.isEmpty()
+ && !isCryptoCurrency(currencyCode)
+ && Currency.getInstance(currencyCode) != null;
} catch (Throwable t) {
return false;
}
@@ -362,39 +265,36 @@ public static Optional getCryptoCurrency(String currencyCode) {
public static Optional getTradeCurrency(String currencyCode) {
Optional fiatCurrencyOptional = getFiatCurrency(currencyCode);
- if (isFiatCurrency(currencyCode) && fiatCurrencyOptional.isPresent()) {
+ if (isFiatCurrency(currencyCode) && fiatCurrencyOptional.isPresent())
return Optional.of(fiatCurrencyOptional.get());
- } else {
- Optional cryptoCurrencyOptional = getCryptoCurrency(currencyCode);
- if (isCryptoCurrency(currencyCode) && cryptoCurrencyOptional.isPresent()) {
- return Optional.of(cryptoCurrencyOptional.get());
- } else {
- return Optional.empty();
- }
- }
- }
+ Optional cryptoCurrencyOptional = getCryptoCurrency(currencyCode);
+ if (isCryptoCurrency(currencyCode) && cryptoCurrencyOptional.isPresent())
+ return Optional.of(cryptoCurrencyOptional.get());
+
+ return Optional.empty();
+ }
public static FiatCurrency getCurrencyByCountryCode(String countryCode) {
if (countryCode.equals("XK"))
return new FiatCurrency("EUR");
- else
- return new FiatCurrency(Currency.getInstance(new Locale(LanguageUtil.getDefaultLanguage(), countryCode)).getCurrencyCode());
+
+ Currency currency = Currency.getInstance(new Locale(LanguageUtil.getDefaultLanguage(), countryCode));
+ return new FiatCurrency(currency.getCurrencyCode());
}
public static String getNameByCode(String currencyCode) {
if (isCryptoCurrency(currencyCode))
return getCryptoCurrency(currencyCode).get().getName();
- else
- try {
- return Currency.getInstance(currencyCode).getDisplayName();
- } catch (Throwable t) {
- log.debug("No currency name available " + t.getMessage());
- return currencyCode;
- }
- }
+ try {
+ return Currency.getInstance(currencyCode).getDisplayName();
+ } catch (Throwable t) {
+ log.debug("No currency name available " + t.getMessage());
+ return currencyCode;
+ }
+ }
public static String getNameAndCode(String currencyCode) {
return getNameByCode(currencyCode) + " (" + currencyCode + ")";
@@ -403,4 +303,17 @@ public static String getNameAndCode(String currencyCode) {
public static TradeCurrency getDefaultTradeCurrency() {
return GlobalSettings.getDefaultTradeCurrency();
}
+
+ private static boolean assetIsNotBaseCurrency(Asset asset) {
+ return !asset.getTickerSymbol().equals(baseCurrencyCode);
+ }
+
+ private static CryptoCurrency assetToCryptoCurrency(Asset asset) {
+ return new CryptoCurrency(asset.getTickerSymbol(), asset.getName(), asset instanceof Token);
+ }
+
+ private static boolean excludeBsqUnlessDaoTradingIsActive(Asset asset) {
+ return (!(asset instanceof BSQ) || (DevEnv.DAO_TRADING_ACTIVATED
+ && ((BSQ) asset).getNetwork().name().equals(BisqEnvironment.getBaseCurrencyNetwork().getNetwork())));
+ }
}
diff --git a/src/main/java/bisq/core/payment/validation/AltCoinAddressValidator.java b/src/main/java/bisq/core/payment/validation/AltCoinAddressValidator.java
index 51b38a05..5a8eb443 100644
--- a/src/main/java/bisq/core/payment/validation/AltCoinAddressValidator.java
+++ b/src/main/java/bisq/core/payment/validation/AltCoinAddressValidator.java
@@ -18,65 +18,31 @@
package bisq.core.payment.validation;
import bisq.core.app.BisqEnvironment;
+import bisq.core.btc.BaseCurrencyNetwork;
import bisq.core.locale.Res;
-import bisq.core.payment.validation.altcoins.ByteballAddressValidator;
-import bisq.core.payment.validation.altcoins.KOTOAddressValidator;
-import bisq.core.payment.validation.altcoins.NxtReedSolomonValidator;
-import bisq.core.payment.validation.altcoins.OctocoinAddressValidator;
-import bisq.core.payment.validation.altcoins.PNCAddressValidator;
-import bisq.core.payment.validation.altcoins.WMCCAddressValidator;
-import bisq.core.payment.validation.altcoins.XCNAddressValidator;
-import bisq.core.payment.validation.altcoins.YTNAddressValidator;
-import bisq.core.payment.validation.params.ACHParams;
-import bisq.core.payment.validation.params.AlcParams;
-import bisq.core.payment.validation.params.CageParams;
-import bisq.core.payment.validation.params.CreaParams;
-import bisq.core.payment.validation.params.ICHParams;
-import bisq.core.payment.validation.params.IOPParams;
-import bisq.core.payment.validation.params.ODNParams;
-import bisq.core.payment.validation.params.OctocoinParams;
-import bisq.core.payment.validation.params.OnionParams;
-import bisq.core.payment.validation.params.PARTParams;
-import bisq.core.payment.validation.params.PNCParams;
-import bisq.core.payment.validation.params.PhoreParams;
-import bisq.core.payment.validation.params.PivxParams;
-import bisq.core.payment.validation.params.SpeedCashParams;
-import bisq.core.payment.validation.params.StrayaParams;
-import bisq.core.payment.validation.params.TerracoinParams;
-import bisq.core.payment.validation.params.WACoinsParams;
-import bisq.core.payment.validation.params.WMCCParams;
-import bisq.core.payment.validation.params.XspecParams;
-import bisq.core.payment.validation.params.btc.BTGParams;
-import bisq.core.payment.validation.params.btc.BtcMainNetParamsForValidation;
import bisq.core.util.validation.InputValidator;
-import org.libdohj.params.DashMainNetParams;
-import org.libdohj.params.DashRegTestParams;
-import org.libdohj.params.DashTestNet3Params;
-import org.libdohj.params.DogecoinMainNetParams;
-import org.libdohj.params.LitecoinMainNetParams;
-import org.libdohj.params.LitecoinRegTestParams;
-import org.libdohj.params.LitecoinTestNet3Params;
+import bisq.asset.AddressValidationResult;
+import bisq.asset.Asset;
+import bisq.asset.AssetRegistry;
+import bisq.asset.Coin;
-import org.bitcoinj.core.Address;
-import org.bitcoinj.core.AddressFormatException;
-import org.bitcoinj.core.Base58;
-import org.bitcoinj.params.MainNetParams;
-import org.bitcoinj.params.RegTestParams;
-import org.bitcoinj.params.TestNet3Params;
+import com.google.inject.Inject;
import lombok.extern.slf4j.Slf4j;
-import org.jetbrains.annotations.NotNull;
+import static java.lang.String.format;
@Slf4j
public final class AltCoinAddressValidator extends InputValidator {
+ private final AssetRegistry assetRegistry;
private String currencyCode;
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Public methods
- ///////////////////////////////////////////////////////////////////////////////////////////
+ @Inject
+ public AltCoinAddressValidator(AssetRegistry assetRegistry) {
+ this.assetRegistry = assetRegistry;
+ }
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
@@ -85,517 +51,33 @@ public void setCurrencyCode(String currencyCode) {
@Override
public ValidationResult validate(String input) {
ValidationResult validationResult = super.validate(input);
- if (!validationResult.isValid || currencyCode == null) {
+ if (!validationResult.isValid || currencyCode == null)
return validationResult;
- } else {
- ValidationResult wrongChecksum = new ValidationResult(false,
- Res.get("validation.altcoin.wrongChecksum"));
- ValidationResult regexTestFailed = new ValidationResult(false,
- Res.get("validation.altcoin.wrongStructure", currencyCode));
-
- switch (currencyCode) {
- case "BTC":
- try {
- switch (BisqEnvironment.getBaseCurrencyNetwork()) {
- case BTC_MAINNET:
- Address.fromBase58(MainNetParams.get(), input);
- break;
- case BTC_TESTNET:
- Address.fromBase58(TestNet3Params.get(), input);
- break;
- case BTC_REGTEST:
- Address.fromBase58(RegTestParams.get(), input);
- break;
- case LTC_MAINNET:
- case LTC_TESTNET:
- case LTC_REGTEST:
- case DASH_MAINNET:
- case DASH_TESTNET:
- case DASH_REGTEST:
- // We cannot use MainNetParams because that would be one of the other base currencies,
- // so we cloned the MainNetParams to BtcMainNetParamsForValidation
- Address.fromBase58(BtcMainNetParamsForValidation.get(), input);
- return new ValidationResult(true);
- }
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "BSQ":
- if (!input.startsWith("B"))
- return new ValidationResult(false, Res.get("validation.altcoin.invalidAddress",
- currencyCode, "BSQ address must start with \"B\""));
- String addressAsBtc = input.substring(1, input.length());
- try {
- switch (BisqEnvironment.getBaseCurrencyNetwork()) {
- case BTC_MAINNET:
- Address.fromBase58(MainNetParams.get(), addressAsBtc);
- break;
- case BTC_TESTNET:
- Address.fromBase58(TestNet3Params.get(), addressAsBtc);
- break;
- case BTC_REGTEST:
- Address.fromBase58(RegTestParams.get(), addressAsBtc);
- break;
- }
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "LTC":
- try {
- switch (BisqEnvironment.getBaseCurrencyNetwork()) {
- case BTC_MAINNET:
- case BTC_TESTNET:
- case BTC_REGTEST:
- case DASH_MAINNET:
- case DASH_TESTNET:
- case DASH_REGTEST:
- case LTC_MAINNET:
- Address.fromBase58(LitecoinMainNetParams.get(), input);
- break;
- case LTC_TESTNET:
- Address.fromBase58(LitecoinTestNet3Params.get(), input);
- break;
- case LTC_REGTEST:
- Address.fromBase58(LitecoinRegTestParams.get(), input);
- break;
- }
- return new InputValidator.ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "DOGE":
- try {
- Address.fromBase58(DogecoinMainNetParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "DASH":
- try {
- switch (BisqEnvironment.getBaseCurrencyNetwork()) {
- case BTC_MAINNET:
- case BTC_TESTNET:
- case BTC_REGTEST:
- case LTC_MAINNET:
- case LTC_TESTNET:
- case LTC_REGTEST:
- case DASH_MAINNET:
- Address.fromBase58(DashMainNetParams.get(), input);
- break;
- case DASH_TESTNET:
- Address.fromBase58(DashTestNet3Params.get(), input);
- break;
- case DASH_REGTEST:
- Address.fromBase58(DashRegTestParams.get(), input);
- break;
- }
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "ETH":
- // https://github.com/ethereum/web3.js/blob/master/lib/utils/utils.js#L403
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "PIVX":
- if (input.matches("^[D][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(PivxParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
- case "IOP":
- if (input.matches("^[p][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(IOPParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
- case "888":
- if (input.matches("^[83][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- if (OctocoinAddressValidator.ValidateAddress(input)) {
- try {
- Address.fromBase58(OctocoinParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return wrongChecksum;
- }
- } else {
- return regexTestFailed;
- }
- case "ZEC":
- // We only support t addresses (transparent transactions)
- if (input.startsWith("t"))
- return validationResult;
- else
- return new ValidationResult(false, Res.get("validation.altcoin.zAddressesNotSupported"));
- case "GBYTE":
- return ByteballAddressValidator.validate(input);
- case "NXT":
- if (!input.startsWith("NXT-") || !input.equals(input.toUpperCase())) {
- return regexTestFailed;
- }
- try {
- long accountId = NxtReedSolomonValidator.decode(input.substring(4));
- return new ValidationResult(accountId != 0);
- } catch (NxtReedSolomonValidator.DecodeException e) {
- return wrongChecksum;
- }
- case "DCT":
- if (input.matches("^(?=.{5,63}$)([a-z][a-z0-9-]+[a-z0-9])(\\.[a-z][a-z0-9-]+[a-z0-9])*$"))
- return new ValidationResult(true);
- else
- return regexTestFailed;
- case "PNC":
- if (input.matches("^[P3][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- if (PNCAddressValidator.ValidateAddress(input)) {
- try {
- Address.fromBase58(PNCParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return wrongChecksum;
- }
- } else {
- return regexTestFailed;
- }
- case "WAC":
- try {
- Address.fromBase58(WACoinsParams.get(), input);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- return new ValidationResult(true);
- case "ZEN":
- try {
- // Get the non Base58 form of the address and the bytecode of the first two bytes
- byte[] byteAddress = Base58.decodeChecked(input);
- int version0 = byteAddress[0] & 0xFF;
- int version1 = byteAddress[1] & 0xFF;
+ Asset asset = assetRegistry.stream()
+ .filter(this::assetMatchesSelectedCurrencyCode)
+ .filter(this::assetIsNotBaseCurrencyForDifferentNetwork)
+ .findFirst()
+ .orElseThrow(() ->
+ new IllegalArgumentException(format("'%s' is not a registered asset", currencyCode)));
- // We only support public ("zn" (0x20,0x89), "t1" (0x1C,0xB8))
- // and multisig ("zs" (0x20,0x96), "t3" (0x1C,0xBD)) addresses
+ AddressValidationResult result = asset.validateAddress(input);
+ if (!result.isValid())
+ return new ValidationResult(false,
+ Res.get(result.getI18nKey(), asset.getTickerSymbol(), result.getMessage()));
- // Fail for private addresses
- if (version0 == 0x16 && version1 == 0x9A) {
- // Address starts with "zc"
- return new ValidationResult(false, Res.get("validation.altcoin.zAddressesNotSupported"));
- } else if (version0 == 0x1C && (version1 == 0xB8 || version1 == 0xBD)) {
- // "t1" or "t3" address
- return new ValidationResult(true);
- } else if (version0 == 0x20 && (version1 == 0x89 || version1 == 0x96)) {
- // "zn" or "zs" address
- return new ValidationResult(true);
- } else {
- // Unknown Type
- return new ValidationResult(false);
- }
- } catch (AddressFormatException e) {
- // Unhandled Exception (probably a checksum error)
- return new ValidationResult(false);
- }
- case "ELLA":
- // https://github.com/ethereum/web3.js/blob/master/lib/utils/utils.js#L403
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "XCN":
- // https://bitcointalk.org/index.php?topic=1801595
- return XCNAddressValidator.ValidateAddress(input);
- case "TRC":
- try {
- Address.fromBase58(TerracoinParams.get(), input);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- return new ValidationResult(true);
- case "INXT":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "PART":
- if (input.matches("^[RP][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(PARTParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
- case "MDC":
- if (input.matches("^m[a-zA-Z0-9]{26,33}$"))
- return new ValidationResult(true);
- else
- return regexTestFailed;
- case "BCH":
- try {
- Address.fromBase58(BtcMainNetParamsForValidation.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "BCHC":
- try {
- Address.fromBase58(BtcMainNetParamsForValidation.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "BTG":
- try {
- Address.fromBase58(BTGParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "CAGE":
- if (input.matches("^[D][a-zA-Z0-9]{26,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(CageParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
- case "CRED":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "XSPEC":
- try {
- Address.fromBase58(XspecParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "WILD":
- // https://github.com/ethereum/web3.js/blob/master/lib/utils/utils.js#L403
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "ONION":
- try {
- Address.fromBase58(OnionParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "CREA":
- try {
- Address.fromBase58(CreaParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "XIN":
- if (!input.matches("^XIN-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{5}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "BETR":
- // https://github.com/ethereum/web3.js/blob/master/lib/utils/utils.js#L403
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "MVT":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "REF":
- // https://github.com/ethereum/web3.js/blob/master/lib/utils/utils.js#L403
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "STL":
- if (!input.matches("^(Se)\\d[0-9A-Za-z]{94}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "DAI":
- // https://github.com/ethereum/web3.js/blob/master/lib/utils/utils.js#L403
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "YTN":
- return YTNAddressValidator.ValidateAddress(input);
- case "DARX":
- if (!input.matches("^[R][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "ODN":
- try {
- Address.fromBase58(ODNParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "CDT":
- if (input.startsWith("D"))
- return new ValidationResult(true);
- else
- return new ValidationResult(false);
- case "DGM":
- if (input.matches("^[D-E][a-zA-Z0-9]{33}$"))
- return new ValidationResult(true);
- else
- return regexTestFailed;
- case "SCS":
- try {
- Address.fromBase58(SpeedCashParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "SOS":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "ACH":
- try {
- Address.fromBase58(ACHParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- case "VDN":
- if (!input.matches("^[D][0-9a-zA-Z]{33}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "ALC":
- if (input.matches("^[A][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(AlcParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
- case "DIN":
- if (!input.matches("^[D][0-9a-zA-Z]{33}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "NAH":
- if (input.matches("^[S][a-zA-Z0-9]{26,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(StrayaParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
- case "ROI":
- if (!input.matches("^[R][0-9a-zA-Z]{33}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "WMCC":
- return WMCCAddressValidator.ValidateAddress(WMCCParams.get(), input);
- case "RTO":
- if (!input.matches("^[A][0-9A-Za-z]{94}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "KOTO":
- return KOTOAddressValidator.ValidateAddress(input);
- case "UBQ":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "QWARK":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "GEO":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "GRANS":
- if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
- return regexTestFailed;
- else
- return new ValidationResult(true);
- case "ICH":
- if (input.matches("^[A][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(ICHParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
- case "PHR":
- if (input.matches("^[P][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
- //noinspection ConstantConditions
- try {
- Address.fromBase58(PhoreParams.get(), input);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, getErrorMessage(e));
- }
- } else {
- return regexTestFailed;
- }
+ return new ValidationResult(true);
+ }
- // Add new coins at the end...
- default:
- log.debug("Validation for AltCoinAddress not implemented yet. currencyCode: " + currencyCode);
- return validationResult;
- }
- }
+ private boolean assetMatchesSelectedCurrencyCode(Asset a) {
+ return currencyCode.equals(a.getTickerSymbol());
}
- @NotNull
- private String getErrorMessage(AddressFormatException e) {
- return Res.get("validation.altcoin.invalidAddress", currencyCode, e.getMessage());
+ private boolean assetIsNotBaseCurrencyForDifferentNetwork(Asset asset) {
+ BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
+
+ return !(asset instanceof Coin)
+ || !asset.getTickerSymbol().equals(baseCurrencyNetwork.getCurrencyCode())
+ || (((Coin) asset).getNetwork().name().equals(baseCurrencyNetwork.getNetwork()));
}
}
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/ByteballAddressValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/ByteballAddressValidator.java
deleted file mode 100644
index 62e424ba..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/ByteballAddressValidator.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.altcoins;
-
-import bisq.core.util.validation.InputValidator;
-
-import org.apache.commons.codec.binary.Base32;
-import org.apache.commons.codec.binary.Base64;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Created by DevAlexey on 19.12.2016.
- */
-public class ByteballAddressValidator {
- private static final Base32 base32 = new Base32();
- private static final Base64 base64 = new Base64();
- private static final String PI = "14159265358979323846264338327950288419716939937510";
- private static final String[] arrRelativeOffsets = PI.split("");
- @SuppressWarnings("CanBeFinal")
- private static Integer[] arrOffsets160;
- @SuppressWarnings("CanBeFinal")
- private static Integer[] arrOffsets288;
-
- static {
- try {
- arrOffsets160 = calcOffsets(160);
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- arrOffsets288 = calcOffsets(288);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static InputValidator.ValidationResult validate(String input) {
- return new InputValidator.ValidationResult(isValidAddress(input));
- }
-
- private static boolean isValidAddress(String address) {
- return isValidChash(address, 32);
- }
-
- private static boolean isValidChash(String str, int len) {
- return (isStringOfLength(str, len) && isChashValid(str));
- }
-
- private static boolean isStringOfLength(String str, int len) {
- return str.length() == len;
- }
-
- private static void checkLength(int chash_length) throws Exception {
- if (chash_length != 160 && chash_length != 288)
- throw new Exception("unsupported c-hash length: " + chash_length);
- }
-
- private static Integer[] calcOffsets(int chash_length) throws Exception {
- checkLength(chash_length);
- List arrOffsets = new ArrayList<>(chash_length);
- int offset = 0;
- int index = 0;
-
- for (int i = 0; offset < chash_length; i++) {
- int relative_offset = Integer.parseInt(arrRelativeOffsets[i]);
- if (relative_offset == 0)
- continue;
- offset += relative_offset;
- if (chash_length == 288)
- offset += 4;
- if (offset >= chash_length)
- break;
- arrOffsets.add(offset);
- //console.log("index="+index+", offset="+offset);
- index++;
- }
-
- if (index != 32)
- throw new Exception("wrong number of checksum bits");
-
- //noinspection ToArrayCallWithZeroLengthArrayArgument
- return arrOffsets.toArray(new Integer[0]);
- }
-
- private static SeparatedData separateIntoCleanDataAndChecksum(String bin) throws Exception {
- int len = bin.length();
- Integer[] arrOffsets;
- if (len == 160)
- arrOffsets = arrOffsets160;
- else if (len == 288)
- arrOffsets = arrOffsets288;
- else
- throw new Exception("bad length");
- StringBuilder arrFrags = new StringBuilder();
- StringBuilder arrChecksumBits = new StringBuilder();
- int start = 0;
- //noinspection ForLoopReplaceableByForEach
- for (int i = 0; i < arrOffsets.length; i++) {
- arrFrags.append(bin.substring(start, arrOffsets[i]));
- arrChecksumBits.append(bin.substring(arrOffsets[i], arrOffsets[i] + 1));
- start = arrOffsets[i] + 1;
- }
- // add last frag
- if (start < bin.length())
- arrFrags.append(bin.substring(start));
- String binCleanData = arrFrags.toString();
- String binChecksum = arrChecksumBits.toString();
- return new SeparatedData(binCleanData, binChecksum);
- }
-
- private static String buffer2bin(byte[] buf) {
- StringBuilder bytes = new StringBuilder();
- //noinspection ForLoopReplaceableByForEach
- for (int i = 0; i < buf.length; i++) {
- String bin = String.format("%8s", Integer.toBinaryString(buf[i] & 0xFF)).replace(' ', '0');
- bytes.append(bin);
- }
- return bytes.toString();
- }
-
- private static byte[] bin2buffer(String bin) {
- int len = bin.length() / 8;
- byte[] buf = new byte[len];
- for (int i = 0; i < len; i++)
- buf[i] = (byte) Integer.parseInt(bin.substring(i * 8, (i + 1) * 8), 2);
- return buf;
- }
-
- private static boolean isChashValid(String encoded) {
- int encoded_len = encoded.length();
- if (encoded_len != 32 && encoded_len != 48) // 160/5 = 32, 288/6 = 48
- return false;
- byte[] chash = (encoded_len == 32) ? base32.decode(encoded) : base64.decode(encoded);
- String binChash = buffer2bin(chash);
- SeparatedData separated;
- try {
- separated = separateIntoCleanDataAndChecksum(binChash);
- } catch (Exception e) {
- return false;
- }
- byte[] clean_data = bin2buffer(separated.clean_data);
- byte[] checksum = bin2buffer(separated.checksum);
- return Arrays.equals(getChecksum(clean_data), checksum);
- }
-
- private static byte[] getChecksum(byte[] clean_data) {
-
- try {
- byte[] full_checksum = MessageDigest.getInstance("SHA-256").digest(clean_data);
- return new byte[]{full_checksum[5], full_checksum[13], full_checksum[21], full_checksum[29]};
- } catch (NoSuchAlgorithmException e) {
- return null;
- }
- }
-
- private static class SeparatedData {
- final String clean_data;
- final String checksum;
-
- public SeparatedData(String clean_data, String checksum) {
- this.clean_data = clean_data;
- this.checksum = checksum;
- }
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/KOTOAddressValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/KOTOAddressValidator.java
deleted file mode 100644
index a5ac3b35..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/KOTOAddressValidator.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.altcoins;
-
-
-import bisq.core.util.validation.InputValidator.ValidationResult;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import java.util.Arrays;
-
-public class KOTOAddressValidator {
- private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
-
- public static ValidationResult ValidateAddress(String addr) {
- if (addr.startsWith("z"))
- return new ValidationResult(false, "KOTO_Addr_Invalid: z Address not supported!");
- if (addr.length() != 35)
- return new ValidationResult(false, "KOTO_Addr_Invalid: Length must be 35!");
- if (!addr.startsWith("k1") && !addr.startsWith("jz"))
- return new ValidationResult(false, "KOTO_Addr_Invalid: must start with 'k1' or 'jz'!");
- byte[] decoded = decodeBase58(addr, 58, 26);
- if (decoded == null)
- return new ValidationResult(false, "KOTO_Addr_Invalid: Base58 decoder error!");
-
- byte[] hash = getSha256(decoded, 0, 22, 2);
- if (hash == null || !Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 22, 26)))
- return new ValidationResult(false, "KOTO_Addr_Invalid: Checksum error!");
-
- return new ValidationResult(true);
- }
-
- private static byte[] decodeBase58(String input, int base, int len) {
- byte[] output = new byte[len];
- for (int i = 0; i < input.length(); i++) {
- char t = input.charAt(i);
-
- int p = ALPHABET.indexOf(t);
- if (p == -1)
- return null;
- for (int j = len - 1; j >= 0; j--, p /= 256) {
- p += base * (output[j] & 0xFF);
- output[j] = (byte) (p % 256);
- }
- if (p != 0)
- return null;
- }
-
- return output;
- }
-
- private static byte[] getSha256(byte[] data, int start, int len, int recursion) {
- if (recursion == 0)
- return data;
-
- try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(Arrays.copyOfRange(data, start, start + len));
- return getSha256(md.digest(), 0, 32, recursion - 1);
- } catch (NoSuchAlgorithmException e) {
- return null;
- }
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/NxtReedSolomonValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/NxtReedSolomonValidator.java
deleted file mode 100644
index 477aed12..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/NxtReedSolomonValidator.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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 .
- */
-/*
- Reed Solomon Encoding and Decoding for Nxt
-
- Version: 1.0, license: Public Domain, coder: NxtChg (admin@nxtchg.com)
- Java Version: ChuckOne (ChuckOne@mail.de).
-*/
-
-package bisq.core.payment.validation.altcoins;
-
-public final class NxtReedSolomonValidator {
-
- private static final int[] initial_codeword = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- private static final int[] gexp = {1, 2, 4, 8, 16, 5, 10, 20, 13, 26, 17, 7, 14, 28, 29, 31, 27, 19, 3, 6, 12, 24, 21, 15, 30, 25, 23, 11, 22, 9, 18, 1};
- private static final int[] glog = {0, 0, 1, 18, 2, 5, 19, 11, 3, 29, 6, 27, 20, 8, 12, 23, 4, 10, 30, 17, 7, 22, 28, 26, 21, 25, 9, 16, 13, 14, 24, 15};
- private static final int[] codeword_map = {3, 2, 1, 0, 7, 6, 5, 4, 13, 14, 15, 16, 12, 8, 9, 10, 11};
- private static final String alphabet = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
-
- private static final int base_32_length = 13;
- private static final int base_10_length = 20;
-
- public static String encode(long plain) {
-
- String plain_string = Long.toUnsignedString(plain);
- int length = plain_string.length();
- int[] plain_string_10 = new int[NxtReedSolomonValidator.base_10_length];
- for (int i = 0; i < length; i++) {
- plain_string_10[i] = (int) plain_string.charAt(i) - (int) '0';
- }
-
- int codeword_length = 0;
- int[] codeword = new int[NxtReedSolomonValidator.initial_codeword.length];
-
- do { // base 10 to base 32 conversion
- int new_length = 0;
- int digit_32 = 0;
- for (int i = 0; i < length; i++) {
- digit_32 = digit_32 * 10 + plain_string_10[i];
- if (digit_32 >= 32) {
- plain_string_10[new_length] = digit_32 >> 5;
- digit_32 &= 31;
- new_length += 1;
- } else if (new_length > 0) {
- plain_string_10[new_length] = 0;
- new_length += 1;
- }
- }
- length = new_length;
- codeword[codeword_length] = digit_32;
- codeword_length += 1;
- } while (length > 0);
-
- int[] p = {0, 0, 0, 0};
- for (int i = NxtReedSolomonValidator.base_32_length - 1; i >= 0; i--) {
- final int fb = codeword[i] ^ p[3];
- p[3] = p[2] ^ NxtReedSolomonValidator.gmult(30, fb);
- p[2] = p[1] ^ NxtReedSolomonValidator.gmult(6, fb);
- p[1] = p[0] ^ NxtReedSolomonValidator.gmult(9, fb);
- p[0] = NxtReedSolomonValidator.gmult(17, fb);
- }
-
- System.arraycopy(p, 0, codeword, NxtReedSolomonValidator.base_32_length, NxtReedSolomonValidator.initial_codeword.length - NxtReedSolomonValidator.base_32_length);
-
- StringBuilder cypher_string_builder = new StringBuilder();
- for (int i = 0; i < 17; i++) {
- final int codework_index = NxtReedSolomonValidator.codeword_map[i];
- final int alphabet_index = codeword[codework_index];
- cypher_string_builder.append(NxtReedSolomonValidator.alphabet.charAt(alphabet_index));
-
- if ((i & 3) == 3 && i < 13) {
- cypher_string_builder.append('-');
- }
- }
- return cypher_string_builder.toString();
- }
-
- public static long decode(String cypher_string) throws DecodeException {
-
- int[] codeword = new int[NxtReedSolomonValidator.initial_codeword.length];
- System.arraycopy(NxtReedSolomonValidator.initial_codeword, 0, codeword, 0, NxtReedSolomonValidator.initial_codeword.length);
-
- int codeword_length = 0;
- for (int i = 0; i < cypher_string.length(); i++) {
- int position_in_alphabet = NxtReedSolomonValidator.alphabet.indexOf(cypher_string.charAt(i));
-
- if (position_in_alphabet <= -1 || position_in_alphabet > NxtReedSolomonValidator.alphabet.length()) {
- continue;
- }
-
- if (codeword_length > 16) {
- throw new CodewordTooLongException();
- }
-
- int codework_index = NxtReedSolomonValidator.codeword_map[codeword_length];
- codeword[codework_index] = position_in_alphabet;
- codeword_length += 1;
- }
-
- if (codeword_length == 17 && !NxtReedSolomonValidator.is_codeword_valid(codeword) || codeword_length != 17) {
- throw new CodewordInvalidException();
- }
-
- int length = NxtReedSolomonValidator.base_32_length;
- int[] cypher_string_32 = new int[length];
- for (int i = 0; i < length; i++) {
- cypher_string_32[i] = codeword[length - i - 1];
- }
-
- StringBuilder plain_string_builder = new StringBuilder();
- do { // base 32 to base 10 conversion
- int new_length = 0;
- int digit_10 = 0;
-
- for (int i = 0; i < length; i++) {
- digit_10 = digit_10 * 32 + cypher_string_32[i];
-
- if (digit_10 >= 10) {
- cypher_string_32[new_length] = digit_10 / 10;
- digit_10 %= 10;
- new_length += 1;
- } else if (new_length > 0) {
- cypher_string_32[new_length] = 0;
- new_length += 1;
- }
- }
- length = new_length;
- plain_string_builder.append((char) (digit_10 + (int) '0'));
- } while (length > 0);
-
- return Long.parseUnsignedLong(plain_string_builder.reverse().toString());
- }
-
- private static int gmult(int a, int b) {
- if (a == 0 || b == 0) {
- return 0;
- }
-
- int idx = (NxtReedSolomonValidator.glog[a] + NxtReedSolomonValidator.glog[b]) % 31;
-
- return NxtReedSolomonValidator.gexp[idx];
- }
-
- private static boolean is_codeword_valid(int[] codeword) {
- int sum = 0;
-
- for (int i = 1; i < 5; i++) {
- int t = 0;
-
- for (int j = 0; j < 31; j++) {
- if (j > 12 && j < 27) {
- continue;
- }
-
- int pos = j;
- if (j > 26) {
- pos -= 14;
- }
-
- t ^= NxtReedSolomonValidator.gmult(codeword[pos], NxtReedSolomonValidator.gexp[(i * j) % 31]);
- }
-
- sum |= t;
- }
-
- return sum == 0;
- }
-
- public abstract static class DecodeException extends Exception {
- }
-
- static final class CodewordTooLongException extends DecodeException {
- }
-
- static final class CodewordInvalidException extends DecodeException {
- }
-
- private NxtReedSolomonValidator() {
- } // never
-}
-
-
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/OctocoinAddressValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/OctocoinAddressValidator.java
deleted file mode 100644
index c5f9cbb5..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/OctocoinAddressValidator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.altcoins;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import java.util.Arrays;
-
-public class OctocoinAddressValidator {
- private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
-
- public static boolean ValidateAddress(String addr) {
- if (addr.length() < 26 || addr.length() > 35) return false;
- byte[] decoded = decodeBase58(addr, 58, 25);
- if (decoded == null) return false;
-
- byte[] hash = getSha256(decoded, 0, 21, 2);
- return hash != null && Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 21, 25));
- }
-
- private static byte[] decodeBase58(String input, int base, int len) {
- byte[] output = new byte[len];
- for (int i = 0; i < input.length(); i++) {
- char t = input.charAt(i);
-
- int p = ALPHABET.indexOf(t);
- if (p == -1) return null;
- for (int j = len - 1; j >= 0; j--, p /= 256) {
- p += base * (output[j] & 0xFF);
- output[j] = (byte) (p % 256);
- }
- if (p != 0) return null;
- }
-
- return output;
- }
-
- private static byte[] getSha256(byte[] data, int start, int len, int recursion) {
- if (recursion == 0) return data;
-
- try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(Arrays.copyOfRange(data, start, start + len));
- return getSha256(md.digest(), 0, 32, recursion - 1);
- } catch (NoSuchAlgorithmException e) {
- return null;
- }
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/PNCAddressValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/PNCAddressValidator.java
deleted file mode 100644
index fec3ad73..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/PNCAddressValidator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.altcoins;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import java.util.Arrays;
-
-public class PNCAddressValidator {
- private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
-
- public static boolean ValidateAddress(String addr) {
- if (addr.length() < 26 || addr.length() > 35) return false;
- byte[] decoded = decodeBase58(addr, 58, 25);
- if (decoded == null) return false;
-
- byte[] hash = getSha256(decoded, 0, 21, 2);
- return hash != null && Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 21, 25));
- }
-
- private static byte[] decodeBase58(String input, int base, int len) {
- byte[] output = new byte[len];
- for (int i = 0; i < input.length(); i++) {
- char t = input.charAt(i);
-
- int p = ALPHABET.indexOf(t);
- if (p == -1) return null;
- for (int j = len - 1; j >= 0; j--, p /= 256) {
- p += base * (output[j] & 0xFF);
- output[j] = (byte) (p % 256);
- }
- if (p != 0) return null;
- }
-
- return output;
- }
-
- private static byte[] getSha256(byte[] data, int start, int len, int recursion) {
- if (recursion == 0) return data;
-
- try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(Arrays.copyOfRange(data, start, start + len));
- return getSha256(md.digest(), 0, 32, recursion - 1);
- } catch (NoSuchAlgorithmException e) {
- return null;
- }
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/WMCCAddressValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/WMCCAddressValidator.java
deleted file mode 100644
index eadf653b..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/WMCCAddressValidator.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.altcoins;
-
-import bisq.core.util.validation.InputValidator.ValidationResult;
-
-import org.bitcoinj.core.Address;
-import org.bitcoinj.core.AddressFormatException;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.VersionedChecksummedBytes;
-import org.bitcoinj.params.Networks;
-
-import java.io.ByteArrayOutputStream;
-
-import java.util.Arrays;
-import java.util.Locale;
-
-import javax.annotation.Nullable;
-
-public class WMCCAddressValidator {
- public static ValidationResult ValidateAddress(NetworkParameters params, String address) {
- if (!isLowerCase(address)) {
- try {
- Address.fromBase58(params, address);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, "Invalid Base58 Addr: " + e.getMessage());
- }
- }
-
- try {
- WitnessAddress.fromBech32(params, address);
- return new ValidationResult(true);
- } catch (AddressFormatException e) {
- return new ValidationResult(false, "Invalid Bech32 Addr: " + e.getMessage());
- }
- }
-
- private static boolean isLowerCase(String str) {
- char ch;
- for (int i = 0; i < str.length(); i++) {
- ch = str.charAt(i);
- if (Character.isDigit(ch))
- continue;
- if (!Character.isLowerCase(ch))
- return false;
- }
- return true;
- }
-}
-
-/* Add to support bech32 address*/
-class WitnessAddress extends VersionedChecksummedBytes {
- public static final int PROGRAM_LENGTH_PKH = 20;
- public static final int PROGRAM_LENGTH_SH = 32;
- public static final int PROGRAM_MIN_LENGTH = 2;
- public static final int PROGRAM_MAX_LENGTH = 40;
- public static final String WITNESS_ADDRESS_HRP = "wc";
-
- private WitnessAddress(NetworkParameters params, byte[] data) throws AddressFormatException {
- super(params.getAddressHeader(), data);
- if (data.length < 1)
- throw new AddressFormatException("Zero data found");
- final int version = getWitnessVersion();
- if (version < 0 || version > 16)
- throw new AddressFormatException("Invalid script version: " + version);
- byte[] program = getWitnessProgram();
- if (program.length < PROGRAM_MIN_LENGTH || program.length > PROGRAM_MAX_LENGTH)
- throw new AddressFormatException("Invalid length: " + program.length);
- if (version == 0 && program.length != PROGRAM_LENGTH_PKH
- && program.length != PROGRAM_LENGTH_SH)
- throw new AddressFormatException(
- "Invalid length for address version 0: " + program.length);
- }
-
- public int getWitnessVersion() {
- return bytes[0] & 0xff;
- }
-
- public byte[] getWitnessProgram() {
- return convertBits(bytes, 1, bytes.length - 1, 5, 8, false);
- }
-
- public static WitnessAddress fromBech32(@Nullable NetworkParameters params, String bech32)
- throws AddressFormatException {
- Bech32.Bech32Data bechData = Bech32.decode(bech32);
- if (params == null) {
- for (NetworkParameters p : Networks.get()) {
- if (bechData.hrp.equals(WITNESS_ADDRESS_HRP))
- return new WitnessAddress(p, bechData.data);
- }
- throw new AddressFormatException("Invalid Prefix: No network found for " + bech32);
- } else {
- if (bechData.hrp.equals(WITNESS_ADDRESS_HRP))
- return new WitnessAddress(params, bechData.data);
- throw new AddressFormatException("Wrong Network: " + bechData.hrp);
- }
- }
-
- /**
- * Helper
- */
- private static byte[] convertBits(final byte[] in, final int inStart, final int inLen, final int fromBits,
- final int toBits, final boolean pad) throws AddressFormatException {
- int acc = 0;
- int bits = 0;
- ByteArrayOutputStream out = new ByteArrayOutputStream(64);
- final int maxv = (1 << toBits) - 1;
- final int max_acc = (1 << (fromBits + toBits - 1)) - 1;
- for (int i = 0; i < inLen; i++) {
- int value = in[i + inStart] & 0xff;
- if ((value >>> fromBits) != 0) {
- throw new AddressFormatException(
- String.format("Input value '%X' exceeds '%d' bit size", value, fromBits));
- }
- acc = ((acc << fromBits) | value) & max_acc;
- bits += fromBits;
- while (bits >= toBits) {
- bits -= toBits;
- out.write((acc >>> bits) & maxv);
- }
- }
- if (pad) {
- if (bits > 0)
- out.write((acc << (toBits - bits)) & maxv);
- } else if (bits >= fromBits || ((acc << (toBits - bits)) & maxv) != 0) {
- throw new AddressFormatException("Could not convert bits, invalid padding");
- }
- return out.toByteArray();
- }
-}
-
-/* Bech32 decoder */
-class Bech32 {
- private static final byte[] CHARSET_REV = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, 10, 17, 21, 20, 26, 30, 7, 5, -1, -1, -1, -1, -1, -1,
- -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1, 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1,
- -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1, 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1
- };
-
- public static class Bech32Data {
- final String hrp;
- final byte[] data;
-
- private Bech32Data(final String hrp, final byte[] data) {
- this.hrp = hrp;
- this.data = data;
- }
- }
-
- private static int polymod(final byte[] values) {
- int c = 1;
- for (byte v_i : values) {
- int c0 = (c >>> 25) & 0xff;
- c = ((c & 0x1ffffff) << 5) ^ (v_i & 0xff);
- if ((c0 & 1) != 0) c ^= 0x3b6a57b2;
- if ((c0 & 2) != 0) c ^= 0x26508e6d;
- if ((c0 & 4) != 0) c ^= 0x1ea119fa;
- if ((c0 & 8) != 0) c ^= 0x3d4233dd;
- if ((c0 & 16) != 0) c ^= 0x2a1462b3;
- }
- return c;
- }
-
- private static byte[] expandHrp(final String hrp) {
- int len = hrp.length();
- byte ret[] = new byte[len * 2 + 1];
- for (int i = 0; i < len; ++i) {
- int c = hrp.charAt(i) & 0x7f;
- ret[i] = (byte) ((c >>> 5) & 0x07);
- ret[i + len + 1] = (byte) (c & 0x1f);
- }
- ret[len] = 0;
- return ret;
- }
-
- private static boolean verifyChecksum(final String hrp, final byte[] values) {
- byte[] exp = expandHrp(hrp);
- byte[] combined = new byte[exp.length + values.length];
- System.arraycopy(exp, 0, combined, 0, exp.length);
- System.arraycopy(values, 0, combined, exp.length, values.length);
- return polymod(combined) == 1;
- }
-
- public static Bech32Data decode(final String str) throws AddressFormatException {
- boolean lower = false, upper = false;
- int len = str.length();
- if (len < 8)
- throw new AddressFormatException("Input too short: " + len);
- if (len > 90)
- throw new AddressFormatException("Input too long: " + len);
- for (int i = 0; i < len; ++i) {
- char c = str.charAt(i);
- if (c < 33 || c > 126) throw new AddressFormatException(invalidChar(c, i));
- if (c >= 'a' && c <= 'z') {
- if (upper)
- throw new AddressFormatException(invalidChar(c, i));
- lower = true;
- }
- if (c >= 'A' && c <= 'Z') {
- if (lower)
- throw new AddressFormatException(invalidChar(c, i));
- upper = true;
- }
- }
- final int pos = str.lastIndexOf('1');
- if (pos < 1) throw new AddressFormatException("Invalid Prefix: Missing human-readable part");
- final int dataLen = len - 1 - pos;
- if (dataLen < 6) throw new AddressFormatException("Data part too short: " + dataLen);
- byte[] values = new byte[dataLen];
- for (int i = 0; i < dataLen; ++i) {
- char c = str.charAt(i + pos + 1);
- if (CHARSET_REV[c] == -1) throw new AddressFormatException(invalidChar(c, i + pos + 1));
- values[i] = CHARSET_REV[c];
- }
- String hrp = str.substring(0, pos).toLowerCase(Locale.ROOT);
- if (!verifyChecksum(hrp, values)) throw new AddressFormatException("Invalid Checksum");
- return new Bech32Data(hrp, Arrays.copyOfRange(values, 0, values.length - 6));
- }
-
- private static String invalidChar(char c, int i) {
- return "Invalid character '" + Character.toString(c) + "' at position " + i;
- }
-
- ;
-}
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/XCNAddressValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/XCNAddressValidator.java
deleted file mode 100644
index 3d3274c4..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/XCNAddressValidator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.altcoins;
-
-import bisq.core.util.validation.InputValidator.ValidationResult;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import java.util.Arrays;
-
-public class XCNAddressValidator {
- private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
-
- public static ValidationResult ValidateAddress(String addr) {
- if (addr.length() != 34)
- return new ValidationResult(false, "XCN_Addr_Invalid: Length must be 34!");
- if (!addr.startsWith("C"))
- return new ValidationResult(false, "XCN_Addr_Invalid: must start with 'C'!");
- byte[] decoded = decodeBase58(addr, 58, 25);
- if (decoded == null)
- return new ValidationResult(false, "XCN_Addr_Invalid: Base58 decoder error!");
-
- byte[] hash = getSha256(decoded, 0, 21, 2);
- if (hash == null || !Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 21, 25)))
- return new ValidationResult(false, "XCN_Addr_Invalid: Checksum error!");
- return new ValidationResult(true);
- }
-
- private static byte[] decodeBase58(String input, int base, int len) {
- byte[] output = new byte[len];
- for (int i = 0; i < input.length(); i++) {
- char t = input.charAt(i);
-
- int p = ALPHABET.indexOf(t);
- if (p == -1)
- return null;
- for (int j = len - 1; j >= 0; j--, p /= 256) {
- p += base * (output[j] & 0xFF);
- output[j] = (byte) (p % 256);
- }
- if (p != 0)
- return null;
- }
-
- return output;
- }
-
- private static byte[] getSha256(byte[] data, int start, int len, int recursion) {
- if (recursion == 0)
- return data;
-
- try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(Arrays.copyOfRange(data, start, start + len));
- return getSha256(md.digest(), 0, 32, recursion - 1);
- } catch (NoSuchAlgorithmException e) {
- return null;
- }
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/altcoins/YTNAddressValidator.java b/src/main/java/bisq/core/payment/validation/altcoins/YTNAddressValidator.java
deleted file mode 100644
index 16fca2aa..00000000
--- a/src/main/java/bisq/core/payment/validation/altcoins/YTNAddressValidator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.altcoins;
-
-
-import bisq.core.util.validation.InputValidator.ValidationResult;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import java.util.Arrays;
-
-public class YTNAddressValidator {
- private final static String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
-
- public static ValidationResult ValidateAddress(String addr) {
- if (addr.length() != 34)
- return new ValidationResult(false, "YTN_Addr_Invalid: Length must be 34!");
- if (!addr.startsWith("Y"))
- return new ValidationResult(false, "YTN_Addr_Invalid: must start with 'Y'!");
- byte[] decoded = decodeBase58(addr, 58, 25);
- if (decoded == null)
- return new ValidationResult(false, "YTN_Addr_Invalid: Base58 decoder error!");
-
- byte[] hash = getSha256(decoded, 0, 21, 2);
- if (hash == null || !Arrays.equals(Arrays.copyOfRange(hash, 0, 4), Arrays.copyOfRange(decoded, 21, 25)))
- return new ValidationResult(false, "YTN_Addr_Invalid: Checksum error!");
- return new ValidationResult(true);
- }
-
- private static byte[] decodeBase58(String input, int base, int len) {
- byte[] output = new byte[len];
- for (int i = 0; i < input.length(); i++) {
- char t = input.charAt(i);
-
- int p = ALPHABET.indexOf(t);
- if (p == -1)
- return null;
- for (int j = len - 1; j >= 0; j--, p /= 256) {
- p += base * (output[j] & 0xFF);
- output[j] = (byte) (p % 256);
- }
- if (p != 0)
- return null;
- }
-
- return output;
- }
-
- private static byte[] getSha256(byte[] data, int start, int len, int recursion) {
- if (recursion == 0)
- return data;
-
- try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(Arrays.copyOfRange(data, start, start + len));
- return getSha256(md.digest(), 0, 32, recursion - 1);
- } catch (NoSuchAlgorithmException e) {
- return null;
- }
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/ACHParams.java b/src/main/java/bisq/core/payment/validation/params/ACHParams.java
deleted file mode 100644
index 3e5ef7f9..00000000
--- a/src/main/java/bisq/core/payment/validation/params/ACHParams.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 .
- */
-
-/*
- * Copyright 2013 Google Inc.
- * Copyright 2015 Andreas Schildbach
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.Utils;
-import org.bitcoinj.params.AbstractBitcoinNetParams;
-
-public class ACHParams extends AbstractBitcoinNetParams {
-
- public ACHParams() {
- super();
- interval = INTERVAL;
- targetTimespan = TARGET_TIMESPAN;
- maxTarget = Utils.decodeCompactBits(0x1d00ffffL);
- dumpedPrivateKeyHeader = 128;
-
- // Address format is different to BTC, rest is the same
- addressHeader = 23; //BTG 38;
- p2shHeader = 34; //BTG 23;
-
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- port = 7337; //BTC and BTG 8333
- packetMagic = 0x1461de3cL; //BTG 0xe1476d44L, BTC 0xf9beb4d9L;
- bip32HeaderPub = 0x02651F71; //BTG and BTC 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub".
- bip32HeaderPriv = 0x02355E56; //BTG and BTC 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv"
-
- id = ID_MAINNET;
- }
-
- private static ACHParams instance;
-
- public static synchronized ACHParams get() {
- if (instance == null) {
- instance = new ACHParams();
- }
- return instance;
- }
-
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/AlcParams.java b/src/main/java/bisq/core/payment/validation/params/AlcParams.java
deleted file mode 100644
index d8fafaf5..00000000
--- a/src/main/java/bisq/core/payment/validation/params/AlcParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class AlcParams extends NetworkParameters {
-
- private static AlcParams instance;
-
- public static synchronized AlcParams get() {
- if (instance == null) {
- instance = new AlcParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public AlcParams() {
- super();
- addressHeader = 23;
- p2shHeader = 5;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/CageParams.java b/src/main/java/bisq/core/payment/validation/params/CageParams.java
deleted file mode 100644
index 0ac25baa..00000000
--- a/src/main/java/bisq/core/payment/validation/params/CageParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class CageParams extends NetworkParameters {
-
- private static CageParams instance;
-
- public static synchronized CageParams get() {
- if (instance == null) {
- instance = new CageParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public CageParams() {
- super();
- addressHeader = 31;
- p2shHeader = 13;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/CreaParams.java b/src/main/java/bisq/core/payment/validation/params/CreaParams.java
deleted file mode 100644
index d91427bf..00000000
--- a/src/main/java/bisq/core/payment/validation/params/CreaParams.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class CreaParams extends NetworkParameters {
-
- private static CreaParams instance;
-
- public static synchronized CreaParams get() {
- if (instance == null) {
- instance = new CreaParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
-
- public CreaParams() {
- super();
- int segwitHeader = 35;
- addressHeader = 28;
- p2shHeader = 5;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader, segwitHeader};
-
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/ICHParams.java b/src/main/java/bisq/core/payment/validation/params/ICHParams.java
deleted file mode 100644
index 7b42ade5..00000000
--- a/src/main/java/bisq/core/payment/validation/params/ICHParams.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class ICHParams extends NetworkParameters {
-
- private static ICHParams instance;
-
- public static synchronized ICHParams get() {
- if (instance == null) {
- instance = new ICHParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public ICHParams() {
- super();
- addressHeader = 23;
- p2shHeader = 13;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore)
- throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/IOPParams.java b/src/main/java/bisq/core/payment/validation/params/IOPParams.java
deleted file mode 100644
index b1f49e68..00000000
--- a/src/main/java/bisq/core/payment/validation/params/IOPParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class IOPParams extends NetworkParameters {
-
- private static IOPParams instance;
-
- public static synchronized IOPParams get() {
- if (instance == null) {
- instance = new IOPParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public IOPParams() {
- super();
- addressHeader = 117;
- p2shHeader = 174;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/ODNParams.java b/src/main/java/bisq/core/payment/validation/params/ODNParams.java
deleted file mode 100644
index a8af1049..00000000
--- a/src/main/java/bisq/core/payment/validation/params/ODNParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class ODNParams extends NetworkParameters {
-
- private static ODNParams instance;
-
- public static synchronized ODNParams get() {
- if (instance == null) {
- instance = new ODNParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public ODNParams() {
- super();
- addressHeader = 75;
- p2shHeader = 125;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/OctocoinParams.java b/src/main/java/bisq/core/payment/validation/params/OctocoinParams.java
deleted file mode 100644
index ac000e15..00000000
--- a/src/main/java/bisq/core/payment/validation/params/OctocoinParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class OctocoinParams extends NetworkParameters {
-
- private static OctocoinParams instance;
-
- public static synchronized OctocoinParams get() {
- if (instance == null) {
- instance = new OctocoinParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public OctocoinParams() {
- super();
- addressHeader = 18;
- p2shHeader = 5;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/OnionParams.java b/src/main/java/bisq/core/payment/validation/params/OnionParams.java
deleted file mode 100644
index 1f7d55ad..00000000
--- a/src/main/java/bisq/core/payment/validation/params/OnionParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class OnionParams extends NetworkParameters {
-
- private static OnionParams instance;
-
- public static synchronized OnionParams get() {
- if (instance == null) {
- instance = new OnionParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public OnionParams() {
- super();
- addressHeader = 31;
- p2shHeader = 78;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/PARTParams.java b/src/main/java/bisq/core/payment/validation/params/PARTParams.java
deleted file mode 100644
index 8ef5d70e..00000000
--- a/src/main/java/bisq/core/payment/validation/params/PARTParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class PARTParams extends NetworkParameters {
-
- private static PARTParams instance;
-
- public static synchronized PARTParams get() {
- if (instance == null) {
- instance = new PARTParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public PARTParams() {
- super();
- addressHeader = 56;
- p2shHeader = 60;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/PhoreParams.java b/src/main/java/bisq/core/payment/validation/params/PhoreParams.java
deleted file mode 100644
index 87cfbbb6..00000000
--- a/src/main/java/bisq/core/payment/validation/params/PhoreParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class PhoreParams extends NetworkParameters {
-
- private static PhoreParams instance;
-
- public static synchronized PhoreParams get() {
- if (instance == null) {
- instance = new PhoreParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public PhoreParams() {
- super();
- addressHeader = 55;
- p2shHeader = 13;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/PivxParams.java b/src/main/java/bisq/core/payment/validation/params/PivxParams.java
deleted file mode 100644
index 7dd5ea15..00000000
--- a/src/main/java/bisq/core/payment/validation/params/PivxParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class PivxParams extends NetworkParameters {
-
- private static PivxParams instance;
-
- public static synchronized PivxParams get() {
- if (instance == null) {
- instance = new PivxParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public PivxParams() {
- super();
- addressHeader = 30;
- p2shHeader = 13;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/SpeedCashParams.java b/src/main/java/bisq/core/payment/validation/params/SpeedCashParams.java
deleted file mode 100644
index abfb1c64..00000000
--- a/src/main/java/bisq/core/payment/validation/params/SpeedCashParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class SpeedCashParams extends NetworkParameters {
-
- private static SpeedCashParams instance;
-
- public static synchronized SpeedCashParams get() {
- if (instance == null) {
- instance = new SpeedCashParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public SpeedCashParams() {
- super();
- addressHeader = 63;
- p2shHeader = 85;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/StrayaParams.java b/src/main/java/bisq/core/payment/validation/params/StrayaParams.java
deleted file mode 100644
index 6d168c29..00000000
--- a/src/main/java/bisq/core/payment/validation/params/StrayaParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class StrayaParams extends NetworkParameters {
-
- private static StrayaParams instance;
-
- public static synchronized StrayaParams get() {
- if (instance == null) {
- instance = new StrayaParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public StrayaParams() {
- super();
- addressHeader = 63;
- p2shHeader = 50;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/TerracoinParams.java b/src/main/java/bisq/core/payment/validation/params/TerracoinParams.java
deleted file mode 100644
index 74a8a026..00000000
--- a/src/main/java/bisq/core/payment/validation/params/TerracoinParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class TerracoinParams extends NetworkParameters {
-
- private static TerracoinParams instance;
-
- public static synchronized TerracoinParams get() {
- if (instance == null) {
- instance = new TerracoinParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public TerracoinParams() {
- super();
- addressHeader = 0;
- p2shHeader = 5;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/WACoinsParams.java b/src/main/java/bisq/core/payment/validation/params/WACoinsParams.java
deleted file mode 100644
index 4ff44527..00000000
--- a/src/main/java/bisq/core/payment/validation/params/WACoinsParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class WACoinsParams extends NetworkParameters {
-
- private static WACoinsParams instance;
-
- public static synchronized WACoinsParams get() {
- if (instance == null) {
- instance = new WACoinsParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public WACoinsParams() {
- super();
- addressHeader = 73;
- p2shHeader = 3;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/WMCCParams.java b/src/main/java/bisq/core/payment/validation/params/WMCCParams.java
deleted file mode 100644
index 0f28ae12..00000000
--- a/src/main/java/bisq/core/payment/validation/params/WMCCParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class WMCCParams extends NetworkParameters {
-
- private static WMCCParams instance;
-
- public static synchronized WMCCParams get() {
- if (instance == null) {
- instance = new WMCCParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public WMCCParams() {
- super();
- addressHeader = 0x49;
- p2shHeader = 0x4b;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/XspecParams.java b/src/main/java/bisq/core/payment/validation/params/XspecParams.java
deleted file mode 100644
index b39886ab..00000000
--- a/src/main/java/bisq/core/payment/validation/params/XspecParams.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-package bisq.core.payment.validation.params;
-
-import org.bitcoinj.core.BitcoinSerializer;
-import org.bitcoinj.core.Block;
-import org.bitcoinj.core.Coin;
-import org.bitcoinj.core.NetworkParameters;
-import org.bitcoinj.core.StoredBlock;
-import org.bitcoinj.core.VerificationException;
-import org.bitcoinj.store.BlockStore;
-import org.bitcoinj.store.BlockStoreException;
-import org.bitcoinj.utils.MonetaryFormat;
-
-public class XspecParams extends NetworkParameters {
-
- private static XspecParams instance;
-
- public static synchronized XspecParams get() {
- if (instance == null) {
- instance = new XspecParams();
- }
- return instance;
- }
-
- // We only use the properties needed for address validation
- public XspecParams() {
- super();
- addressHeader = 63;
- p2shHeader = 136;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- }
-
- // default dummy implementations, not used...
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-
- @Override
- public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
- }
-
- @Override
- public Coin getMaxMoney() {
- return null;
- }
-
- @Override
- public Coin getMinNonDustOutput() {
- return null;
- }
-
- @Override
- public MonetaryFormat getMonetaryFormat() {
- return null;
- }
-
- @Override
- public String getUriScheme() {
- return null;
- }
-
- @Override
- public boolean hasMaxMoney() {
- return false;
- }
-
- @Override
- public BitcoinSerializer getSerializer(boolean parseRetain) {
- return null;
- }
-
- @Override
- public int getProtocolVersionNum(ProtocolVersion version) {
- return 0;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/btc/BTGParams.java b/src/main/java/bisq/core/payment/validation/params/btc/BTGParams.java
deleted file mode 100644
index d7f0ddf1..00000000
--- a/src/main/java/bisq/core/payment/validation/params/btc/BTGParams.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 .
- */
-
-/*
- * Copyright 2013 Google Inc.
- * Copyright 2015 Andreas Schildbach
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package bisq.core.payment.validation.params.btc;
-
-import org.bitcoinj.core.Utils;
-
-public class BTGParams extends AbstractBitcoinNetParams {
-
- public BTGParams() {
- super();
- interval = INTERVAL;
- targetTimespan = TARGET_TIMESPAN;
- maxTarget = Utils.decodeCompactBits(0x1d00ffffL);
- dumpedPrivateKeyHeader = 128;
-
- // Address format is different to BTC, rest is the same
- addressHeader = 38;
- p2shHeader = 23;
-
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- port = 8333;
- packetMagic = 0xf9beb4d9L;
- bip32HeaderPub = 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub".
- bip32HeaderPriv = 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv"
-
- id = ID_MAINNET;
- }
-
- private static BTGParams instance;
-
- public static synchronized BTGParams get() {
- if (instance == null) {
- instance = new BTGParams();
- }
- return instance;
- }
-
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-}
diff --git a/src/main/java/bisq/core/payment/validation/params/btc/BtcMainNetParamsForValidation.java b/src/main/java/bisq/core/payment/validation/params/btc/BtcMainNetParamsForValidation.java
deleted file mode 100644
index 76428f1e..00000000
--- a/src/main/java/bisq/core/payment/validation/params/btc/BtcMainNetParamsForValidation.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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 .
- */
-
-/*
- * Copyright 2013 Google Inc.
- * Copyright 2015 Andreas Schildbach
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package bisq.core.payment.validation.params.btc;
-
-import org.bitcoinj.core.ECKey;
-import org.bitcoinj.core.Sha256Hash;
-import org.bitcoinj.core.Utils;
-import org.bitcoinj.net.discovery.HttpDiscovery;
-
-import java.net.URI;
-
-import static com.google.common.base.Preconditions.checkState;
-
-/**
- * Parameters for the main production network on which people trade goods and services.
- *
- * We cannot use MainNetParams because that would be one of the other base currencies,
- * so we cloned the MainNetParams to BtcMainNetParamsForValidation
- */
-public class BtcMainNetParamsForValidation extends AbstractBitcoinNetParams {
- public static final int MAINNET_MAJORITY_WINDOW = 1000;
- public static final int MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED = 950;
- public static final int MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE = 750;
-
- public BtcMainNetParamsForValidation() {
- super();
- interval = INTERVAL;
- targetTimespan = TARGET_TIMESPAN;
- maxTarget = Utils.decodeCompactBits(0x1d00ffffL);
- dumpedPrivateKeyHeader = 128;
- addressHeader = 0;
- p2shHeader = 5;
- acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
- port = 8333;
- packetMagic = 0xf9beb4d9L;
- bip32HeaderPub = 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub".
- bip32HeaderPriv = 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv"
-
- majorityEnforceBlockUpgrade = MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE;
- majorityRejectBlockOutdated = MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED;
- majorityWindow = MAINNET_MAJORITY_WINDOW;
-
- genesisBlock.setDifficultyTarget(0x1d00ffffL);
- genesisBlock.setTime(1231006505L);
- genesisBlock.setNonce(2083236893);
- id = ID_MAINNET;
- subsidyDecreaseBlockCount = 210000;
- spendableCoinbaseDepth = 100;
- String genesisHash = genesisBlock.getHashAsString();
- checkState(genesisHash.equals("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"),
- genesisHash);
-
- // This contains (at a minimum) the blocks which are not BIP30 compliant. BIP30 changed how duplicate
- // transactions are handled. Duplicated transactions could occur in the case where a coinbase had the same
- // extraNonce and the same outputs but appeared at different heights, and greatly complicated re-org handling.
- // Having these here simplifies block connection logic considerably.
- checkpoints.put(91722, Sha256Hash.wrap("00000000000271a2dc26e7667f8419f2e15416dc6955e5a6c6cdf3f2574dd08e"));
- checkpoints.put(91812, Sha256Hash.wrap("00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f"));
- checkpoints.put(91842, Sha256Hash.wrap("00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec"));
- checkpoints.put(91880, Sha256Hash.wrap("00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721"));
- checkpoints.put(200000, Sha256Hash.wrap("000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf"));
-
- dnsSeeds = new String[]{
- "seed.bitcoin.sipa.be", // Pieter Wuille
- "dnsseed.bluematt.me", // Matt Corallo
- "dnsseed.bitcoin.dashjr.org", // Luke Dashjr
- "seed.bitcoinstats.com", // Chris Decker
- "seed.bitnodes.io", // Addy Yeow
- "bitseed.xf2.org", // Jeff Garzik
- "seed.bitcoin.jonasschnelli.ch" // Jonas Schnelli
- };
- httpSeeds = new HttpDiscovery.Details[]{
- // Andreas Schildbach
- new HttpDiscovery.Details(
- ECKey.fromPublicOnly(Utils.HEX.decode("0238746c59d46d5408bf8b1d0af5740fe1a6e1703fcb56b2953f0b965c740d256f")),
- URI.create("http://httpseed.bitcoin.schildbach.de/peers")
- )
- };
-
- // note: These are in big-endian format, which is what the SeedPeers code expects.
- // These values should be kept up-to-date as much as possible.
- //
- // these values were created using this tool:
- // https://github.com/dan-da/names2ips
- //
- // with this exact command:
- // $ ./names2ips.php --hostnames=seed.bitcoin.sipa.be,dnsseed.bluematt.me,dnsseed.bitcoin.dashjr.org,seed.bitcoinstats.com,seed.bitnodes.io --format=code --ipformat=hex --endian=big
-
- // Updated Nov. 4th 2017
- addrSeeds = new int[]{
- // -- seed.bitcoin.sipa.be --
- 0x254187d, 0x1af0735d, 0x20b72088, 0x30a1c321, 0x3515cb9f, 0x4539448a, 0x459caed5,
- 0x4b0559d1, 0x5c88c9c1, 0x726fc523, 0x753b448a, 0x75b25c50, 0x7efc63b3, 0x8e79e849,
- 0x914ff334, 0x93d60bc6, 0x9e1df618, 0xa7069f4b, 0xafbd5827, 0xb5a3ce62, 0xc635d054,
- 0xc6fa4260, 0xc73aea63, 0xc7437558, 0xd78bbfd5,
-// -- dnsseed.bluematt.me --
- 0x1a536adb, 0x20ecc692, 0x21117c4c, 0x4060d85b, 0x4a9caed5, 0x513caca3, 0x5a636358,
- 0x675ad655, 0x75c0d4ad, 0xa5e3e8ad, 0xa6531525, 0xac08ab4c, 0xb2d7af41, 0xb4008bb9,
- 0xb5064945, 0xc9fad02f, 0xcb59a28b, 0xd54ba834, 0xe04d0055, 0xed5d5848, 0xfb0a825e,
-// -- dnsseed.bitcoin.dashjr.org --
- 0x858ba8c, 0xc201bb9, 0xdded4ad, 0x21fe312d, 0x330fc023, 0x4230b75f, 0x45667a7b,
- 0x47370159, 0x64384e57, 0x67b1b14d, 0x6e2a0f33, 0x810c6e3b, 0x9f3a652e, 0xa0def550,
- 0xab2d2d18, 0xb06a3850, 0xb7df01a9, 0xc8a8825e, 0xd3ace75c, 0xd5a0aa43, 0xdc0d599f,
- 0xe1f00d47, 0xf1519f51, 0xfd83bd56,
-// -- seed.bitcoinstats.com --
- 0x2e1ff68, 0x424bd6b, 0x7571e53, 0x14d33174, 0x18aac780, 0x1c5cd812, 0x40614032,
- 0x40de1c4d, 0x688fd812, 0x73c6ffad, 0x7dc6ffad, 0x7ebd2149, 0x8c08d153, 0x90b5a6d3,
- 0x986fd462, 0xae1c82aa, 0xbeffdc4a, 0xc0a1764b, 0xc0c0b1d3, 0xdff8c768, 0xe0e6a6d3,
- 0xe23b0f34, 0xe35f372f, 0xe9ff4748, 0xeed8b943,
-// -- seed.bitnodes.io --
- 0x4d3921f, 0xf480548, 0x1356b1d1, 0x1d25ddd8, 0x1d556056, 0x233d2567, 0x3058a2b2,
- 0x3ee58c9e, 0x45ea0747, 0x4abd2088, 0x4d0d97d8, 0x5246b2b3, 0x5a0ae25b, 0x5a0ea9d9,
- 0x5a55f450, 0x64610545, 0x6ed40d3e, 0x7a48cb4a, 0x98c5b35d, 0xaeb473bc, 0xdcefff86,
- 0xe170d951, 0xe76280b2, 0xfa1f645e, 0xfb96466d,
- };
- }
-
- private static BtcMainNetParamsForValidation instance;
-
- public static synchronized BtcMainNetParamsForValidation get() {
- if (instance == null) {
- instance = new BtcMainNetParamsForValidation();
- }
- return instance;
- }
-
- @Override
- public String getPaymentProtocolId() {
- return PAYMENT_PROTOCOL_ID_MAINNET;
- }
-}
diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset
new file mode 100644
index 00000000..0149777e
--- /dev/null
+++ b/src/main/resources/META-INF/services/bisq.asset.Asset
@@ -0,0 +1,100 @@
+#
+# This file lists all assets available for trading on the Bisq network.
+# Contents are sorted according to the output of `sort --ignore-case`.
+# See bisq.asset.Asset and bisq.asset.AssetRegistry for further details.
+# See https://bisq.network/list-asset for complete instructions.
+#
+bisq.asset.coins.Achievecoin
+bisq.asset.coins.Angelcoin
+bisq.asset.coins.Arto
+bisq.asset.coins.Bitcoin$Mainnet
+bisq.asset.coins.Bitcoin$Regtest
+bisq.asset.coins.Bitcoin$Testnet
+bisq.asset.coins.BitcoinCash
+bisq.asset.coins.BitcoinClashic
+bisq.asset.coins.BitcoinGold
+bisq.asset.coins.BitDaric
+bisq.asset.coins.BSQ$Mainnet
+bisq.asset.coins.BSQ$Regtest
+bisq.asset.coins.BSQ$Testnet
+bisq.asset.coins.Burstcoin
+bisq.asset.coins.Byteball
+bisq.asset.coins.Cagecoin
+bisq.asset.coins.CassubianDetk
+bisq.asset.coins.Counterparty
+bisq.asset.coins.Creativecoin
+bisq.asset.coins.Cryptonite
+bisq.asset.coins.DarkNet
+bisq.asset.coins.Dash$Mainnet
+bisq.asset.coins.Dash$Regtest
+bisq.asset.coins.Dash$Testnet
+bisq.asset.coins.Decent
+bisq.asset.coins.Decred
+bisq.asset.coins.DeepOnion
+bisq.asset.coins.DigiMoney
+bisq.asset.coins.Dinero
+bisq.asset.coins.Dogecoin
+bisq.asset.coins.DynamicCoin
+bisq.asset.coins.Espers
+bisq.asset.coins.Ether
+bisq.asset.coins.EtherClassic
+bisq.asset.coins.Gridcoin
+bisq.asset.coins.InfinityEconomics
+bisq.asset.coins.Instacash
+bisq.asset.coins.InternetOfPeople
+bisq.asset.coins.Koto
+bisq.asset.coins.LBRY
+bisq.asset.coins.Lisk
+bisq.asset.coins.Litecoin$Mainnet
+bisq.asset.coins.Litecoin$Regtest
+bisq.asset.coins.Litecoin$Testnet
+bisq.asset.coins.Madcoin
+bisq.asset.coins.MaidSafeCoin
+bisq.asset.coins.Monero
+bisq.asset.coins.Namecoin
+bisq.asset.coins.NavCoin
+bisq.asset.coins.NuBits
+bisq.asset.coins.Nxt
+bisq.asset.coins.Obsidian
+bisq.asset.coins.Octocoin
+bisq.asset.coins.Particl
+bisq.asset.coins.PepeCash
+bisq.asset.coins.Phore
+bisq.asset.coins.PIVX
+bisq.asset.coins.PostCoin
+bisq.asset.coins.Pranacoin
+bisq.asset.coins.ReddCoin
+bisq.asset.coins.Roicoin
+bisq.asset.coins.SafeFileSystemCoin
+bisq.asset.coins.Siacoin
+bisq.asset.coins.Siafund
+bisq.asset.coins.Sibcoin
+bisq.asset.coins.Spectrecoin
+bisq.asset.coins.SpeedCash
+bisq.asset.coins.STEEM
+bisq.asset.coins.Stellite
+bisq.asset.coins.Strayacoin
+bisq.asset.coins.Terracoin
+bisq.asset.coins.Ubiq
+bisq.asset.coins.Unobtanium
+bisq.asset.coins.VDinar
+bisq.asset.coins.Wacoin
+bisq.asset.coins.WorldMobileCoin
+bisq.asset.coins.Yenten
+bisq.asset.coins.Zcash
+bisq.asset.coins.Zcoin
+bisq.asset.coins.ZenCash
+bisq.asset.tokens.BetterBetting
+bisq.asset.tokens.DaiStablecoin
+bisq.asset.tokens.Ellaism
+bisq.asset.tokens.GeoCoin
+bisq.asset.tokens.Grans
+bisq.asset.tokens.Internext
+bisq.asset.tokens.Movement
+bisq.asset.tokens.MyceliumToken
+bisq.asset.tokens.PascalCoin
+bisq.asset.tokens.Qwark
+bisq.asset.tokens.RefToken
+bisq.asset.tokens.SosCoin
+bisq.asset.tokens.Verify
+bisq.asset.tokens.WildToken
diff --git a/src/test/java/bisq/asset/AbstractAssetTest.java b/src/test/java/bisq/asset/AbstractAssetTest.java
new file mode 100644
index 00000000..5965e55f
--- /dev/null
+++ b/src/test/java/bisq/asset/AbstractAssetTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset;
+
+import bisq.core.btc.BaseCurrencyNetwork;
+import bisq.core.locale.Res;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Abstract base class for all {@link Asset} unit tests. Subclasses must implement the
+ * {@link #testValidAddresses()} and {@link #testInvalidAddresses()} methods, and are
+ * expected to use the convenient {@link #assertValidAddress(String)} and
+ * {@link #assertInvalidAddress(String)} assertions when doing so.
+ *
+ * Blank / empty addresses are tested automatically by this base class and are always
+ * considered invalid.
+ *
+ * This base class also serves as a kind of integration test for {@link AssetRegistry}, in
+ * that all assets tested through subclasses are tested to make sure they are also
+ * properly registered and available there.
+ *
+ * @author Chris Beams
+ * @author Bernard Labno
+ * @since 0.7.0
+ */
+public abstract class AbstractAssetTest {
+
+ private final AssetRegistry assetRegistry = new AssetRegistry();
+
+ protected final Asset asset;
+
+ public AbstractAssetTest(Asset asset) {
+ this.asset = asset;
+ }
+
+ @Before
+ public void setup() {
+ BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.BTC_MAINNET;
+ Res.setBaseCurrencyCode(baseCurrencyNetwork.getCurrencyCode());
+ Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
+ }
+
+ @Test
+ public void testPresenceInAssetRegistry() {
+ assertThat(asset + " is not registered in META-INF/services/" + Asset.class.getName(),
+ assetRegistry.stream().anyMatch(this::hasSameTickerSymbol), is(true));
+ }
+
+ @Test
+ public void testBlank() {
+ assertInvalidAddress("");
+ }
+
+ @Test
+ public abstract void testValidAddresses();
+
+ @Test
+ public abstract void testInvalidAddresses();
+
+ protected void assertValidAddress(String address) {
+ AddressValidationResult result = asset.validateAddress(address);
+ assertThat(result.getMessage(), result.isValid(), is(true));
+ }
+
+ protected void assertInvalidAddress(String address) {
+ assertThat(asset.validateAddress(address).isValid(), is(false));
+ }
+
+ private boolean hasSameTickerSymbol(Asset asset) {
+ return this.asset.getTickerSymbol().equals(asset.getTickerSymbol());
+ }
+}
diff --git a/src/test/java/bisq/asset/AbstractAssetWithDefaultValidatorTest.java b/src/test/java/bisq/asset/AbstractAssetWithDefaultValidatorTest.java
new file mode 100644
index 00000000..9522298d
--- /dev/null
+++ b/src/test/java/bisq/asset/AbstractAssetWithDefaultValidatorTest.java
@@ -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 .
+ */
+
+package bisq.asset;
+
+import org.junit.Test;
+
+/**
+ * Convenient abstract base class for {@link Asset} implementations still using the
+ * deprecated {@link DefaultAddressValidator}.
+ *
+ * @author Bernard Labno
+ * @since 0.7.0
+ * @see DefaultAddressValidator
+ */
+@Deprecated
+public abstract class AbstractAssetWithDefaultValidatorTest extends AbstractAssetTest {
+
+ public AbstractAssetWithDefaultValidatorTest(Asset asset) {
+ super(asset);
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress(" ");
+ assertValidAddress("1");
+ assertValidAddress("AQJTNtWcP7opxuR52Lf5vmoQTC8EHQ6GxV");
+ assertValidAddress("ALEK7jttmqtx2ZhXHg69Zr426qKBnzYA9E");
+ assertValidAddress("AP1egWUthPoYvZL57aBk4RPqUgjG1fJGn6");
+ assertValidAddress("AST3zfvPdZ35npxAVC8ABgVCxxDLwTmAHU");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ testBlank();
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/AchievecoinTest.java b/src/test/java/bisq/asset/coins/AchievecoinTest.java
new file mode 100644
index 00000000..ccdfe87c
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/AchievecoinTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class AchievecoinTest extends AbstractAssetTest {
+
+ public AchievecoinTest() {
+ super(new Achievecoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("AciV7ZyJDpCg7kGGmbo97VjgjpVZkXRTMD");
+ assertValidAddress("ARhW8anWaZtExdK2cQkBwsvsQZ9TkC9bwH");
+ assertValidAddress("AcxpGTWX4zFiD8p8hfYw99RXV7MY2y8hs9");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("GWaSW6PHfQKBv8EXV3xiqGG2zxKZh4XYNu");
+ assertInvalidAddress("AcxpGTWX4zFiD8p8hfY099RXV7MY2y8hs9");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/AngelcoinTest.java b/src/test/java/bisq/asset/coins/AngelcoinTest.java
new file mode 100644
index 00000000..c584261d
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/AngelcoinTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class AngelcoinTest extends AbstractAssetTest {
+
+ public AngelcoinTest() {
+ super(new Angelcoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("AQJTNtWcP7opxuR52Lf5vmoQTC8EHQ6GxV");
+ assertValidAddress("ALEK7jttmqtx2ZhXHg69Zr426qKBnzYA9E");
+ assertValidAddress("AP1egWUthPoYvZL57aBk4RPqUgjG1fJGn6");
+ assertValidAddress("AST3zfvPdZ35npxAVC8ABgVCxxDLwTmAHU");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("1AQJTNtWcP7opxuR52Lf5vmoQTC8EHQ6GxV");
+ assertInvalidAddress("1ALEK7jttmqtx2ZhXHg69Zr426qKBnzYA9E");
+ assertInvalidAddress("1AP1egWUthPoYvZL57aBk4RPqUgjG1fJGn6");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ArtoTest.java b/src/test/java/bisq/asset/coins/ArtoTest.java
new file mode 100644
index 00000000..bbd74cbb
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ArtoTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class ArtoTest extends AbstractAssetTest {
+
+ public ArtoTest() {
+ super(new Arto());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("AHT1tiauD1GKvLnSL2RVuug1arn3cvFYw7PX5cUmCkM9MHuBn8yrGoHGHXP8ZV9FUR5Y5ntvhanwCMp8FK5bmLrqKxq7BRj");
+ assertValidAddress("AKQqctWaaX3gdtQ54kUZAFhGimquK83i2VEKPituFyZiJnwB5RqRrvtSK24yN8AizhhDvHX8CvkJkRrZtUAYScgRJsDE1jH");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("AHT1tiauD1GKvLnSL2RVuug1arn3cvFYw7PX5cUmCkM9MHuBn8yrGoHGHXP8ZV9FUR5Y5ntvhanwCMp8FK5bmLrqKxq7BR");
+ assertInvalidAddress("BKQqctWaaX3gdtQ54kUZAFhGimquK83i2VEKPituFyZiJnwB5RqRrvtSK24yN8AizhhDvHX8CvkJkRrZtUAYScgRJsDE1jH");
+ assertInvalidAddress("AHT1tiauD1GKvLnSL2RVuug1arn3cvFYw7PX5cUmCkM9MHuBn8yrGoHGHXP8ZV9FUR5Y5ntvhanwCMp8FK5bmLrqKxq7BRjy");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/BSQTest.java b/src/test/java/bisq/asset/coins/BSQTest.java
new file mode 100644
index 00000000..9bb9764b
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/BSQTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class BSQTest extends AbstractAssetTest {
+
+ public BSQTest() {
+ super(new BSQ.Mainnet());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("B17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem");
+ assertValidAddress("B3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX");
+ assertValidAddress("B1111111111111111111114oLvT2");
+ assertValidAddress("B1BitcoinEaterAddressDontSendf59kuE");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("B17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("B17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("B17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/BitDaricTest.java b/src/test/java/bisq/asset/coins/BitDaricTest.java
new file mode 100644
index 00000000..4face3b7
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/BitDaricTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class BitDaricTest extends AbstractAssetTest {
+
+ public BitDaricTest() {
+ super(new BitDaric());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("RN8spHmkV6ZtRsquaTJMRZJujRQkkDNh2G");
+ assertValidAddress("RTD9jtKybd7TeM597t5MkNof84GPka34R7");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("LAPc1FumbYifKpfBpGbRLuPcLAJwHUxeyu");
+ assertInvalidAddress("ROPc1FumbYifKpfBpGbRLuPcLAJwHUxeyu");
+ assertInvalidAddress("rN8spHmkV6ZtROquaTJMRZJujRQkkDNh2G");
+ assertInvalidAddress("1NxrMzHCjG8X9kqTEZBXUNB5PC58DSXAht");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/BitcoinCashTest.java b/src/test/java/bisq/asset/coins/BitcoinCashTest.java
new file mode 100644
index 00000000..fac081a3
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/BitcoinCashTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class BitcoinCashTest extends AbstractAssetTest {
+
+ public BitcoinCashTest() {
+ super(new BitcoinCash());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH");
+ assertValidAddress("1MEbUJ5v5MdDEqFJGz4SZp58KkaLdmXZ85");
+ assertValidAddress("34dvotXMg5Gxc37TBVV2e5GUAfCFu7Ms4g");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("21HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSHa");
+ assertInvalidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSHs");
+ assertInvalidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/BitcoinClashicTest.java b/src/test/java/bisq/asset/coins/BitcoinClashicTest.java
new file mode 100644
index 00000000..d94e76b2
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/BitcoinClashicTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class BitcoinClashicTest extends AbstractAssetTest {
+
+ public BitcoinClashicTest() {
+ super(new BitcoinClashic());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH");
+ assertValidAddress("1MEbUJ5v5MdDEqFJGz4SZp58KkaLdmXZ85");
+ assertValidAddress("34dvotXMg5Gxc37TBVV2e5GUAfCFu7Ms4g");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("21HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSHa");
+ assertInvalidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSHs");
+ assertInvalidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/BitcoinGoldTest.java b/src/test/java/bisq/asset/coins/BitcoinGoldTest.java
new file mode 100644
index 00000000..d17b8a3c
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/BitcoinGoldTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class BitcoinGoldTest extends AbstractAssetTest {
+
+ public BitcoinGoldTest() {
+ super(new BitcoinGold());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("AehvQ57Fp168uY592LCUYBbyNEpiRAPufb");
+ assertValidAddress("GWaSW6PHfQKBv8EXV3xiqGG2zxKZh4XYNu");
+ assertValidAddress("GLpT8yG2kwPMdMfgwekG6tEAa91PSmN4ZC");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("GVTPWDVJgLxo5ZYSPXPDxE4s7LE5cLRwCc1");
+ assertInvalidAddress("1GVTPWDVJgLxo5ZYSPXPDxE4s7LE5cLRwCc");
+ assertInvalidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/BitcoinTest.java b/src/test/java/bisq/asset/coins/BitcoinTest.java
new file mode 100644
index 00000000..bad08da8
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/BitcoinTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class BitcoinTest extends AbstractAssetTest {
+
+ public BitcoinTest() {
+ super(new Bitcoin.Mainnet());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem");
+ assertValidAddress("3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX");
+ assertValidAddress("1111111111111111111114oLvT2");
+ assertValidAddress("1BitcoinEaterAddressDontSendf59kuE");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/BurstcoinTest.java b/src/test/java/bisq/asset/coins/BurstcoinTest.java
new file mode 100644
index 00000000..b1d6a854
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/BurstcoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class BurstcoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public BurstcoinTest() {
+ super(new Burstcoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ByteballTest.java b/src/test/java/bisq/asset/coins/ByteballTest.java
new file mode 100644
index 00000000..81d290c8
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ByteballTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class ByteballTest extends AbstractAssetTest {
+
+ public ByteballTest() {
+ super(new Byteball());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("BN7JXKXWEG4BVJ7NW6Q3Z7SMJNZJYM3G");
+ assertValidAddress("XGKZODTTTRXIUA75TKONWHFDCU6634DE");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("XGKZODTGTRXIUA75TKONWHFDCU6634DE");
+ assertInvalidAddress("XGKZODTTTRXIUA75TKONWHFDCU6634D");
+ assertInvalidAddress("XGKZODTTTRXIUA75TKONWHFDCU6634DZ");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/CagecoinTest.java b/src/test/java/bisq/asset/coins/CagecoinTest.java
new file mode 100644
index 00000000..ba1c3227
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/CagecoinTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class CagecoinTest extends AbstractAssetTest {
+
+ public CagecoinTest() {
+ super(new Cagecoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("Db97PgfdBDhXk8DmrDhrUPyydTCELn8YSb");
+ assertValidAddress("DYV4h7MTsQ91jqzbg94GFAAUbgdK7RZmpG");
+ assertValidAddress("Db5y8iKtZ24DqgYpP2G8685vTWEvk3WACC");
+ assertValidAddress("DjiQbPuBLJcVYUtzYMuFuzDwDYwb9mVhaK");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("DNkkfdUvkCDiywYE98MTVp9nQJTgeZAiFr");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/CassubianDetkTest.java b/src/test/java/bisq/asset/coins/CassubianDetkTest.java
new file mode 100644
index 00000000..4ea5f219
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/CassubianDetkTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class CassubianDetkTest extends AbstractAssetTest {
+
+ public CassubianDetkTest() {
+ super(new CassubianDetk());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("DM7BjopQ3bGYxSPZ4yhfttxqnDrEkyc3sw");
+ assertValidAddress("DB4CaJ81SiT3VtpGC8K1RMirPJZjsmKiZd");
+ assertValidAddress("DE7uB1mws1RwYNDPpfEnQ7a4i9tdqqV1Lf");
+ assertValidAddress("DJ8FnzVCa8AXEBt5aqPcJubKRzanQKvxkY");
+ assertValidAddress("D5QmzfBjwrUyAKtvectJL7kBawfWtwdJqz");
+ assertValidAddress("DDRJemKbVtTVV8r2jSG9wevv3JeUj2edAr");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("SSnwqFBiyqK1n4BV7kPX86iesev2NobhEo");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/CounterpartyTest.java b/src/test/java/bisq/asset/coins/CounterpartyTest.java
new file mode 100644
index 00000000..0f3fc7d4
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/CounterpartyTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class CounterpartyTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public CounterpartyTest() {
+ super(new Counterparty());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/CreativecoinTest.java b/src/test/java/bisq/asset/coins/CreativecoinTest.java
new file mode 100644
index 00000000..90d12e45
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/CreativecoinTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class CreativecoinTest extends AbstractAssetTest {
+
+ public CreativecoinTest() {
+ super(new Creativecoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("CGjh99QdHxCE6g9pGUucCJNeUyQPRJr4fE");
+ assertValidAddress("FTDYi4GoD3vFYFhEGbuifSZjs6udXVin7B");
+ assertValidAddress("361uBxJvmg6f62dMYVM9b7GeR38phkkTyA");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("C7VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("F7VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/CryptoniteTest.java b/src/test/java/bisq/asset/coins/CryptoniteTest.java
new file mode 100644
index 00000000..85c3ee77
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/CryptoniteTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class CryptoniteTest extends AbstractAssetTest {
+
+ public CryptoniteTest() {
+ super(new Cryptonite());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("CT49DTNo5itqYoAD6XTGyTKbe8z5nGY2D5");
+ assertValidAddress("CGTta3M4t3yXu8uRgkKvaWd2d8DQvDPnpL");
+ assertValidAddress("Cco3zGiEJMyz3wrndEr6wg5cm1oUAbBoR2");
+ assertValidAddress("CPzmjGCDEdQuRffmbpkrYQtSiUAm4oZJgt");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("CT49DTNo5itqYoAD6XTGyTKbe8z5nGY2D4");
+ assertInvalidAddress("CGTta3M4t3yXu8uRgkKvaWd2d8DQvDPnpl");
+ assertInvalidAddress("Cco3zGiEJMyz3wrndEr6wg5cm1oUAbBoR1");
+ assertInvalidAddress("CPzmjGCDEdQuRffmbpkrYQtSiUAm4oZJgT");
+ assertInvalidAddress("CT49DTNo5itqYoAD6XTGyTKbe8z5nGY2Da");
+ assertInvalidAddress("asdasd");
+ assertInvalidAddress("cT49DTNo5itqYoAD6XTGyTKbe8z5nGY2Da");
+ assertInvalidAddress("No5itqYoAD6XTGyTKbe8z5nGY2Da");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DarkNetTest.java b/src/test/java/bisq/asset/coins/DarkNetTest.java
new file mode 100644
index 00000000..190854a5
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DarkNetTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class DarkNetTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public DarkNetTest() {
+ super(new DarkNet());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DashTest.java b/src/test/java/bisq/asset/coins/DashTest.java
new file mode 100644
index 00000000..dd677c94
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DashTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class DashTest extends AbstractAssetTest {
+
+ public DashTest() {
+ super(new Dash.Mainnet());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("XjNms118hx6dGyBqsrVMTbzMUmxDVijk7Y");
+ assertValidAddress("XjNPzWfzGiY1jHUmwn9JDSVMsTs6EtZQMc");
+ assertValidAddress("XnaJzoAKTNa67Fpt1tLxD5bFMcyN4tCvTT");
+
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("1XnaJzoAKTNa67Fpt1tLxD5bFMcyN4tCvTT");
+ assertInvalidAddress("XnaJzoAKTNa67Fpt1tLxD5bFMcyN4tCvTTd");
+ assertInvalidAddress("XnaJzoAKTNa67Fpt1tLxD5bFMcyN4tCvTT#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DecentTest.java b/src/test/java/bisq/asset/coins/DecentTest.java
new file mode 100644
index 00000000..e35b0dcc
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DecentTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class DecentTest extends AbstractAssetTest {
+
+ public DecentTest() {
+ super(new Decent());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("ud6910c2790bda53bcc53cb131f8fa3bf");
+ assertValidAddress("decent-account123");
+ assertValidAddress("decent.acc-123");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("my.acc123");
+ assertInvalidAddress("123decent");
+ assertInvalidAddress("decent_acc");
+ assertInvalidAddress("dEcent");
+ assertInvalidAddress("dct1");
+ assertInvalidAddress("decent-");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DecredTest.java b/src/test/java/bisq/asset/coins/DecredTest.java
new file mode 100644
index 00000000..20190981
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DecredTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class DecredTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public DecredTest() {
+ super(new Decred());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DeepOnionTest.java b/src/test/java/bisq/asset/coins/DeepOnionTest.java
new file mode 100644
index 00000000..d2df11aa
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DeepOnionTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class DeepOnionTest extends AbstractAssetTest {
+
+ public DeepOnionTest() {
+ super(new DeepOnion());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("DbkkqXwdiWJNcpfw49f2xzTVEbvL1SYWDm");
+ assertValidAddress("DetWWdj7VUTDg1yMhjgRfzvwTf4rRSoywK");
+ assertValidAddress("Dr5aiywUzZgYHvrQgrCsk6qhxhFzM8VVUM");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DigiMoneyTest.java b/src/test/java/bisq/asset/coins/DigiMoneyTest.java
new file mode 100644
index 00000000..1db4f9c8
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DigiMoneyTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class DigiMoneyTest extends AbstractAssetTest {
+
+ public DigiMoneyTest() {
+ super(new DigiMoney());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("DvaAgcLKrno2AC7kYhHVDCrkhx2xHFpXUf");
+ assertValidAddress("E9p49poRmnuLdnu55bzKe7t48xtYv2bRES");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0xmnuL9poRmnuLd55bzKe7t48xtYv2bRES");
+ assertInvalidAddress("DvaAgcLKrno2AC7kYhHVDC");
+ assertInvalidAddress("19p49poRmnuLdnu55bzKe7t48xtYv2bRES");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DineroTest.java b/src/test/java/bisq/asset/coins/DineroTest.java
new file mode 100644
index 00000000..fb8789fd
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DineroTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class DineroTest extends AbstractAssetTest {
+
+ public DineroTest() {
+ super(new Dinero());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("DBmvak2TM8GpeiR3ZEVWAHWFZeiw9FG7jK");
+ assertValidAddress("DDWit1CcocL2j3CzfmZgz4bx2DE1h8tugv");
+ assertValidAddress("DF8D75bjz6i8azUHgmbV3awpn6tni5W43B");
+ assertValidAddress("DJquenkkiFVNpF7vVLg2xKnxCjKwnYb6Ay");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("1QbFeFc3iqRYhemqq7VZNX1SN5NtKa8UQFxw");
+ assertInvalidAddress("7rrpfJKZC7t1R2FPKrsvfkcE8KBLuSyVYAjt");
+ assertInvalidAddress("QFxwQbFeFc3iqRYhek");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DogecoinTest.java b/src/test/java/bisq/asset/coins/DogecoinTest.java
new file mode 100644
index 00000000..9351a877
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DogecoinTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class DogecoinTest extends AbstractAssetTest {
+
+ public DogecoinTest() {
+ super(new Dogecoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("DEa7damK8MsbdCJztidBasZKVsDLJifWfE");
+ assertValidAddress("DNkkfdUvkCDiywYE98MTVp9nQJTgeZAiFr");
+ assertValidAddress("DDWUYQ3GfMDj8hkx8cbnAMYkTzzAunAQxg");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("1DDWUYQ3GfMDj8hkx8cbnAMYkTzzAunAQxg");
+ assertInvalidAddress("DDWUYQ3GfMDj8hkx8cbnAMYkTzzAunAQxgs");
+ assertInvalidAddress("DDWUYQ3GfMDj8hkx8cbnAMYkTzzAunAQxg#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/DynamicCoinTest.java b/src/test/java/bisq/asset/coins/DynamicCoinTest.java
new file mode 100644
index 00000000..161e8a51
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/DynamicCoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class DynamicCoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public DynamicCoinTest() {
+ super(new DynamicCoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/EspersTest.java b/src/test/java/bisq/asset/coins/EspersTest.java
new file mode 100644
index 00000000..e9eb4cb1
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/EspersTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class EspersTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public EspersTest() {
+ super(new Espers());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/EtherClassicTest.java b/src/test/java/bisq/asset/coins/EtherClassicTest.java
new file mode 100644
index 00000000..f8f09cad
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/EtherClassicTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class EtherClassicTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public EtherClassicTest() {
+ super(new EtherClassic());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/GridcoinTest.java b/src/test/java/bisq/asset/coins/GridcoinTest.java
new file mode 100644
index 00000000..62b1241d
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/GridcoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class GridcoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public GridcoinTest() {
+ super(new Gridcoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/InfinityEconomicsTest.java b/src/test/java/bisq/asset/coins/InfinityEconomicsTest.java
new file mode 100644
index 00000000..44eca8ac
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/InfinityEconomicsTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class InfinityEconomicsTest extends AbstractAssetTest {
+
+ public InfinityEconomicsTest() {
+ super(new InfinityEconomics());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("XIN-FXFA-LR6Y-QZAW-9V4SX");
+ assertValidAddress("XIN-JM2U-U4AE-G7WF-3NP9F");
+ assertValidAddress("XIN-2223-2222-KB8Y-22222");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("abcde");
+ assertInvalidAddress("XIN-");
+ assertInvalidAddress("XIN-FXFA-LR6Y-QZAW-9V4SXA");
+ assertInvalidAddress("NIX-FXFA-LR6Y-QZAW-9V4SX");
+ assertInvalidAddress("XIN-FXF-LR6Y-QZAW-9V4SX");
+ assertInvalidAddress("XIN-FXFA-LR6-QZAW-9V4SX");
+ assertInvalidAddress("XIN-FXFA-LR6Y-QZA-9V4SX");
+ assertInvalidAddress("XIN-FXFA-LR6Y-QZAW-9V4S");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/InstacashTest.java b/src/test/java/bisq/asset/coins/InstacashTest.java
new file mode 100644
index 00000000..aea01bff
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/InstacashTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class InstacashTest extends AbstractAssetTest {
+
+ public InstacashTest() {
+ super(new Instacash());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("AYx4EqKhomeMu2CTMx1AHdNMkjv6ygnvji");
+ assertValidAddress("AcWyvE7texXcCsPLvW1btXhLimrDMpNdAu");
+ assertValidAddress("AMfLeLotcvgaHQW374NmHZgs1qXF8P6kjc");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("aYzyJYqhnxF738QjqMqTku5Wft7x4GhVCr");
+ assertInvalidAddress("DYzyJYqhnxF738QjqMqTku5Wft7x4GhVCr");
+ assertInvalidAddress("xYzyJYqhnxF738QjqMqTku5Wft7x4GhVCr");
+ assertInvalidAddress("1YzyJYqhnxF738QjqMqTku5Wft7x4GhVCr");
+ assertInvalidAddress(
+ "AYzyJYqhnxF738QjqMqTku5Wft7x4GhVCr5vcz2NZLUDsoXGp5rAFUjKnb7DdkFbLp7aSpejCcC4FTxsVvDxq9YKSprzf");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/InternetOfPeopleTest.java b/src/test/java/bisq/asset/coins/InternetOfPeopleTest.java
new file mode 100644
index 00000000..d6076798
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/InternetOfPeopleTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class InternetOfPeopleTest extends AbstractAssetTest {
+
+ public InternetOfPeopleTest() {
+ super(new InternetOfPeople());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("pKbz7iRUSiUaTgh4UuwQCnc6pWZnyCGWxM");
+ assertValidAddress("pAubDQFjUMaR93V4RjHYFh1YW1dzJ9YPW1");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/KotoTest.java b/src/test/java/bisq/asset/coins/KotoTest.java
new file mode 100644
index 00000000..396adbdb
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/KotoTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class KotoTest extends AbstractAssetTest {
+
+ public KotoTest() {
+ super(new Koto());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("k13dNgJJjf1SCU2Xv2jLnuUb5Q7zZx7P9vW");
+ assertValidAddress("k1BGB7dreqk9yCVEjC5sqjStfRxMUHiVtTg");
+ assertValidAddress("jzz6Cgk8wYy7MXZH5TCSxHbe6exCKmhXk8N");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("K1JqGEiRi3pApex3rButyuFN8HVEji9dygo");
+ assertInvalidAddress("k2De32yyMZ8xdDFBJXjVseiN99S9eJpvty5");
+ assertInvalidAddress("jyzCuxaXN38djCzdkb8nQs7v1joHWtkC4v8");
+ assertInvalidAddress("JzyNxmc9iDaGokmMrkmMCncfMQvw5vbHBKv");
+ assertInvalidAddress(
+ "zkPRkLZKf4BuzBsC6r9Ls5suw1ZV9tCwiBTF5vcz2NZLUDsoXGp5rAFUjKnb7DdkFbLp7aSpejCcC4FTxsVvDxq9YKSprzf");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/LBRYTest.java b/src/test/java/bisq/asset/coins/LBRYTest.java
new file mode 100644
index 00000000..d34f1347
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/LBRYTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class LBRYTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public LBRYTest() {
+ super(new LBRY());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/LiskTest.java b/src/test/java/bisq/asset/coins/LiskTest.java
new file mode 100644
index 00000000..50999491
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/LiskTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class LiskTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public LiskTest() {
+ super(new Lisk());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/LitecoinTest.java b/src/test/java/bisq/asset/coins/LitecoinTest.java
new file mode 100644
index 00000000..7da7f375
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/LitecoinTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class LitecoinTest extends AbstractAssetTest {
+
+ public LitecoinTest() {
+ super(new Litecoin.Mainnet());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("Lg3PX8wRWmApFCoCMAsPF5P9dPHYQHEWKW");
+ assertValidAddress("LTuoeY6RBHV3n3cfhXVVTbJbxzxnXs9ofm");
+ assertValidAddress("LgfapHEPhZbRF9pMd5WPT35hFXcZS1USrW");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("1LgfapHEPhZbRF9pMd5WPT35hFXcZS1USrW");
+ assertInvalidAddress("LgfapHEPhZbdRF9pMd5WPT35hFXcZS1USrW");
+ assertInvalidAddress("LgfapHEPhZbRF9pMd5WPT35hFXcZS1USrW#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/MadcoinTest.java b/src/test/java/bisq/asset/coins/MadcoinTest.java
new file mode 100644
index 00000000..b618979e
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/MadcoinTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class MadcoinTest extends AbstractAssetTest {
+
+ public MadcoinTest() {
+ super(new Madcoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("mHUisRLQ4vMXrWrVfGfiEHuD3KZqiUNvzH");
+ assertValidAddress("mHbicWaTXNJDbeM6KXCit5JcmvMypwpq8T");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("LzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhe");
+ assertInvalidAddress("miCVC7QcY917Cz427qTB");
+ assertInvalidAddress("12KYrjTdVGjFMtaxERSk3gphreJ5US8aUP");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/MaidSafeCoinTest.java b/src/test/java/bisq/asset/coins/MaidSafeCoinTest.java
new file mode 100644
index 00000000..dc6306f1
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/MaidSafeCoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class MaidSafeCoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public MaidSafeCoinTest() {
+ super(new MaidSafeCoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/MoneroTest.java b/src/test/java/bisq/asset/coins/MoneroTest.java
new file mode 100644
index 00000000..0136eeea
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/MoneroTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class MoneroTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public MoneroTest() {
+ super(new Monero());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/NamecoinTest.java b/src/test/java/bisq/asset/coins/NamecoinTest.java
new file mode 100644
index 00000000..8c513ff7
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/NamecoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class NamecoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public NamecoinTest() {
+ super(new Namecoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/NavCoinTest.java b/src/test/java/bisq/asset/coins/NavCoinTest.java
new file mode 100644
index 00000000..a03ea2ae
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/NavCoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class NavCoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public NavCoinTest() {
+ super(new NavCoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/NuBitsTest.java b/src/test/java/bisq/asset/coins/NuBitsTest.java
new file mode 100644
index 00000000..382ca94c
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/NuBitsTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class NuBitsTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public NuBitsTest() {
+ super(new NuBits());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/NxtTest.java b/src/test/java/bisq/asset/coins/NxtTest.java
new file mode 100644
index 00000000..a482e0b9
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/NxtTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class NxtTest extends AbstractAssetTest {
+
+ public NxtTest() {
+ super(new Nxt());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("NXT-JM2U-U4AE-G7WF-3NP9F");
+ assertValidAddress("NXT-6UNJ-UMFM-Z525-4S24M");
+ assertValidAddress("NXT-2223-2222-KB8Y-22222");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("abcde");
+ assertInvalidAddress("NXT-");
+ assertInvalidAddress("NXT-JM2U-U4AE-G7WF-3ND9F");
+ assertInvalidAddress("NXT-JM2U-U4AE-G7WF-3Np9F");
+ assertInvalidAddress("NXT-2222-2222-2222-22222");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ObsidianTest.java b/src/test/java/bisq/asset/coins/ObsidianTest.java
new file mode 100644
index 00000000..bf7daa80
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ObsidianTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class ObsidianTest extends AbstractAssetTest {
+
+ public ObsidianTest() {
+ super(new Obsidian());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("XEfyuzk8yTp5eA9eVUeCW2PFbCFtNb6Jgv");
+ assertValidAddress("XJegzjV2GK9CeQLNNcc5GVSSqTkv1XMxSF");
+ assertValidAddress("XLfvvLuwjUrz2kf5gghEmUPFE3vFvwfEiL");
+ assertValidAddress("XNC1e9TfUApfBsH9JCubioS5XGuwFLbsP4");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("SSnwqFBiyqK1n4BV7kPX86iesev2NobhEo");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/OctocoinTest.java b/src/test/java/bisq/asset/coins/OctocoinTest.java
new file mode 100644
index 00000000..23029c44
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/OctocoinTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class OctocoinTest extends AbstractAssetTest {
+
+ public OctocoinTest() {
+ super(new Octocoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("8TP9rh3SH6n9cSLmV22vnSNNw56LKGpLra");
+ assertValidAddress("37NwrYsD1HxQW5zfLTuQcUUXGMPvQgzTSn");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("1ANNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i");
+ assertInvalidAddress("38NwrYsD1HxQW5zfLT0QcUUXGMPvQgzTSn");
+ assertInvalidAddress("8tP9rh3SH6n9cSLmV22vnSNNw56LKGpLrB");
+ assertInvalidAddress("8Zbvjr");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/PIVXTest.java b/src/test/java/bisq/asset/coins/PIVXTest.java
new file mode 100644
index 00000000..a9092c40
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/PIVXTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class PIVXTest extends AbstractAssetTest {
+
+ public PIVXTest() {
+ super(new PIVX());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("DFJku78A14HYwPSzC5PtUmda7jMr5pbD2B");
+ assertValidAddress("DAeiBSH4nudXgoxS4kY6uhTPobc7ALrWDA");
+ assertValidAddress("DRbnCYbuMXdKU4y8dya9EnocL47gFjErWe");
+ assertValidAddress("DTPAqTryNRCE2FgsxzohTtJXfCBCDnG6Rc");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ParticlTest.java b/src/test/java/bisq/asset/coins/ParticlTest.java
new file mode 100644
index 00000000..9e7a3985
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ParticlTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class ParticlTest extends AbstractAssetTest {
+
+ public ParticlTest() {
+ super(new Particl());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("PZdYWHgyhuG7NHVCzEkkx3dcLKurTpvmo6");
+ assertValidAddress("RJAPhgckEgRGVPZa9WoGSWW24spskSfLTQ");
+ assertValidAddress("PaqMewoBY4vufTkKeSy91su3CNwviGg4EK");
+ assertValidAddress("PpWHwrkUKRYvbZbTic57YZ1zjmsV9X9Wu7");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/PepeCashTest.java b/src/test/java/bisq/asset/coins/PepeCashTest.java
new file mode 100644
index 00000000..ac5e7c4f
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/PepeCashTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class PepeCashTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public PepeCashTest() {
+ super(new PepeCash());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/PhoreTest.java b/src/test/java/bisq/asset/coins/PhoreTest.java
new file mode 100644
index 00000000..2f7ee49c
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/PhoreTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class PhoreTest extends AbstractAssetTest {
+
+ public PhoreTest() {
+ super(new Phore());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("PJCKDPyvfbf1yV7mYNeJ8Zb47hKRwVPYDj");
+ assertValidAddress("PJPmiib7JzMDiMQBBFCz92erB8iUvJqBqt");
+ assertValidAddress("PS6yeJnJUD2pe9fpDQvtm4KkLDwCWpa8ub");
+ assertValidAddress("PKfuRcjwzKFq3dbqE9gq8Ztxn922W4GZhm");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("pGXsgFjSMzh1dSqggRvHjPvE3cnwvuXC7s");
+ assertInvalidAddress("PKfRRcjwzKFq3dbqE9gq8Ztxn922W4GZhm");
+ assertInvalidAddress("PXP75NnwDryYswQb9RaPFBchqLRSvBmDP");
+ assertInvalidAddress("PKr3vQ7SkqLELsYGM6qeRumyfPx3366uyU9");
+ assertInvalidAddress("PKr3vQ7S");
+ assertInvalidAddress("P0r3vQ7SkqLELsYGM6qeRumyfPx3366uyU9");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/PostCoinTest.java b/src/test/java/bisq/asset/coins/PostCoinTest.java
new file mode 100644
index 00000000..5839b215
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/PostCoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class PostCoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public PostCoinTest() {
+ super(new PostCoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/PranacoinTest.java b/src/test/java/bisq/asset/coins/PranacoinTest.java
new file mode 100644
index 00000000..d4202f23
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/PranacoinTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class PranacoinTest extends AbstractAssetTest {
+
+ public PranacoinTest() {
+ super(new Pranacoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("3AB1qXhaU3hK5oAPQfwzN3QkM8LxAgL8vB");
+ assertValidAddress("PD57PGdk69yioZ6FD3zFNzVUeJhMf6Kti4");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("3AB1qXhaU3hK5oAPQfwzN3QkM8LxAgL8v");
+ assertInvalidAddress("PD57PGdk69yioZ6FD3zFNzVUeJhMf6Kti42");
+ assertInvalidAddress("PD57PGdk69yioZ6FD3zFNzVUeJhMMMKti4");
+ assertInvalidAddress("PD57PG");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ReddCoinTest.java b/src/test/java/bisq/asset/coins/ReddCoinTest.java
new file mode 100644
index 00000000..3df90a1c
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ReddCoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class ReddCoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public ReddCoinTest() {
+ super(new ReddCoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/RoicoinTest.java b/src/test/java/bisq/asset/coins/RoicoinTest.java
new file mode 100644
index 00000000..7970354c
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/RoicoinTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class RoicoinTest extends AbstractAssetTest {
+
+ public RoicoinTest() {
+ super(new Roicoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("RSdzB2mFpQ6cR3HmEopbaRBjrEMWAwXBYn");
+ assertValidAddress("RBQN9ybF5JzsPQdsiHMpGfkA5HpwddKvmU");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("1RBQN9ybF5JzsPQdsiHMpGfkA5HpwddKvmU");
+ assertInvalidAddress("RBQN9ybF5JzsPQdsiHMpGfkA5HpwddKvmU1");
+ assertInvalidAddress("RBQN9ybF5JzsPQdsiHMpGfkA5HpwddKvmU#");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/STEEMTest.java b/src/test/java/bisq/asset/coins/STEEMTest.java
new file mode 100644
index 00000000..d0f110ff
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/STEEMTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class STEEMTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public STEEMTest() {
+ super(new STEEM());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/SafeFileSystemCoinTest.java b/src/test/java/bisq/asset/coins/SafeFileSystemCoinTest.java
new file mode 100644
index 00000000..d049e89a
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/SafeFileSystemCoinTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class SafeFileSystemCoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public SafeFileSystemCoinTest() {
+ super(new SafeFileSystemCoin());
+ }
+
+}
diff --git a/src/test/java/bisq/asset/coins/SiacoinTest.java b/src/test/java/bisq/asset/coins/SiacoinTest.java
new file mode 100644
index 00000000..465ba608
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/SiacoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class SiacoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public SiacoinTest() {
+ super(new Siacoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/SiafundTest.java b/src/test/java/bisq/asset/coins/SiafundTest.java
new file mode 100644
index 00000000..c1ea0f23
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/SiafundTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class SiafundTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public SiafundTest() {
+ super(new Siafund());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/SibcoinTest.java b/src/test/java/bisq/asset/coins/SibcoinTest.java
new file mode 100644
index 00000000..aa3acea8
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/SibcoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class SibcoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public SibcoinTest() {
+ super(new Sibcoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/SpectrecoinTest.java b/src/test/java/bisq/asset/coins/SpectrecoinTest.java
new file mode 100644
index 00000000..b6ad8afc
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/SpectrecoinTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class SpectrecoinTest extends AbstractAssetTest {
+
+ public SpectrecoinTest() {
+ super(new Spectrecoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("SUZRHjTLSCr581qLsGqMqBD5f3oW2JHckn");
+ assertValidAddress("SZ4S1oFfUa4a9s9Kg8bNRywucHiDZmcUuz");
+ assertValidAddress("SdyjGEmgroK2vxBhkHE1MBUVRbUWpRAdVG");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/SpeedCashTest.java b/src/test/java/bisq/asset/coins/SpeedCashTest.java
new file mode 100644
index 00000000..9df1f125
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/SpeedCashTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class SpeedCashTest extends AbstractAssetTest {
+
+ public SpeedCashTest() {
+ super(new SpeedCash());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("SNrVzPaFVCQGH4Rdch2EuhoyeWMfgWqk1J");
+ assertValidAddress("SXPvGe87gdCFQH8zPU3JdKNGwAa4c6979r");
+ assertValidAddress("STGvWjZdkwDeNoYa73cqMrAFFYm5xtJndc");
+ assertValidAddress("SVPZMBgDxBVDRisdDZGD1XQwyAz8RBbo3J");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("SVPZMBgDxBVDRisdDZGD1XQwyAz8RBbo3R");
+ assertInvalidAddress("mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn");
+ assertInvalidAddress("XLfvvLuwjUrz2kf5gghEmUPFE3vFvwfEiL");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/StelliteTest.java b/src/test/java/bisq/asset/coins/StelliteTest.java
new file mode 100644
index 00000000..2ea2ec9b
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/StelliteTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class StelliteTest extends AbstractAssetTest {
+
+ public StelliteTest() {
+ super(new Stellite());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("Se3x7sVdvUnMMn2KoYLyYVHMJGRoB2R3V8K3LYuHAiEXgVac7vsmFiXUC8dSpJnjXDfwytKsQJV6HFH8MjwPagTJ2Aha46RZM");
+ assertValidAddress("Se3F51UzpbVVnQRx2VNbcjfBoQJfeuyFF353i1jLnCZda9yVN3vy8csbYCESBvf38TFkchH1C1tMY6XHkC8L678K2vLsVZVMU");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("Se3x7svUnMMn2KoYLyYVHMJGRoB2R3V8K3LYuHAiEXgVac7vsmFiXUC8dSpJnjXDfwytKsQJV6HFH8MjwPagTJ2Aha46RZM");
+ assertInvalidAddress("SX45GjRnvqheAgCpx4nJeKRjDtS5tYawxEP1GaTj79dTEm21Dtdxex6EHyDqBpofoDqW9k9uQWtkGgbbF8kiRSZ27AksBg7G111");
+ assertInvalidAddress("Se3F51UzpbVVnQRx2VNbcjfBoQJfeuyFF353i1jLnCZda9yVN3vy8csbYCESBvf38TFkchH1C1tMY6XHkC8L678K2vLsVZVMUII");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/StrayacoinTest.java b/src/test/java/bisq/asset/coins/StrayacoinTest.java
new file mode 100644
index 00000000..514bf0da
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/StrayacoinTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class StrayacoinTest extends AbstractAssetTest {
+
+ public StrayacoinTest() {
+ super(new Strayacoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("SZHa3vS9ctDJwx3BziaqgN3zQMkYpgyP7f");
+ assertValidAddress("SefAdKgyqdg7wd1emhFynPs44d1b2Ca2U1");
+ assertValidAddress("SSw6555umxHsPZgE96KoyiEVY3CDuJRBQc");
+ assertValidAddress("SYwJ6aXQkmt3ExuaXBSCmyiHRn8fUpxXUi");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("DNkkfdUvkCDiywYE98MTVp9nQJTgeZAiFr");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/TerracoinTest.java b/src/test/java/bisq/asset/coins/TerracoinTest.java
new file mode 100644
index 00000000..d28a802b
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/TerracoinTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class TerracoinTest extends AbstractAssetTest {
+
+ public TerracoinTest() {
+ super(new Terracoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("1Bys8pZaKo4GTWcpArMg92cBgYqij8mKXt");
+ assertValidAddress("12Ycuof6g5GRyWy56eQ3NvJpwAM8z9pb4g");
+ assertValidAddress("1DEBTTVCn1h9bQS9scVP6UjoSsjbtJBvXF");
+ assertValidAddress("18s142HdWDfDQXYBpuyMvsU3KHwryLxnCr");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("18s142HdWDfDQXYBpyuMvsU3KHwryLxnCr");
+ assertInvalidAddress("18s142HdWDfDQXYBpuyMvsU3KHwryLxnC");
+ assertInvalidAddress("8s142HdWDfDQXYBpuyMvsU3KHwryLxnCr");
+ assertInvalidAddress("18s142HdWDfDQXYBuyMvsU3KHwryLxnCr");
+ assertInvalidAddress("1asdasd");
+ assertInvalidAddress("asdasd");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/UbiqTest.java b/src/test/java/bisq/asset/coins/UbiqTest.java
new file mode 100644
index 00000000..01389132
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/UbiqTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class UbiqTest extends AbstractAssetTest {
+
+ public UbiqTest() {
+ super(new Ubiq());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/UnobtaniumTest.java b/src/test/java/bisq/asset/coins/UnobtaniumTest.java
new file mode 100644
index 00000000..ed90c1e6
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/UnobtaniumTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class UnobtaniumTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public UnobtaniumTest() {
+ super(new Unobtanium());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/VDinarTest.java b/src/test/java/bisq/asset/coins/VDinarTest.java
new file mode 100644
index 00000000..51f83b1b
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/VDinarTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class VDinarTest extends AbstractAssetTest {
+
+ public VDinarTest() {
+ super(new VDinar());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("DG1KpSsSXd3uitgwHaA1i6T1Bj1hWEwAxB");
+ assertValidAddress("DPEfTj1C9tTKEqkLPUwtUtCZHd7ViedBmZ");
+ assertValidAddress("DLzjxv6Rk9hMYEFHBLqvyT8pkfS43u9Md5");
+ assertValidAddress("DHexLqYt4ooDDnpmfEMSa1oJBbaZBxURZH");
+ assertValidAddress("DHPybrRc2iqeE4aU8mmXKf8v38JTDyH2V9");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("3CDJNfdWX8m2NwuGUV3nhXHXEeLygMXoAj");
+ assertInvalidAddress("DG1KpSsSXd3uitgwHaA1i6T1BjSHORTER");
+ assertInvalidAddress("DG1KpSsSXd3uitgwHaA1i6T1Bj1hWLONGER");
+ assertInvalidAddress("HG1KpSsSXd3uitgwHaA1i6T1Bj1hWEwAxB");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/WacoinTest.java b/src/test/java/bisq/asset/coins/WacoinTest.java
new file mode 100644
index 00000000..44768a14
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/WacoinTest.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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class WacoinTest extends AbstractAssetTest {
+
+ public WacoinTest() {
+ super(new Wacoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("WfEnB3VGrBqW7uamJMymymEwxMBYQKELKY");
+ assertValidAddress("WTLWtNN5iJJQyTeMfZMMrfrDvdGZrYGP5U");
+ assertValidAddress("WemK3MgwREsEaF4vdtYLxmMqAXp49C2LYQ");
+ assertValidAddress("WZggcFY5cJdAxx9unBW5CVPAH8VLTxZ6Ym");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("abcde");
+ assertInvalidAddress("mWvZ7nZAUzpRMFp2Bfjxz27Va47nUfB79E");
+ assertInvalidAddress("WemK3MgwREsE23fgsadtYLxmMqAX9C2LYQ");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/WorldMobileCoinTest.java b/src/test/java/bisq/asset/coins/WorldMobileCoinTest.java
new file mode 100644
index 00000000..7bb059d5
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/WorldMobileCoinTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class WorldMobileCoinTest extends AbstractAssetTest {
+
+ public WorldMobileCoinTest() {
+ super(new WorldMobileCoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("wc1qke2es507uz0dcfx7eyvlfuemwys8xem48vp5rw");
+ assertValidAddress("wc1qlwsfmqswjnnv20quv203lnksjrgsww3mjhd349");
+ assertValidAddress("Wmpfed6ykt9YsFxhGri5KJvKc3r7BC1rVQ");
+ assertValidAddress("WSSqzNJvc4X4xWW6WDyUk1oWEeLx45vyRh");
+ assertValidAddress("XWJk3GEuNFEn3dGFCi7vTzVuydeGQA9Fnq");
+ assertValidAddress("XG1Mc7XvvpR1wQvjeikZwHAjwLvCWQD35u");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("wc1qke2es507uz0dcfx7eyvlfuemwys8xem48vp5rx");
+ assertInvalidAddress("Wmpfed6ykt9YsFxhGri5KJvKc3r7BC1rvq");
+ assertInvalidAddress("XWJk3GEuNFEn3dGFCi7vTzVuydeGQA9FNQ");
+ assertInvalidAddress("0123456789Abcdefghijklmnopqrstuvwxyz");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/YentenTest.java b/src/test/java/bisq/asset/coins/YentenTest.java
new file mode 100644
index 00000000..e5a9efee
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/YentenTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class YentenTest extends AbstractAssetTest {
+
+ public YentenTest() {
+ super(new Yenten());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("YTgSv7bk5x5p6te3uf3HbUwgnf7zEJM4Jn");
+ assertValidAddress("YVz19KtQUfyTP4AJS8sbRBqi7dkGTL2ovd");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("YiTwGuv3opowtPF5w8LUWBXFmaxc9S68ha");
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
+ assertInvalidAddress("YVZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
+ assertInvalidAddress("YiTwGuv3opowtPF5w8LUWBlFmaxc9S68hz");
+ assertInvalidAddress("YiTwGuv3opowtPF5w8LUWB0Fmaxc9S68hz");
+ assertInvalidAddress("YiTwGuv3opowtPF5w8LUWBIFmaxc9S68hz");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ZcashTest.java b/src/test/java/bisq/asset/coins/ZcashTest.java
new file mode 100644
index 00000000..44cb2f0c
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ZcashTest.java
@@ -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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class ZcashTest extends AbstractAssetTest {
+
+ public ZcashTest() {
+ super(new Zcash());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("t1K6LGT7z2uNTLxag6eK6XwGNpdkHbncBaK");
+ assertValidAddress("t1ZjdqCGEkqL9nZ8fk9R6KA7bqNvXaVLUpF");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem");
+ assertInvalidAddress("38NwrYsD1HxQW5zfLT0QcUUXGMPvQgzTSn");
+ assertInvalidAddress("8tP9rh3SH6n9cSLmV22vnSNNw56LKGpLrB");
+ assertInvalidAddress("8Zbvjr");
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ZcoinTest.java b/src/test/java/bisq/asset/coins/ZcoinTest.java
new file mode 100644
index 00000000..eab34a26
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ZcoinTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetWithDefaultValidatorTest;
+
+public class ZcoinTest extends AbstractAssetWithDefaultValidatorTest {
+
+ public ZcoinTest() {
+ super(new Zcoin());
+ }
+}
diff --git a/src/test/java/bisq/asset/coins/ZenCashTest.java b/src/test/java/bisq/asset/coins/ZenCashTest.java
new file mode 100644
index 00000000..c25d8b7a
--- /dev/null
+++ b/src/test/java/bisq/asset/coins/ZenCashTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.coins;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class ZenCashTest extends AbstractAssetTest {
+
+ public ZenCashTest() {
+ super(new ZenCash());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("znk62Ey7ptTyHgYLaLDTEwhLF6uN1DXTBfa");
+ assertValidAddress("znTqzi5rTXf6KJnX5tLaC5CMGHfeWJwy1c7");
+ assertValidAddress("t1V9h2P9n4sYg629Xn4jVDPySJJxGmPb1HK");
+ assertValidAddress("t3Ut4KUq2ZSMTPNE67pBU5LqYCi2q36KpXQ");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("zcKffBrza1cirFY47aKvXiV411NZMscf7zUY5bD1HwvkoQvKHgpxLYUHtMCLqBAeif1VwHmMjrMAKNrdCknCVqCzRNizHUq");
+ assertInvalidAddress("AFTqzi5rTXf6KJnX5tLaC5CMGHfeWJwy1c7");
+ assertInvalidAddress("zig-zag");
+ assertInvalidAddress("0123456789");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/BetterBettingTest.java b/src/test/java/bisq/asset/tokens/BetterBettingTest.java
new file mode 100644
index 00000000..56107593
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/BetterBettingTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class BetterBettingTest extends AbstractAssetTest {
+
+ public BetterBettingTest() {
+ super(new BetterBetting());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/DaiStablecoinTest.java b/src/test/java/bisq/asset/tokens/DaiStablecoinTest.java
new file mode 100644
index 00000000..d567cce5
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/DaiStablecoinTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class DaiStablecoinTest extends AbstractAssetTest {
+
+ public DaiStablecoinTest() {
+ super(new DaiStablecoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/EllaismTest.java b/src/test/java/bisq/asset/tokens/EllaismTest.java
new file mode 100644
index 00000000..c98ae2c8
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/EllaismTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class EllaismTest extends AbstractAssetTest {
+
+ public EllaismTest() {
+ super(new Ellaism());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ assertValidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a216");
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ assertInvalidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/GeoCoinTest.java b/src/test/java/bisq/asset/tokens/GeoCoinTest.java
new file mode 100644
index 00000000..61254211
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/GeoCoinTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class GeoCoinTest extends AbstractAssetTest {
+
+ public GeoCoinTest() {
+ super(new GeoCoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/GransTest.java b/src/test/java/bisq/asset/tokens/GransTest.java
new file mode 100644
index 00000000..28943e86
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/GransTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class GransTest extends AbstractAssetTest {
+
+ public GransTest() {
+ super(new Grans());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/InternextTest.java b/src/test/java/bisq/asset/tokens/InternextTest.java
new file mode 100644
index 00000000..718bbd7e
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/InternextTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class InternextTest extends AbstractAssetTest {
+
+ public InternextTest() {
+ super(new Internext());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/MovementTest.java b/src/test/java/bisq/asset/tokens/MovementTest.java
new file mode 100644
index 00000000..c63e59e7
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/MovementTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class MovementTest extends AbstractAssetTest {
+
+ public MovementTest() {
+ super(new Ellaism());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/MyceliumTokenTest.java b/src/test/java/bisq/asset/tokens/MyceliumTokenTest.java
new file mode 100644
index 00000000..4e268a26
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/MyceliumTokenTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class MyceliumTokenTest extends AbstractAssetTest {
+
+ public MyceliumTokenTest() {
+ super(new MyceliumToken());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ assertValidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a216");
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ assertInvalidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/PascalCoinTest.java b/src/test/java/bisq/asset/tokens/PascalCoinTest.java
new file mode 100644
index 00000000..d7ce0f05
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/PascalCoinTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class PascalCoinTest extends AbstractAssetTest {
+
+ public PascalCoinTest() {
+ super(new PascalCoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ assertValidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a216");
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ assertInvalidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/QwarkTest.java b/src/test/java/bisq/asset/tokens/QwarkTest.java
new file mode 100644
index 00000000..fbf81e64
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/QwarkTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class QwarkTest extends AbstractAssetTest {
+
+ public QwarkTest() {
+ super(new Qwark());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/RefTokenTest.java b/src/test/java/bisq/asset/tokens/RefTokenTest.java
new file mode 100644
index 00000000..23cc9a6f
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/RefTokenTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class RefTokenTest extends AbstractAssetTest {
+
+ public RefTokenTest() {
+ super(new BetterBetting());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/SosCoinTest.java b/src/test/java/bisq/asset/tokens/SosCoinTest.java
new file mode 100644
index 00000000..7a105e40
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/SosCoinTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class SosCoinTest extends AbstractAssetTest {
+
+ public SosCoinTest() {
+ super(new SosCoin());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/VerifyTest.java b/src/test/java/bisq/asset/tokens/VerifyTest.java
new file mode 100644
index 00000000..352771cb
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/VerifyTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class VerifyTest extends AbstractAssetTest {
+
+ public VerifyTest() {
+ super(new Verify());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ assertValidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a21");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a216");
+ assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ assertInvalidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a2g");
+ }
+}
diff --git a/src/test/java/bisq/asset/tokens/WildTokenTest.java b/src/test/java/bisq/asset/tokens/WildTokenTest.java
new file mode 100644
index 00000000..d44c83d3
--- /dev/null
+++ b/src/test/java/bisq/asset/tokens/WildTokenTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+
+package bisq.asset.tokens;
+
+import bisq.asset.AbstractAssetTest;
+
+import org.junit.Test;
+
+public class WildTokenTest extends AbstractAssetTest {
+
+ public WildTokenTest() {
+ super(new WildToken());
+ }
+
+ @Test
+ public void testValidAddresses() {
+ assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
+ }
+
+ @Test
+ public void testInvalidAddresses() {
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
+ assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
+ }
+}
diff --git a/src/test/java/bisq/core/payment/validation/AbstractAltcoinAddressValidatorTest.java b/src/test/java/bisq/core/payment/validation/AbstractAltcoinAddressValidatorTest.java
new file mode 100644
index 00000000..6896deef
--- /dev/null
+++ b/src/test/java/bisq/core/payment/validation/AbstractAltcoinAddressValidatorTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 .
+ */
+
+package bisq.core.payment.validation;
+
+import bisq.core.app.BisqEnvironment;
+import bisq.core.btc.BaseCurrencyNetwork;
+import bisq.asset.AssetRegistry;
+import bisq.core.locale.CurrencyUtil;
+import bisq.core.locale.Res;
+
+import org.junit.Before;
+
+public abstract class AbstractAltcoinAddressValidatorTest {
+
+ protected AltCoinAddressValidator validator = new AltCoinAddressValidator(new AssetRegistry());
+
+ @Before
+ public void setup() {
+ BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
+ String currencyCode = baseCurrencyNetwork.getCurrencyCode();
+ Res.setBaseCurrencyCode(currencyCode);
+ Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
+ CurrencyUtil.setBaseCurrencyCode(currencyCode);
+ }
+}
diff --git a/src/test/java/bisq/core/payment/validation/AltCoinAddressValidatorTest.java b/src/test/java/bisq/core/payment/validation/AltCoinAddressValidatorTest.java
index 697af326..1216492b 100644
--- a/src/test/java/bisq/core/payment/validation/AltCoinAddressValidatorTest.java
+++ b/src/test/java/bisq/core/payment/validation/AltCoinAddressValidatorTest.java
@@ -17,31 +17,16 @@
package bisq.core.payment.validation;
-import bisq.core.app.BisqEnvironment;
-import bisq.core.btc.BaseCurrencyNetwork;
-import bisq.core.locale.CurrencyUtil;
-import bisq.core.locale.Res;
-
-import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertTrue;
-public class AltCoinAddressValidatorTest {
-
- @Before
- public void setup() {
- final BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
- final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
- Res.setBaseCurrencyCode(currencyCode);
- Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
- CurrencyUtil.setBaseCurrencyCode(currencyCode);
- }
+public class AltCoinAddressValidatorTest extends AbstractAltcoinAddressValidatorTest {
@Test
public void testBTC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("BTC");
assertTrue(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem").isValid);
@@ -56,8 +41,153 @@ public void testBTC() {
}
@Test
+ public void testBURST() {
+ testDefaultValidator("BURST");
+ }
+
+ @Test
+ public void testXCP() {
+ testDefaultValidator("XCP");
+ }
+
+ @Test
+ public void testDNET() {
+ testDefaultValidator("DNET");
+ }
+
+ @Test
+ public void testDCR() {
+ testDefaultValidator("DCR");
+ }
+
+ @Test
+ public void testDMC() {
+ testDefaultValidator("DMC");
+ }
+
+ @Test
+ public void testESP() {
+ testDefaultValidator("ESP");
+ }
+
+ @Test
+ public void testETC() {
+ testDefaultValidator("ETC");
+ }
+
+ @Test
+ public void testGRC() {
+ testDefaultValidator("GRC");
+ }
+
+ @Test
+ public void testLBC() {
+ testDefaultValidator("LBC");
+ }
+
+ @Test
+ public void testLSK() {
+ testDefaultValidator("LSK");
+ }
+
+ @Test
+ public void testMAID() {
+ testDefaultValidator("MAID");
+ }
+
+ @Test
+ public void testXMR() {
+ testDefaultValidator("XMR");
+ }
+
+
+ @Test
+ public void testMT() {
+ testErc20Address("MT");
+ }
+
+
+ @Test
+ public void testNAV() {
+ testDefaultValidator("NAV");
+ }
+
+
+ @Test
+ public void testNMC() {
+ testDefaultValidator("NMC");
+ }
+
+
+ @Test
+ public void testNBT() {
+ testDefaultValidator("NBT");
+ }
+
+
+ @Test
+ public void testPASC() {
+ testErc20Address("PASC");
+ }
+
+ @Test
+ public void testPEPECASH() {
+ testDefaultValidator("PEPECASH");
+ }
+
+ @Test
+ public void testPOST() {
+ testDefaultValidator("POST");
+ }
+
+ @Test
+ public void testRDD() {
+ testDefaultValidator("RDD");
+ }
+
+ @Test
+ public void testSFSC() {
+ testDefaultValidator("SFSC");
+ }
+
+ @Test
+ public void testSC() {
+ testDefaultValidator("SC");
+ }
+
+ @Test
+ public void testSF() {
+ testDefaultValidator("SF");
+ }
+
+ @Test
+ public void testSIB() {
+ testDefaultValidator("SIB");
+ }
+
+ @Test
+ public void testSTEEM() {
+ testDefaultValidator("STEEM");
+ }
+
+ @Test
+ public void testUNO() {
+ testDefaultValidator("UNO");
+ }
+
+ @Test
+ public void testXZC() {
+ testDefaultValidator("XZC");
+ }
+
+ @Test
+ public void testELLA() {
+ testErc20Address("ELLA");
+ }
+
+ @Test
+ @Ignore
public void testBSQ() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("BSQ");
assertTrue(validator.validate("B17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem").isValid);
@@ -73,7 +203,6 @@ public void testBSQ() {
@Test
public void testLTC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("LTC");
assertTrue(validator.validate("Lg3PX8wRWmApFCoCMAsPF5P9dPHYQHEWKW").isValid);
@@ -88,7 +217,6 @@ public void testLTC() {
@Test
public void testDOGE() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DOGE");
assertTrue(validator.validate("DEa7damK8MsbdCJztidBasZKVsDLJifWfE").isValid);
@@ -103,7 +231,6 @@ public void testDOGE() {
@Test
public void testDASH() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DASH");
assertTrue(validator.validate("XjNms118hx6dGyBqsrVMTbzMUmxDVijk7Y").isValid);
@@ -118,21 +245,11 @@ public void testDASH() {
@Test
public void testETH() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
- validator.setCurrencyCode("ETH");
-
- assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
- assertTrue(validator.validate("2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
-
- assertFalse(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266").isValid);
- assertFalse(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g").isValid);
- assertFalse(validator.validate("2a65Aca4D5fC5B5C859090a6c34d16413539822g").isValid);
- assertFalse(validator.validate("").isValid);
+ testErc20Address("ETH");
}
@Test
public void testPIVX() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("PIVX");
assertTrue(validator.validate("DFJku78A14HYwPSzC5PtUmda7jMr5pbD2B").isValid);
@@ -148,7 +265,6 @@ public void testPIVX() {
@Test
public void testIOP() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("IOP");
assertTrue(validator.validate("pKbz7iRUSiUaTgh4UuwQCnc6pWZnyCGWxM").isValid);
@@ -160,7 +276,6 @@ public void testIOP() {
@Test
public void test888() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("888");
assertTrue(validator.validate("8TP9rh3SH6n9cSLmV22vnSNNw56LKGpLra").isValid);
@@ -175,7 +290,6 @@ public void test888() {
@Test
public void testGBYTE() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("GBYTE");
assertTrue(validator.validate("BN7JXKXWEG4BVJ7NW6Q3Z7SMJNZJYM3G").isValid);
@@ -189,7 +303,6 @@ public void testGBYTE() {
@Test
public void testNXT() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("NXT");
assertTrue(validator.validate("NXT-JM2U-U4AE-G7WF-3NP9F").isValid);
@@ -207,7 +320,6 @@ public void testNXT() {
// Added at 0.6.0
@Test
public void testDCT() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DCT");
assertTrue(validator.validate("ud6910c2790bda53bcc53cb131f8fa3bf").isValid);
@@ -225,7 +337,6 @@ public void testDCT() {
@Test
public void testPNC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("PNC");
assertTrue(validator.validate("3AB1qXhaU3hK5oAPQfwzN3QkM8LxAgL8vB").isValid);
@@ -240,7 +351,6 @@ public void testPNC() {
@Test
public void testWAC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("WAC");
assertTrue(validator.validate("WfEnB3VGrBqW7uamJMymymEwxMBYQKELKY").isValid);
@@ -256,7 +366,6 @@ public void testWAC() {
@Test
public void testZEN() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("ZEN");
assertTrue(validator.validate("znk62Ey7ptTyHgYLaLDTEwhLF6uN1DXTBfa").isValid);
@@ -271,23 +380,8 @@ public void testZEN() {
assertFalse(validator.validate("").isValid);
}
- @Test
- public void testELLA() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
- validator.setCurrencyCode("ELLA");
-
- assertTrue(validator.validate("0x65767ec6d4d3d18a200842352485cdc37cbf3a21").isValid);
- assertTrue(validator.validate("65767ec6d4d3d18a200842352485cdc37cbf3a21").isValid);
-
- assertFalse(validator.validate("0x65767ec6d4d3d18a200842352485cdc37cbf3a216").isValid);
- assertFalse(validator.validate("0x65767ec6d4d3d18a200842352485cdc37cbf3a2g").isValid);
- assertFalse(validator.validate("65767ec6d4d3d18a200842352485cdc37cbf3a2g").isValid);
- assertFalse(validator.validate("").isValid);
- }
-
@Test
public void testXCN() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("XCN");
assertTrue(validator.validate("CT49DTNo5itqYoAD6XTGyTKbe8z5nGY2D5").isValid);
@@ -308,7 +402,6 @@ public void testXCN() {
@Test
public void testTRC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("TRC");
assertTrue(validator.validate("1Bys8pZaKo4GTWcpArMg92cBgYqij8mKXt").isValid);
@@ -327,7 +420,6 @@ public void testTRC() {
@Test
public void testINXT() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("INXT");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -341,7 +433,6 @@ public void testINXT() {
@Test
public void testPART() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("PART");
assertTrue(validator.validate("PZdYWHgyhuG7NHVCzEkkx3dcLKurTpvmo6").isValid);
assertTrue(validator.validate("RJAPhgckEgRGVPZa9WoGSWW24spskSfLTQ").isValid);
@@ -357,7 +448,6 @@ public void testPART() {
// Added 0.6.1
@Test
public void testMDC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("MDC");
assertTrue(validator.validate("mHUisRLQ4vMXrWrVfGfiEHuD3KZqiUNvzH").isValid);
@@ -369,24 +459,8 @@ public void testMDC() {
assertFalse(validator.validate("").isValid);
}
- @Test
- public void testBCH() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
- validator.setCurrencyCode("BCH");
-
- assertTrue(validator.validate("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH").isValid);
- assertTrue(validator.validate("1MEbUJ5v5MdDEqFJGz4SZp58KkaLdmXZ85").isValid);
- assertTrue(validator.validate("34dvotXMg5Gxc37TBVV2e5GUAfCFu7Ms4g").isValid);
-
- assertFalse(validator.validate("21HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSHa").isValid);
- assertFalse(validator.validate("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSHs").isValid);
- assertFalse(validator.validate("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH#").isValid);
- assertFalse(validator.validate("").isValid);
- }
-
@Test
public void testBCHC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("BCHC");
assertTrue(validator.validate("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH").isValid);
@@ -401,7 +475,6 @@ public void testBCHC() {
@Test
public void testBTG() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("BTG");
assertTrue(validator.validate("AehvQ57Fp168uY592LCUYBbyNEpiRAPufb").isValid);
@@ -417,7 +490,6 @@ public void testBTG() {
// Added 0.6.2
@Test
public void testCAGE() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("CAGE");
assertTrue(validator.validate("Db97PgfdBDhXk8DmrDhrUPyydTCELn8YSb").isValid);
@@ -433,7 +505,6 @@ public void testCAGE() {
@Test
public void testCRED() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("CRED");
assertTrue(validator.validate("0x65767ec6d4d3d18a200842352485cdc37cbf3a21").isValid);
@@ -447,7 +518,6 @@ public void testCRED() {
@Test
public void testXSPEC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("XSPEC");
assertTrue(validator.validate("SUZRHjTLSCr581qLsGqMqBD5f3oW2JHckn").isValid);
@@ -463,7 +533,6 @@ public void testXSPEC() {
// Added 0.6.3
@Test
public void testWILD() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("WILD");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -477,7 +546,6 @@ public void testWILD() {
@Test
public void testONION() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("ONION");
assertTrue(validator.validate("DbkkqXwdiWJNcpfw49f2xzTVEbvL1SYWDm").isValid);
@@ -493,7 +561,6 @@ public void testONION() {
// Added 0.6.4
@Test
public void testCREA() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("CREA");
assertTrue(validator.validate("CGjh99QdHxCE6g9pGUucCJNeUyQPRJr4fE").isValid);
@@ -508,7 +575,6 @@ public void testCREA() {
@Test
public void testXIN() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("XIN");
assertTrue(validator.validate("XIN-FXFA-LR6Y-QZAW-9V4SX").isValid);
@@ -531,7 +597,6 @@ public void testXIN() {
// Added 0.6.5
@Test
public void testBETR() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("BETR");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -545,7 +610,6 @@ public void testBETR() {
@Test
public void testMVT() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("MVT");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -559,7 +623,6 @@ public void testMVT() {
@Test
public void testREF() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("REF");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -574,7 +637,6 @@ public void testREF() {
// Added 0.6.6
@Test
public void testSTL() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("STL");
assertTrue(validator.validate("Se3x7sVdvUnMMn2KoYLyYVHMJGRoB2R3V8K3LYuHAiEXgVac7vsmFiXUC8dSpJnjXDfwytKsQJV6HFH8MjwPagTJ2Aha46RZM").isValid);
@@ -588,7 +650,6 @@ public void testSTL() {
@Test
public void testDAI() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DAI");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -602,7 +663,6 @@ public void testDAI() {
@Test
public void testYTN() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("YTN");
assertTrue(validator.validate("YTgSv7bk5x5p6te3uf3HbUwgnf7zEJM4Jn").isValid);
assertTrue(validator.validate("YVz19KtQUfyTP4AJS8sbRBqi7dkGTL2ovd").isValid);
@@ -618,7 +678,6 @@ public void testYTN() {
@Test
public void testDARX() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DARX");
assertTrue(validator.validate("RN8spHmkV6ZtRsquaTJMRZJujRQkkDNh2G").isValid);
@@ -632,7 +691,6 @@ public void testDARX() {
@Test
public void testODN() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("ODN");
assertTrue(validator.validate("XEfyuzk8yTp5eA9eVUeCW2PFbCFtNb6Jgv").isValid);
@@ -648,7 +706,6 @@ public void testODN() {
@Test
public void testCDT() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("CDT");
assertTrue(validator.validate("DM7BjopQ3bGYxSPZ4yhfttxqnDrEkyc3sw").isValid);
@@ -666,7 +723,6 @@ public void testCDT() {
@Test
public void testDGM() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DGM");
assertTrue(validator.validate("DvaAgcLKrno2AC7kYhHVDCrkhx2xHFpXUf").isValid);
@@ -680,7 +736,6 @@ public void testDGM() {
@Test
public void testSCS() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("SCS");
assertTrue(validator.validate("SNrVzPaFVCQGH4Rdch2EuhoyeWMfgWqk1J").isValid);
@@ -696,7 +751,6 @@ public void testSCS() {
@Test
public void testSOS() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("SOS");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -710,7 +764,6 @@ public void testSOS() {
@Test
public void testACH() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("ACH");
assertTrue(validator.validate("AciV7ZyJDpCg7kGGmbo97VjgjpVZkXRTMD").isValid);
@@ -725,7 +778,6 @@ public void testACH() {
@Test
public void testVDN() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("VDN");
assertTrue(validator.validate("DG1KpSsSXd3uitgwHaA1i6T1Bj1hWEwAxB").isValid);
@@ -744,7 +796,6 @@ public void testVDN() {
// Added 0.7.0
@Test
public void testALC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("ALC");
assertTrue(validator.validate("AQJTNtWcP7opxuR52Lf5vmoQTC8EHQ6GxV").isValid);
@@ -760,7 +811,6 @@ public void testALC() {
@Test
public void testDIN() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DIN");
assertTrue(validator.validate("DBmvak2TM8GpeiR3ZEVWAHWFZeiw9FG7jK").isValid);
@@ -776,7 +826,6 @@ public void testDIN() {
@Test
public void testStraya() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("NAH");
assertTrue(validator.validate("SZHa3vS9ctDJwx3BziaqgN3zQMkYpgyP7f").isValid);
@@ -792,7 +841,6 @@ public void testStraya() {
@Test
public void testROI() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("ROI");
assertTrue(validator.validate("RSdzB2mFpQ6cR3HmEopbaRBjrEMWAwXBYn").isValid);
@@ -807,7 +855,6 @@ public void testROI() {
@Test
public void testWMCC() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("WMCC");
assertTrue(validator.validate("wc1qke2es507uz0dcfx7eyvlfuemwys8xem48vp5rw").isValid);
@@ -826,7 +873,6 @@ public void testWMCC() {
@Test
public void testRTO() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("RTO");
assertTrue(validator.validate("AHT1tiauD1GKvLnSL2RVuug1arn3cvFYw7PX5cUmCkM9MHuBn8yrGoHGHXP8ZV9FUR5Y5ntvhanwCMp8FK5bmLrqKxq7BRj").isValid);
@@ -840,7 +886,6 @@ public void testRTO() {
@Test
public void testKOTO() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("KOTO");
assertTrue(validator.validate("k13dNgJJjf1SCU2Xv2jLnuUb5Q7zZx7P9vW").isValid);
@@ -857,7 +902,6 @@ public void testKOTO() {
@Test
public void testUBQ() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("UBQ");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -871,7 +915,6 @@ public void testUBQ() {
@Test
public void testQWARK() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("QWARK");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -885,7 +928,6 @@ public void testQWARK() {
@Test
public void testGEO() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("GEO");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -899,7 +941,6 @@ public void testGEO() {
@Test
public void testGRANS() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("GRANS");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
@@ -913,7 +954,6 @@ public void testGRANS() {
@Test
public void testICH() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("ICH");
assertTrue(validator.validate("AYx4EqKhomeMu2CTMx1AHdNMkjv6ygnvji").isValid);
@@ -932,7 +972,6 @@ public void testICH() {
@Test
public void testPHR() {
- AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("PHR");
assertTrue(validator.validate("PJCKDPyvfbf1yV7mYNeJ8Zb47hKRwVPYDj").isValid);
@@ -948,4 +987,29 @@ public void testPHR() {
assertFalse(validator.validate("P0r3vQ7SkqLELsYGM6qeRumyfPx3366uyU9").isValid);
assertFalse(validator.validate("").isValid);
}
+
+ private void testDefaultValidator(String currencyCode) {
+ validator.setCurrencyCode(currencyCode);
+
+ assertTrue(validator.validate("AQJTNtWcP7opxuR52Lf5vmoQTC8EHQ6GxV").isValid);
+ assertTrue(validator.validate("ALEK7jttmqtx2ZhXHg69Zr426qKBnzYA9E").isValid);
+ assertTrue(validator.validate("AP1egWUthPoYvZL57aBk4RPqUgjG1fJGn6").isValid);
+ assertTrue(validator.validate("AST3zfvPdZ35npxAVC8ABgVCxxDLwTmAHU").isValid);
+ assertTrue(validator.validate("1").isValid);
+ assertTrue(validator.validate(" ").isValid);
+
+ assertFalse(validator.validate("").isValid);
+ }
+
+ private void testErc20Address(String currencyCode) {
+ validator.setCurrencyCode(currencyCode);
+
+ assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
+ assertTrue(validator.validate("2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
+
+ assertFalse(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266").isValid);
+ assertFalse(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g").isValid);
+ assertFalse(validator.validate("2a65Aca4D5fC5B5C859090a6c34d16413539822g").isValid);
+ assertFalse(validator.validate("").isValid);
+ }
}