mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Issue #1896 fixed.
This commit is contained in:
parent
bd85dbc990
commit
363f2e9760
7 changed files with 136 additions and 20 deletions
|
@ -17,12 +17,33 @@
|
|||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
|
||||
import bisq.asset.AddressValidationResult;
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
|
||||
public class Counterparty extends Coin {
|
||||
|
||||
public Counterparty() {
|
||||
super("Counterparty", "XCP", new DefaultAddressValidator());
|
||||
public Counterparty(Network network, NetworkParameters networkParameters) {
|
||||
super("Counterparty", "XCP", new XcpAddressValidator(networkParameters), network);
|
||||
}
|
||||
|
||||
public static class XcpAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public XcpAddressValidator(NetworkParameters networkParameters) {
|
||||
super(networkParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (address == null || address.length() != 34 || !address.startsWith("1")) {
|
||||
return AddressValidationResult.invalidAddress("XCP address must start with '1' and must have 34 characters.");
|
||||
}
|
||||
|
||||
String addressAsBtc = address.substring(1, address.length());
|
||||
|
||||
return super.validate(addressAsBtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,36 @@
|
|||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
|
||||
import bisq.asset.AddressValidationResult;
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
|
||||
public class Decred extends Coin {
|
||||
|
||||
public Decred() {
|
||||
super("Decred", "DCR", new DefaultAddressValidator());
|
||||
}
|
||||
public Decred(Network network, NetworkParameters networkParameters) {
|
||||
super("Decred", "DCR", new DcrAddressValidator(networkParameters), network);
|
||||
}
|
||||
|
||||
public static class DcrAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public DcrAddressValidator(NetworkParameters networkParameters) {
|
||||
super(networkParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (address == null || address.length() < 26 || address.length() > 36 || !address.startsWith("Dk")
|
||||
|| !address.startsWith("Ds") || !address.startsWith("De") || !address.startsWith("DS")
|
||||
|| !address.startsWith("Dc") || !address.startsWith("Pm")) {
|
||||
return AddressValidationResult
|
||||
.invalidAddress("DCR address must start with 'Dk' or 'Ds' or 'De' or 'DS' or 'Dc' or 'Pm' and must have 34 characters.");
|
||||
}
|
||||
|
||||
String addressAsBtc = address.substring(1, address.length());
|
||||
|
||||
return super.validate(addressAsBtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
import bisq.asset.EtherAddressValidator;
|
||||
|
||||
public class EtherClassic extends Coin {
|
||||
|
||||
public EtherClassic() {
|
||||
super("Ether Classic", "ETC", new DefaultAddressValidator());
|
||||
super("Ether Classic", "ETC", new EtherAddressValidator());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,32 @@
|
|||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
|
||||
import bisq.asset.AddressValidationResult;
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
|
||||
public class Namecoin extends Coin {
|
||||
|
||||
public Namecoin() {
|
||||
super("Namecoin", "NMC", new DefaultAddressValidator());
|
||||
public Namecoin(Network network, NetworkParameters networkParameters) {
|
||||
super("Namecoin", "NMC", new NmcAddressValidator(networkParameters), network);
|
||||
}
|
||||
|
||||
public static class NmcAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public NmcAddressValidator(NetworkParameters networkParameters) {
|
||||
super(networkParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (address == null || address.length() != 34 || !address.startsWith("N") || !address.startsWith("M"))
|
||||
return AddressValidationResult.invalidAddress("NMC address must start with 'N' or 'M' and must be 33 characters long.");
|
||||
|
||||
String addressAsBtc = address.substring(1, address.length());
|
||||
|
||||
return super.validate(addressAsBtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,19 @@
|
|||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
import bisq.asset.RegexAddressValidator;
|
||||
|
||||
public class Siafund extends Coin {
|
||||
|
||||
public Siafund() {
|
||||
super("Siafund", "SF", new DefaultAddressValidator());
|
||||
super("Siafund", "SF", new SfAddressValidator());
|
||||
}
|
||||
|
||||
public static class SfAddressValidator extends RegexAddressValidator {
|
||||
|
||||
public SfAddressValidator() {
|
||||
super("^[0-9a-fA-F]{76}$");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,12 +17,33 @@
|
|||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
|
||||
import bisq.asset.AddressValidationResult;
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
|
||||
public class Unobtanium extends Coin {
|
||||
|
||||
public Unobtanium() {
|
||||
super("Unobtanium", "UNO", new DefaultAddressValidator());
|
||||
public Unobtanium(Network network, NetworkParameters networkParameters) {
|
||||
super("Unobtanium", "UNO", new UnoAddressValidator(networkParameters), network);
|
||||
}
|
||||
|
||||
public static class UnoAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public UnoAddressValidator(NetworkParameters networkParameters) {
|
||||
super(networkParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (address == null || address.length() != 34 || !address.startsWith("u")) {
|
||||
return AddressValidationResult.invalidAddress("UNO address must start with 'u' and must have 34 characters.");
|
||||
}
|
||||
|
||||
String addressAsBtc = address.substring(1, address.length());
|
||||
|
||||
return super.validate(addressAsBtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,36 @@
|
|||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
|
||||
import bisq.asset.AddressValidationResult;
|
||||
import bisq.asset.AltCoinAccountDisclaimer;
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
|
||||
@AltCoinAccountDisclaimer("account.altcoin.popup.XZC.msg")
|
||||
public class Zcoin extends Coin {
|
||||
|
||||
public Zcoin() {
|
||||
super("Zcoin", "XZC", new DefaultAddressValidator());
|
||||
public Zcoin(Network network, NetworkParameters networkParameters) {
|
||||
super("Zcoin", "XZC", new XzcAddressValidator(networkParameters), network);
|
||||
}
|
||||
|
||||
public static class XzcAddressValidator extends Base58BitcoinAddressValidator {
|
||||
|
||||
public XzcAddressValidator(NetworkParameters networkParameters) {
|
||||
super(networkParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressValidationResult validate(String address) {
|
||||
if (address == null || address.length() != 34 || !address.startsWith("a")) {
|
||||
return AddressValidationResult.invalidAddress("XZC address must start with 'a' and must have 34 characters.");
|
||||
}
|
||||
|
||||
String addressAsBtc = address.substring(1, address.length());
|
||||
|
||||
return super.validate(addressAsBtc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue