diff --git a/.travis.yml b/.travis.yml index ca6bb7fec8..9a389a5e41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: java jdk: openjdk10 before_install: - grep -v '^#' src/main/resources/META-INF/services/bisq.asset.Asset | sort --check --dictionary-order --ignore-case + grep -v '^#' assets/src/main/resources/META-INF/services/bisq.asset.Asset | sort --check --dictionary-order --ignore-case notifications: slack: on_success: change diff --git a/assets/src/main/java/bisq/asset/AltCoinAccountDisclaimer.java b/assets/src/main/java/bisq/asset/AltCoinAccountDisclaimer.java new file mode 100644 index 0000000000..9497df37d2 --- /dev/null +++ b/assets/src/main/java/bisq/asset/AltCoinAccountDisclaimer.java @@ -0,0 +1,25 @@ +package bisq.asset; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * When a new PaymentAccount is created for given asset, this annotation tells UI to show user a disclaimer message + * with requirements needed to be fulfilled when conducting trade given payment method. + * + * I.e. in case of Monero user must use official Monero GUI wallet or Monero CLI wallet with certain options enabled, + * user needs to keep tx private key, tx hash, recipient's address, etc. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface AltCoinAccountDisclaimer { + + /** + * Translation key of the message to show, i.e. "account.altcoin.popup.xmr.msg" + * @return translation key + */ + String value(); + +} diff --git a/assets/src/main/java/bisq/asset/RegexAddressValidator.java b/assets/src/main/java/bisq/asset/RegexAddressValidator.java index 38b5f13d1e..c262cc6da9 100644 --- a/assets/src/main/java/bisq/asset/RegexAddressValidator.java +++ b/assets/src/main/java/bisq/asset/RegexAddressValidator.java @@ -26,15 +26,22 @@ package bisq.asset; public class RegexAddressValidator implements AddressValidator { private final String regex; + private final String errorMessageI18nKey; public RegexAddressValidator(String regex) { + this(regex, null); + } + + public RegexAddressValidator(String regex, String errorMessageI18nKey) { this.regex = regex; + this.errorMessageI18nKey = errorMessageI18nKey; } @Override public AddressValidationResult validate(String address) { if (!address.matches(regex)) - return AddressValidationResult.invalidStructure(); + if (errorMessageI18nKey == null) return AddressValidationResult.invalidStructure(); + else return AddressValidationResult.invalidAddress("", errorMessageI18nKey); return AddressValidationResult.validAddress(); } diff --git a/assets/src/main/java/bisq/asset/coins/Australiacash.java b/assets/src/main/java/bisq/asset/coins/Australiacash.java new file mode 100644 index 0000000000..d0dea1b7d8 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Australiacash.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.Base58BitcoinAddressValidator; +import bisq.asset.Coin; +import bisq.asset.NetworkParametersAdapter; + +public class Australiacash extends Coin { + public Australiacash() { + super("Australiacash", "AUS", new Base58BitcoinAddressValidator(new AustraliacashParams())); + } + public static class AustraliacashParams extends NetworkParametersAdapter { + + public AustraliacashParams() { + addressHeader = 23; + p2shHeader = 5; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } +} diff --git a/assets/src/main/java/bisq/asset/coins/Blur.java b/assets/src/main/java/bisq/asset/coins/Blur.java index 5af9341847..90eea56575 100644 --- a/assets/src/main/java/bisq/asset/coins/Blur.java +++ b/assets/src/main/java/bisq/asset/coins/Blur.java @@ -17,9 +17,11 @@ package bisq.asset.coins; +import bisq.asset.AltCoinAccountDisclaimer; import bisq.asset.Coin; import bisq.asset.CryptonoteAddressValidator; +@AltCoinAccountDisclaimer("account.altcoin.popup.blur.msg") public class Blur extends Coin { public Blur() { diff --git a/assets/src/main/java/bisq/asset/coins/DeepOnion.java b/assets/src/main/java/bisq/asset/coins/DeepOnion.java new file mode 100644 index 0000000000..ed5ba25e88 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/DeepOnion.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; + +import org.libdohj.params.DashMainNetParams; + +public class DeepOnion extends Coin { + public DeepOnion() { + super("DeepOnion", "ONION", new DeepOnionAddressValidator()); + } + + public static class DeepOnionAddressValidator extends Base58BitcoinAddressValidator { + + public DeepOnionAddressValidator() { + super(new DeepOnionParams()); + } + + @Override + public AddressValidationResult validate(String address) { + if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{24,33}$")) + return AddressValidationResult.invalidStructure(); + + return super.validate(address); + } + } + + public static class DeepOnionParams extends NetworkParametersAdapter { + + public DeepOnionParams() { + super(); + addressHeader = 31; + p2shHeader = 78; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } +} diff --git a/assets/src/main/java/bisq/asset/coins/Dragonglass.java b/assets/src/main/java/bisq/asset/coins/Dragonglass.java index 9069dc7d5e..68bd41df2c 100644 --- a/assets/src/main/java/bisq/asset/coins/Dragonglass.java +++ b/assets/src/main/java/bisq/asset/coins/Dragonglass.java @@ -17,10 +17,11 @@ package bisq.asset.coins; +import bisq.asset.AltCoinAccountDisclaimer; import bisq.asset.Coin; import bisq.asset.RegexAddressValidator; -// Not an ICO token (see https://github.com/bisq-network/proposals/issues/57#issuecomment-441671418) +@AltCoinAccountDisclaimer("account.altcoin.popup.drgl.msg") public class Dragonglass extends Coin { public Dragonglass() { diff --git a/assets/src/main/java/bisq/asset/coins/Monero.java b/assets/src/main/java/bisq/asset/coins/Monero.java index 17f3c9cb92..898ff326ad 100644 --- a/assets/src/main/java/bisq/asset/coins/Monero.java +++ b/assets/src/main/java/bisq/asset/coins/Monero.java @@ -17,9 +17,11 @@ package bisq.asset.coins; +import bisq.asset.AltCoinAccountDisclaimer; import bisq.asset.Coin; import bisq.asset.CryptonoteAddressValidator; +@AltCoinAccountDisclaimer("account.altcoin.popup.xmr.msg") public class Monero extends Coin { public Monero() { diff --git a/assets/src/main/java/bisq/asset/coins/Persona.java b/assets/src/main/java/bisq/asset/coins/Persona.java new file mode 100644 index 0000000000..1d449a0b60 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Persona.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 Persona extends Coin { + + public Persona() { + super("Persona", "PRSN", new RegexAddressValidator("^[P][a-km-zA-HJ-NP-Z1-9]{33}$")); + } +} diff --git a/assets/src/main/java/bisq/asset/coins/Zcash.java b/assets/src/main/java/bisq/asset/coins/Zcash.java index 0f790b4612..e6e576707c 100644 --- a/assets/src/main/java/bisq/asset/coins/Zcash.java +++ b/assets/src/main/java/bisq/asset/coins/Zcash.java @@ -17,26 +17,15 @@ package bisq.asset.coins; -import bisq.asset.AddressValidationResult; -import bisq.asset.AddressValidator; +import bisq.asset.AltCoinAccountDisclaimer; import bisq.asset.Coin; +import bisq.asset.RegexAddressValidator; +@AltCoinAccountDisclaimer("account.altcoin.popup.ZEC.msg") public class Zcash extends Coin { public Zcash() { - super("Zcash", "ZEC", new ZcashAddressValidator()); + super("Zcash", "ZEC", new RegexAddressValidator("^t.*", "validation.altcoin.zAddressesNotSupported")); } - - 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/assets/src/main/java/bisq/asset/coins/Zcoin.java b/assets/src/main/java/bisq/asset/coins/Zcoin.java index 2c498bfeb9..ee8fd01b25 100644 --- a/assets/src/main/java/bisq/asset/coins/Zcoin.java +++ b/assets/src/main/java/bisq/asset/coins/Zcoin.java @@ -17,9 +17,11 @@ package bisq.asset.coins; +import bisq.asset.AltCoinAccountDisclaimer; import bisq.asset.Coin; import bisq.asset.DefaultAddressValidator; +@AltCoinAccountDisclaimer("account.altcoin.popup.XZC.msg") public class Zcoin extends Coin { public Zcoin() { diff --git a/assets/src/main/resources/META-INF/services/bisq.asset.Asset b/assets/src/main/resources/META-INF/services/bisq.asset.Asset index b52a211003..5461409f7e 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -4,10 +4,11 @@ # See https://bisq.network/list-asset for complete instructions. bisq.asset.coins.Actinium bisq.asset.coins.Aeon +bisq.asset.coins.Australiacash bisq.asset.coins.Beam -bisq.asset.coins.BitcoinRhodium bisq.asset.coins.Bitcoin$Mainnet bisq.asset.coins.Bitcoin$Regtest +bisq.asset.coins.BitcoinRhodium bisq.asset.coins.Bitcoin$Testnet bisq.asset.coins.Bitmark bisq.asset.coins.Blur @@ -20,15 +21,16 @@ bisq.asset.coins.Counterparty bisq.asset.coins.Croat bisq.asset.coins.Dash bisq.asset.coins.Decred +bisq.asset.coins.DeepOnion bisq.asset.coins.Dextro bisq.asset.coins.Dogecoin bisq.asset.coins.Dragonglass bisq.asset.coins.Ether bisq.asset.coins.EtherClassic -bisq.asset.coins.GambleCoin -bisq.asset.coins.Grin bisq.asset.coins.FourtyTwo +bisq.asset.coins.GambleCoin bisq.asset.coins.Gridcoin +bisq.asset.coins.Grin bisq.asset.coins.Horizen bisq.asset.coins.IdaPay bisq.asset.coins.Iridium @@ -42,6 +44,7 @@ bisq.asset.coins.MoX bisq.asset.coins.Namecoin bisq.asset.coins.Neos bisq.asset.coins.Noir +bisq.asset.coins.Persona bisq.asset.coins.Pinkcoin bisq.asset.coins.PIVX bisq.asset.coins.PZDC diff --git a/assets/src/test/java/bisq/asset/coins/AustraliacashTest.java b/assets/src/test/java/bisq/asset/coins/AustraliacashTest.java new file mode 100644 index 0000000000..3e2ef3c19a --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/AustraliacashTest.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 AustraliacashTest extends AbstractAssetTest { + + public AustraliacashTest() { + super(new Australiacash()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("AYf2TGCoQ15HatyE99R3q9jVcXHLx1zRWW"); + assertValidAddress("Aahw1A79we2jUbTaamP5YALh21GSxiWTZa"); + assertValidAddress("ALp3R9W3QsCdqaNNcULySXN31dYvfvDkRU"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("1ALp3R9W3QsCdqaNNcULySXN31dYvfvDkRU"); + assertInvalidAddress("ALp3R9W3QsCdrqaNNcULySXN31dYvfvDkRU"); + assertInvalidAddress("ALp3R9W3QsCdqaNNcULySXN31dYvfvDkRU#"); + } +} diff --git a/assets/src/test/java/bisq/asset/coins/DeepOnionTest.java b/assets/src/test/java/bisq/asset/coins/DeepOnionTest.java new file mode 100644 index 0000000000..dd21153b36 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/DeepOnionTest.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 DeepOnionTest extends AbstractAssetTest { + + public DeepOnionTest() { + super(new DeepOnion()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("DYQLyJ1CcxJyRBujtKdv2JDkQEkEkAzNNA"); + assertValidAddress("DW7YKfPgm7fdTNGyyaSVfQhY7ccBoeVK5D"); + assertValidAddress("DsA31xPpijxiCuTQeYMpMTQsTH1m2jTgtS"); + + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("1sA31xPpijxiCuTQeYMpMTQsTH1m2jTgtS"); + assertInvalidAddress("DsA31xPpijxiCuTQeYMpMTQsTH1m2jTgtSd"); + assertInvalidAddress("DsA31xPpijxiCuTQeYMpMTQsTH1m2jTgt#"); + } +} diff --git a/assets/src/test/java/bisq/asset/coins/PersonaTest.java b/assets/src/test/java/bisq/asset/coins/PersonaTest.java new file mode 100644 index 0000000000..ff4dd4a5c6 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/PersonaTest.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 PersonaTest extends AbstractAssetTest { + + public PersonaTest() { + super(new Persona()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("PV5PbsyhkM1RkN41QiSXy7cisbZ4kBzm51"); + assertValidAddress("PJACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zA"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress(""); + assertInvalidAddress("LJACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zA"); + assertInvalidAddress("TJACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zA"); + assertInvalidAddress("PJACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zAA"); + assertInvalidAddress("PlACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zA"); + assertInvalidAddress("PIACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zA"); + assertInvalidAddress("POACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zA"); + assertInvalidAddress("P0ACMZ2tMMZzQ8H9mWPHJcB7uYP47BM2zA"); + } +} + + diff --git a/build.gradle b/build.gradle index 87c34fa730..92e2892da5 100644 --- a/build.gradle +++ b/build.gradle @@ -276,7 +276,7 @@ configure(project(':desktop')) { apply plugin: 'witness' apply from: '../gradle/witness/gradle-witness.gradle' - version = '0.9.2-SNAPSHOT' + version = '0.9.3-SNAPSHOT' mainClassName = 'bisq.desktop.app.BisqAppMain' @@ -318,6 +318,13 @@ configure(project(':desktop')) { testCompileOnly "org.projectlombok:lombok:$lombokVersion" testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion" } + + test { + systemProperty 'jdk.attach.allowAttachSelf', true + + def jmockit = configurations.testCompile.files.find { it.name.contains("jmockit") }.absolutePath + jvmArgs "-javaagent:$jmockit" + } } diff --git a/common/src/main/java/bisq/common/app/Version.java b/common/src/main/java/bisq/common/app/Version.java index 7463541b9f..02a3bbab3c 100644 --- a/common/src/main/java/bisq/common/app/Version.java +++ b/common/src/main/java/bisq/common/app/Version.java @@ -27,7 +27,7 @@ public class Version { // VERSION = 0.5.0 introduces proto buffer for the P2P network and local DB and is a not backward compatible update // Therefore all sub versions start again with 1 // We use semantic versioning with major, minor and patch - public static final String VERSION = "0.9.2"; + public static final String VERSION = "0.9.3"; public static int getMajorVersion(String version) { return getSubVersion(version, 0); diff --git a/core/src/main/java/bisq/core/locale/CurrencyUtil.java b/core/src/main/java/bisq/core/locale/CurrencyUtil.java index 7137caa53b..e52fcb8793 100644 --- a/core/src/main/java/bisq/core/locale/CurrencyUtil.java +++ b/core/src/main/java/bisq/core/locale/CurrencyUtil.java @@ -482,6 +482,12 @@ public class CurrencyUtil { throw new IllegalArgumentException("We are on mainnet and we could not find an asset with network type mainnet"); } + public static Optional findAsset(String tickerSymbol) { + return assetRegistry.stream() + .filter(asset -> asset.getTickerSymbol().equals(tickerSymbol)) + .findAny(); + } + public static Optional findAsset(String tickerSymbol, BaseCurrencyNetwork baseCurrencyNetwork) { return assetRegistry.stream() .filter(asset -> asset.getTickerSymbol().equals(tickerSymbol)) diff --git a/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java b/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java index 8e1529ffb0..f2b77c60f2 100644 --- a/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java +++ b/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java @@ -263,6 +263,10 @@ public final class TradeStatistics2 implements LazyProcessedPayload, Persistable } } + public boolean isValid() { + return tradeAmount > 0 && tradePrice > 0; + } + @Override public String toString() { return "TradeStatistics2{" + diff --git a/core/src/main/java/bisq/core/trade/statistics/TradeStatisticsManager.java b/core/src/main/java/bisq/core/trade/statistics/TradeStatisticsManager.java index f736ce8c7a..6410032375 100644 --- a/core/src/main/java/bisq/core/trade/statistics/TradeStatisticsManager.java +++ b/core/src/main/java/bisq/core/trade/statistics/TradeStatisticsManager.java @@ -103,7 +103,9 @@ public class TradeStatisticsManager { Map map = new HashMap<>(); p2PService.getP2PDataStorage().getAppendOnlyDataStoreMap().values().stream() .filter(e -> e instanceof TradeStatistics2) - .forEach(e -> addToMap((TradeStatistics2) e, map)); + .map(e -> (TradeStatistics2) e) + .filter(TradeStatistics2::isValid) + .forEach(e -> addToMap(e, map)); observableTradeStatisticsSet.addAll(map.values()); priceFeedService.applyLatestBisqMarketPrice(observableTradeStatisticsSet); @@ -149,16 +151,18 @@ public class TradeStatisticsManager { private void addToMap(TradeStatistics2 tradeStatistics, boolean storeLocally) { if (!observableTradeStatisticsSet.contains(tradeStatistics)) { - boolean itemAlreadyAdded = observableTradeStatisticsSet.stream() - .anyMatch(e -> (e.getOfferId().equals(tradeStatistics.getOfferId()))); - if (!itemAlreadyAdded) { - observableTradeStatisticsSet.add(tradeStatistics); - if (storeLocally) { - priceFeedService.applyLatestBisqMarketPrice(observableTradeStatisticsSet); - dump(); - } - } else { - log.debug("We have already an item with the same offer ID. That might happen if both the maker and the taker published the tradeStatistics"); + + if (observableTradeStatisticsSet.stream() + .anyMatch(e -> (e.getOfferId().equals(tradeStatistics.getOfferId())))) + return; + + if (!tradeStatistics.isValid()) + return; + + observableTradeStatisticsSet.add(tradeStatistics); + if (storeLocally) { + priceFeedService.applyLatestBisqMarketPrice(observableTradeStatisticsSet); + dump(); } } } diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 7487c5fb97..26f3857f1b 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1038,15 +1038,6 @@ transfer using the Blur Transaction Viewer (https://blur.cash/#tx-viewer).\n\n\ Failure to provide the required information to the arbitrator will result in losing the dispute case. In all cases of dispute, the \ BLUR sender bears 100% of the burden of responsibility in verifying transactions to an arbitrator. \n\n\ If you do not understand these requirements, do not trade on Bisq. First, seek help at the Blur Network Discord (https://discord.gg/dMWaqVW). -account.altcoin.popup.ccx.msg=Trading CCX on Bisq requires that you understand the following requirements:\n\n\ -To send CCX you must use an official Conceal wallet, either CLI or GUI. After sending a transfer payment, the wallets\n\ -display the transaction secret key. You must save it along with the transaction hash (ID) and the recipient's public\n\ -address in case arbitration is necessary. In such a case, you must give all three to the arbitrator, who will then\n\ -verify the CCX transfer using the Conceal Transaction Viewer (https://explorer.conceal.network/txviewer).\n\ -Because Conceal is a privacy coin, block explorers cannot verify transfers.\n\n\ -Failure to provide the required data to the arbitrator will result in losing the dispute case.\n\ -If you do not save the transaction secret key immediately after transferring CCX, it cannot be recovered later.\n\ -If you do not understand these requirements, seek help at the Conceal discord (http://discord.conceal.network). account.altcoin.popup.drgl.msg=Trading Dragonglass on Bisq requires that you understand and fulfill \ the following requirements:\n\n\ Because of the privacy Dragonglass provides, a transaction is not verifiable on the public blockchain. If required, you \ @@ -1064,17 +1055,10 @@ Failure to provide the above data, or if you used an incompatible wallet, will r dispute case. The Dragonglass sender is responsible for providing verification of the DRGL transfer to the \ arbitrator in case of a dispute. Use of PaymentID is not required.\n\n\ If you are unsure about any part of this process, visit Dragonglass on Discord (http://discord.drgl.info) for help. -account.altcoin.popup.ZEC.msg=When using {0} you can only use the transparent addresses (starting with t) not \ +account.altcoin.popup.ZEC.msg=When using Zcash you can only use the transparent addresses (starting with t) not \ the z-addresses (private), because the arbitrator would not be able to verify the transaction with z-addresses. -account.altcoin.popup.XZC.msg=When using {0} you can only use the transparent (traceable) addresses not \ +account.altcoin.popup.XZC.msg=When using Zcoin you can only use the transparent (traceable) addresses not \ the untraceable addresses, because the arbitrator would not be able to verify the transaction with untraceable addresses at a block explorer. -account.altcoin.popup.bch=Bitcoin Cash and Bitcoin Clashic suffer from replay protection. If you use those coins be sure you take sufficient precautions and understand all implications.\ -You can suffer losses by sending one coin and unintentionally send the same coins on the other block chain.\ - Because those "airdrop coins" share the same history with the Bitcoin blockchain there are also security risks and a considerable risk for losing privacy.\n\n\ - Please read at the Bisq Forum more about that topic: https://forum.bisq.io/t/airdrop-coins-information-thread-bch-btg-bchc -account.altcoin.popup.btg=Because Bitcoin Gold shares the same history as the Bitcoin blockchain it comes with certain security risks and a considerable risk for losing privacy.\ - If you use Bitcoin Gold be sure you take sufficient precautions and understand all implications.\n\n\ - Please read at the Bisq Forum more about that topic: https://forum.bisq.io/t/airdrop-coins-information-thread-bch-btg-bchc account.fiat.yourFiatAccounts=Your national currency accounts diff --git a/desktop/package/linux/Dockerfile b/desktop/package/linux/Dockerfile index 8c60d45c4b..d44f2079e2 100644 --- a/desktop/package/linux/Dockerfile +++ b/desktop/package/linux/Dockerfile @@ -8,7 +8,7 @@ # pull base image FROM openjdk:8-jdk -ENV version 0.9.2 +ENV version 0.9.3-SNAPSHOT RUN apt-get update && apt-get install -y --no-install-recommends openjfx && rm -rf /var/lib/apt/lists/* && apt-get install -y vim fakeroot diff --git a/desktop/package/linux/package.sh b/desktop/package/linux/package.sh index 796def037e..0e594da6d8 100644 --- a/desktop/package/linux/package.sh +++ b/desktop/package/linux/package.sh @@ -6,7 +6,7 @@ # - Update version below # - Ensure JAVA_HOME below is pointing to OracleJDK 10 directory -version=0.9.2-SNAPSHOT +version=0.9.3-SNAPSHOT version_base=$(echo $version | awk -F'[_-]' '{print $1}') base_dir=$( cd "$(dirname "$0")" ; pwd -P )/../../.. src_dir=$base_dir/desktop/package diff --git a/desktop/package/linux/release.sh b/desktop/package/linux/release.sh index 88fc7b46c8..71edf917fc 100644 --- a/desktop/package/linux/release.sh +++ b/desktop/package/linux/release.sh @@ -4,7 +4,7 @@ # Prior to running this script: # - Update version below -version=0.9.2-SNAPSHOT +version=0.9.3-SNAPSHOT base_dir=$( cd "$(dirname "$0")" ; pwd -P )/../../.. package_dir=$base_dir/desktop/package release_dir=$base_dir/desktop/release/$version diff --git a/desktop/package/macosx/Info.plist b/desktop/package/macosx/Info.plist index 6acffa170e..16e8116609 100644 --- a/desktop/package/macosx/Info.plist +++ b/desktop/package/macosx/Info.plist @@ -5,10 +5,10 @@ CFBundleVersion - 0.9.2 + 0.9.3 CFBundleShortVersionString - 0.9.2 + 0.9.3 CFBundleExecutable Bisq diff --git a/desktop/package/macosx/create_app.sh b/desktop/package/macosx/create_app.sh index 1d5c1b4735..1c20b3ce34 100755 --- a/desktop/package/macosx/create_app.sh +++ b/desktop/package/macosx/create_app.sh @@ -6,7 +6,7 @@ mkdir -p deploy set -e -version="0.9.2-SNAPSHOT" +version="0.9.3-SNAPSHOT" cd .. ./gradlew :desktop:build -x test shadowJar diff --git a/desktop/package/macosx/finalize.sh b/desktop/package/macosx/finalize.sh index e8a3b46cef..5839c53faf 100755 --- a/desktop/package/macosx/finalize.sh +++ b/desktop/package/macosx/finalize.sh @@ -2,7 +2,7 @@ cd ../../ -version="0.9.2-SNAPSHOT" +version="0.9.3-SNAPSHOT" target_dir="releases/$version" diff --git a/desktop/package/windows/package.bat b/desktop/package/windows/package.bat index 007ab67696..6798e11134 100644 --- a/desktop/package/windows/package.bat +++ b/desktop/package/windows/package.bat @@ -8,7 +8,7 @@ @echo off -set version=0.9.2-SNAPSHOT +set version=0.9.3-SNAPSHOT set package_dir=%~dp0.. for /F "tokens=1,2,3 delims=.-" %%a in ("%version%") do ( set file_version=%%a.%%b.%%c diff --git a/desktop/package/windows/release.bat b/desktop/package/windows/release.bat index 28678dd040..4d45972e65 100644 --- a/desktop/package/windows/release.bat +++ b/desktop/package/windows/release.bat @@ -6,7 +6,7 @@ @echo off -set version=0.9.2-SNAPSHOT +set version=0.9.3-SNAPSHOT set release_dir=%~dp0..\..\..\releases\%version% set package_dir=%~dp0.. diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java b/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java index 3ee09bc8c1..732e1a150a 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java @@ -29,6 +29,7 @@ import bisq.desktop.util.Layout; import bisq.core.dao.governance.asset.AssetService; import bisq.core.filter.FilterManager; import bisq.core.locale.CryptoCurrency; +import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; import bisq.core.locale.TradeCurrency; import bisq.core.payment.AccountAgeWitnessService; @@ -39,6 +40,9 @@ import bisq.core.payment.validation.AltCoinAddressValidator; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; +import bisq.asset.AltCoinAccountDisclaimer; +import bisq.asset.Asset; + import bisq.common.util.Tuple2; import bisq.common.util.Tuple3; @@ -54,6 +58,8 @@ import javafx.scene.layout.VBox; import javafx.collections.ObservableList; +import java.util.Optional; + import static bisq.desktop.util.FormBuilder.add2ButtonsAfterGroup; import static bisq.desktop.util.FormBuilder.add3ButtonsAfterGroup; import static bisq.desktop.util.FormBuilder.addTitledGroupBg; @@ -115,7 +121,6 @@ public class AltCoinAccountsView extends PaymentAccountsView().information(Res.get("account.altcoin.popup.wallet.msg", @@ -126,47 +131,14 @@ public class AltCoinAccountsView extends PaymentAccountsView().information(Res.get("account.altcoin.popup.xmr.msg")) + final Optional asset = CurrencyUtil.findAsset(selectedTradeCurrency.getCode()); + if (asset.isPresent()) { + final AltCoinAccountDisclaimer disclaimerAnnotation = asset.get().getClass().getAnnotation(AltCoinAccountDisclaimer.class); + if (disclaimerAnnotation != null) { + new Popup<>().information(Res.get(disclaimerAnnotation.value())) .useIUnderstandButton() .show(); - break; - case "BLUR": - new Popup<>().information(Res.get("account.altcoin.popup.blur.msg")) - .useIUnderstandButton() - .show(); - break; - case "CCX": - new Popup<>().information(Res.get("account.altcoin.popup.ccx.msg")) - .useIUnderstandButton() - .show(); - break; - case "DRGL": - new Popup<>().information(Res.get("account.altcoin.popup.drgl.msg")) - .useIUnderstandButton() - .show(); - break; - case "ZEC": - new Popup<>().information(Res.get("account.altcoin.popup.ZEC.msg", "ZEC")) - .useIUnderstandButton() - .show(); - break; - case "XZC": - new Popup<>().information(Res.get("account.altcoin.popup.XZC.msg", "XZC")) - .useIUnderstandButton() - .show(); - break; - case "BCHC": - new Popup<>().information(Res.get("account.altcoin.popup.bch")) - .useIUnderstandButton() - .show(); - break; - case "BTG": - new Popup<>().information(Res.get("account.altcoin.popup.btg")) - .useIUnderstandButton() - .show(); - break; + } } if (model.getPaymentAccounts().stream().noneMatch(e -> e.getAccountName() != null && diff --git a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java index 28922c2558..d6aa92ffa3 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java @@ -336,6 +336,7 @@ public class OfferBookChartView extends ActivatableViewAndModel buyMinOptional = model.getBuyData().stream() .min(Comparator.comparingDouble(o -> (double) o.getXValue())) @@ -369,6 +370,7 @@ public class OfferBookChartView extends ActivatableViewAndModel, VBox, Button, Label> getOfferTable(OfferPayload.Direction direction) { diff --git a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java index 579176b269..1b5e40005a 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java @@ -60,13 +60,10 @@ import mockit.MockUp; import mockit.Tested; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertEquals; -//TODO @Christoph Can you have a look why JMockit is nto working anymore in that module? -@Ignore public class TradesChartsViewModelTest { @Tested TradesChartsViewModel model; diff --git a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java index 4520cc7fa2..7e6195633b 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java @@ -405,7 +405,6 @@ public class OfferBookViewModelTest { assertEquals(10, model.maxPlacesForMarketPriceMargin.intValue()); //" (-10.00%)" } - @Ignore @Test public void testGetPrice() { OfferBook offerBook = mock(OfferBook.class); @@ -435,10 +434,10 @@ public class OfferBookViewModelTest { model.activate(); assertEquals("12557.2046 (1.00%)", model.getPrice(lowItem)); - assertEquals(" 10.0000 ", model.getPrice(fixedItem)); + assertEquals("10.0000", model.getPrice(fixedItem)); offerBookListItems.addAll(item); assertEquals("14206.1304 (-12.00%)", model.getPrice(item)); - assertEquals("12557.2046 (1.00%)", model.getPrice(lowItem)); + assertEquals("12557.2046 (1.00%)", model.getPrice(lowItem)); } diff --git a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java index d563d79e2c..81b86db938 100644 --- a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java +++ b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java @@ -34,7 +34,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -180,7 +179,6 @@ public class BSFormatterTest { assertEquals("0.1000 - 0.2000", formatter.formatAmount(offer, 4, true, 15)); } - @Ignore @Test public void testFormatAmountWithAlignmenWithDecimalsNoRange() { OfferPayload offerPayload = mock(OfferPayload.class); @@ -188,7 +186,7 @@ public class BSFormatterTest { when(offerPayload.getMinAmount()).thenReturn(10000000L); when(offerPayload.getAmount()).thenReturn(10000000L); - assertEquals(" 0.1000", formatter.formatAmount(offer, 4, true, 15)); + assertEquals("0.1000", formatter.formatAmount(offer, 4, true, 15)); } @Test diff --git a/relay/src/main/resources/version.txt b/relay/src/main/resources/version.txt index 2003b639c4..65f5c1516b 100644 --- a/relay/src/main/resources/version.txt +++ b/relay/src/main/resources/version.txt @@ -1 +1 @@ -0.9.2 +0.9.3-SNAPSHOT diff --git a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java index 73f8f736de..6cd2f28d60 100644 --- a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java +++ b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java @@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class SeedNodeMain extends ExecutableForAppWithP2p { - private static final String VERSION = "0.9.2"; + private static final String VERSION = "0.9.3"; private SeedNode seedNode; public SeedNodeMain() {