diff --git a/core/src/main/java/bisq/core/app/BisqSetup.java b/core/src/main/java/bisq/core/app/BisqSetup.java index 4ae7d658f6b..5f17f2d33ed 100644 --- a/core/src/main/java/bisq/core/app/BisqSetup.java +++ b/core/src/main/java/bisq/core/app/BisqSetup.java @@ -17,7 +17,9 @@ package bisq.core.app; +import bisq.core.account.sign.SignedWitness; import bisq.core.account.sign.SignedWitnessService; +import bisq.core.account.witness.AccountAgeWitness; import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.alert.Alert; import bisq.core.alert.AlertManager; @@ -43,6 +45,7 @@ import bisq.core.offer.OpenOfferManager; import bisq.core.payment.PaymentAccount; import bisq.core.payment.TradeLimits; +import bisq.core.payment.payload.PaymentMethod; import bisq.core.provider.fee.FeeService; import bisq.core.provider.price.PriceFeedService; import bisq.core.support.dispute.arbitration.ArbitrationManager; @@ -63,6 +66,7 @@ import bisq.network.crypto.EncryptionService; import bisq.network.p2p.P2PService; import bisq.network.p2p.peers.keepalive.messages.Ping; +import bisq.network.p2p.storage.payload.PersistableNetworkPayload; import bisq.common.ClockWatcher; import bisq.common.Timer; @@ -175,7 +179,8 @@ public interface BisqSetupCompleteListener { private Consumer cryptoSetupFailedHandler, chainFileLockedExceptionHandler, spvFileCorruptedHandler, lockedUpFundsHandler, daoErrorMessageHandler, daoWarnMessageHandler, filterWarningHandler, displaySecurityRecommendationHandler, displayLocalhostHandler, - wrongOSArchitectureHandler; + wrongOSArchitectureHandler, displaySignedByArbitratorHandler, + displaySignedByPeerHandler, displayPeerLimitLiftedHandler, displayPeerSignerHandler; @Setter @Nullable private Consumer displayTorNetworkSettingsHandler; @@ -339,6 +344,7 @@ private void step5() { // in MainViewModel maybeShowSecurityRecommendation(); maybeShowLocalhostRunningInfo(); + maybeShowAccountSigningStateInfo(); } @@ -579,9 +585,7 @@ private void initWallet() { if (allBasicServicesInitialized) checkForLockedUpFunds(); }, - () -> { - walletInitialized.set(true); - }); + () -> walletInitialized.set(true)); } @@ -703,9 +707,7 @@ private void initDomainServices() { voteResultService.getVoteResultExceptions().addListener((ListChangeListener) c -> { c.next(); if (c.wasAdded() && voteResultExceptionHandler != null) { - c.getAddedSubList().forEach(e -> { - voteResultExceptionHandler.accept(e); - }); + c.getAddedSubList().forEach(e -> voteResultExceptionHandler.accept(e)); } }); @@ -729,9 +731,65 @@ private void maybeShowSecurityRecommendation() { } private void maybeShowLocalhostRunningInfo() { - String key = "bitcoinLocalhostNode"; - if (bisqEnvironment.isBitcoinLocalhostNodeRunning() && preferences.showAgain(key) && - displayLocalhostHandler != null) - displayLocalhostHandler.accept(key); + maybeTriggerDisplayHandler("bitcoinLocalhostNode", displayLocalhostHandler, bisqEnvironment.isBitcoinLocalhostNodeRunning()); + } + + private void maybeShowAccountSigningStateInfo() { + String keySignedByArbitrator = "accountSignedByArbitrator"; + String keySignedByPeer = "accountSignedByPeer"; + String keyPeerLimitedLifted = "accountLimitLifted"; + String keyPeerSigner = "accountPeerSigner"; + + // check signed witness on startup + checkSigningState(AccountAgeWitnessService.SignState.ARBITRATOR, keySignedByArbitrator, displaySignedByArbitratorHandler); + checkSigningState(AccountAgeWitnessService.SignState.PEER_INITIAL, keySignedByPeer, displaySignedByPeerHandler); + checkSigningState(AccountAgeWitnessService.SignState.PEER_LIMIT_LIFTED, keyPeerLimitedLifted, displayPeerLimitLiftedHandler); + checkSigningState(AccountAgeWitnessService.SignState.PEER_SIGNER, keyPeerSigner, displayPeerSignerHandler); + + // check signed witness during runtime + p2PService.getP2PDataStorage().addAppendOnlyDataStoreListener( + payload -> { + maybeTriggerDisplayHandler(keySignedByArbitrator, displaySignedByArbitratorHandler, + isSignedWitnessOfMineWithState(payload, AccountAgeWitnessService.SignState.ARBITRATOR)); + maybeTriggerDisplayHandler(keySignedByPeer, displaySignedByPeerHandler, + isSignedWitnessOfMineWithState(payload, AccountAgeWitnessService.SignState.PEER_INITIAL)); + maybeTriggerDisplayHandler(keyPeerLimitedLifted, displayPeerLimitLiftedHandler, + isSignedWitnessOfMineWithState(payload, AccountAgeWitnessService.SignState.PEER_LIMIT_LIFTED)); + maybeTriggerDisplayHandler(keyPeerSigner, displayPeerSignerHandler, + isSignedWitnessOfMineWithState(payload, AccountAgeWitnessService.SignState.PEER_SIGNER)); + }); + } + + private void checkSigningState(AccountAgeWitnessService.SignState state, + String key, Consumer displayHandler) { + boolean signingStateFound = p2PService.getP2PDataStorage().getAppendOnlyDataStoreMap().values().stream() + .anyMatch(payload -> isSignedWitnessOfMineWithState(payload, state)); + + maybeTriggerDisplayHandler(key, displayHandler, signingStateFound); + } + + private boolean isSignedWitnessOfMineWithState(PersistableNetworkPayload payload, + AccountAgeWitnessService.SignState state) { + if (payload instanceof SignedWitness && user.getPaymentAccounts() != null) { + // We know at this point that it is already added to the signed witness list + // Check if new signed witness is for one of my own accounts + + return user.getPaymentAccounts().stream() + .filter(a -> PaymentMethod.hasChargebackRisk(a.getPaymentMethod(), a.getTradeCurrencies())) + .anyMatch(a -> { + AccountAgeWitness myWitness = accountAgeWitnessService.getMyWitness(a.getPaymentAccountPayload()); + AccountAgeWitnessService.SignState signState = accountAgeWitnessService.getSignState(myWitness); + + return (signState.equals(state)); + }); + } + return false; + } + + private void maybeTriggerDisplayHandler(String key, Consumer displayHandler, boolean signingStateFound) { + if (signingStateFound && preferences.showAgain(key) && + displayHandler != null) { + displayHandler.accept(key); + } } } diff --git a/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java b/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java index 8942e7452ca..d39787702a7 100644 --- a/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java +++ b/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java @@ -328,6 +328,10 @@ public static boolean hasChargebackRisk(PaymentMethod paymentMethod, List hasChargebackRisk(paymentMethod, tradeCurrency.getCode())); } + public static boolean hasChargebackRisk(PaymentMethod paymentMethod) { + return hasChargebackRisk(paymentMethod, CurrencyUtil.getMatureMarketCurrencies()); + } + public static boolean hasChargebackRisk(PaymentMethod paymentMethod, String currencyCode) { if (paymentMethod == null) return false; diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 49e33855035..08f3d486b2e 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -384,8 +384,9 @@ offerbook.warning.sellOfferAndAnyTakerPaymentAccountForOfferMature=This offer ca offerbook.warning.counterpartyTradeRestrictions=This offer cannot be taken due to counterparty trade restrictions -offerbook.warning.newVersionAnnouncement=We needed to deploy this restriction as a short-term measure for enhanced security.\n\n\ - The next software release will provide more robust protection tools so that offers with this risk profile can be traded again. +offerbook.warning.newVersionAnnouncement=With this version of the software trading peers can verify and sign each other to create a network of trusted accounts.\n\n\ + By trading with a peer that has already been verified your account will be signed after a successful trade as well and the limits will be lifted after a certain time frame based on the verification method.\n\n\ + For more information on account signing, please visit our documentation section on docs.bisq.network/account-signing. popup.warning.tradeLimitDueAccountAgeRestriction.seller=The allowed trade amount is limited to 0.01 BTC because of security restrictions based on the following criteria:\n\ - The buyers account was created after March 1st 2019\n\ @@ -724,7 +725,7 @@ portfolio.pending.step3_seller.onPaymentReceived.part1=Have you received the {0} # suppress inspection "TrailingSpacesInProperty" portfolio.pending.step3_seller.onPaymentReceived.fiat=The trade ID (\"reason for payment\" text) of the transaction is: \"{0}\"\n\n # suppress inspection "TrailingSpacesInProperty" -portfolio.pending.step3_seller.onPaymentReceived.name=Please also verify that the sender's name in your bank statement matches that one from the trade contract:\nSender's name: {0}\n\nIf the name is not the same as the one displayed here, please don't confirm but open a dispute by entering \"alt + o\" or \"option + o\".\n\n +portfolio.pending.step3_seller.onPaymentReceived.name=Please also verify that the sender''s name in your bank statement matches that one from the trade contract:\nSender''s name: {0}\n\nIf the name is not the same as the one displayed here, please don''t confirm but open a dispute by entering \"alt + o\" or \"option + o\".\n\n portfolio.pending.step3_seller.onPaymentReceived.note=Please note, that as soon you have confirmed the receipt, the locked trade amount will be released to the BTC buyer and the security deposit will be refunded.\n\n portfolio.pending.step3_seller.onPaymentReceived.confirm.headline=Confirm that you have received the payment portfolio.pending.step3_seller.onPaymentReceived.confirm.yes=Yes, I have received the payment @@ -1163,7 +1164,7 @@ account.arbitratorRegistration.pubKey=Public key account.arbitratorRegistration.register=Register account.arbitratorRegistration.registration={0} registration account.arbitratorRegistration.revoke=Revoke -account.arbitratorRegistration.info.msg=Please note that you need to stay available for 15 days after revoking as there might be trades which are using you as {0}}. The max. allowed trade period is 8 days and the dispute process might take up to 7 days. +account.arbitratorRegistration.info.msg=Please note that you need to stay available for 15 days after revoking as there might be trades which are using you as {0}. The max. allowed trade period is 8 days and the dispute process might take up to 7 days. account.arbitratorRegistration.warn.min1Language=You need to set at least 1 language.\nWe added the default language for you. account.arbitratorRegistration.removedSuccess=You have successfully removed your registration from the Bisq network. account.arbitratorRegistration.removedFailed=Could not remove registration.{0} @@ -2511,9 +2512,6 @@ popup.shutDownInProgress.msg=Shutting down application can take a few seconds.\n popup.attention.forTradeWithId=Attention required for trade with ID {0} -popup.roundedFiatValues.headline=New privacy feature: Rounded fiat values -popup.roundedFiatValues.msg=To increase privacy of your trade the {0} amount was rounded.\n\nDepending on the client version you''ll pay or receive either values with decimals or rounded ones.\n\nBoth values do comply from now on with the trade protocol.\n\nAlso be aware that BTC values are changed automatically to match the rounded fiat amount as close as possible. - popup.info.multiplePaymentAccounts.headline=Multiple payment accounts available popup.info.multiplePaymentAccounts.msg=You have multiple payment accounts available for this offer. Please make sure you've picked the right one. @@ -2541,6 +2539,13 @@ popup.accountSigning.signAccounts.ECKey.error=Bad arbitrator ECKey popup.accountSigning.success.headline=Congratulations popup.accountSigning.success.description=All {0} payment accounts were successfully signed! +popup.accountSigning.generalInformation=You'll find the signing state of all your accounts in the account section.\n\n\ + For further information please visit docs.bisq.network/account-signing.html. +popup.accountSigning.signedByArbitrator=One of your payment accounts has been verified and signed by an arbitrator. Trading with this account will automatically sign your trading peer''s account after a successful trade.\n\n{0} +popup.accountSigning.signedByPeer=One of your payment accounts has been verified and signed by a trading peer. Your initial limit will be lifted within 30 days from now. \ + After 60 days you are able to sign other accounts as well.\n\n{0} +popup.accountSigning.peerLimitLifted=The initial limit for one of your accounts has been lifted.\n\n{0} +popup.accountSigning.peerSigner=One of your accounts is mature enough to sign other payment accounts as well.\n\n{0} #################################################################### # Notifications diff --git a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java index b58042e59b6..c0f41460f6b 100644 --- a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java @@ -43,6 +43,7 @@ import bisq.core.app.BisqSetup; import bisq.core.btc.setup.WalletsSetup; import bisq.core.btc.wallet.BtcWalletService; +import bisq.core.locale.CryptoCurrency; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; import bisq.core.payment.AliPayAccount; @@ -56,7 +57,6 @@ import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; import bisq.network.p2p.BootstrapListener; import bisq.network.p2p.P2PService; @@ -87,6 +87,7 @@ import java.util.Comparator; import java.util.Date; +import java.util.Optional; import java.util.PriorityQueue; import java.util.Queue; import java.util.Random; @@ -119,7 +120,6 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupCompleteList @Getter private final TorNetworkSettingsWindow torNetworkSettingsWindow; private final CorruptedDatabaseFilesHandler corruptedDatabaseFilesHandler; - private final BSFormatter formatter; @Getter private BooleanProperty showAppScreen = new SimpleBooleanProperty(); @@ -158,8 +158,7 @@ public MainViewModel(BisqSetup bisqSetup, BisqEnvironment bisqEnvironment, AccountAgeWitnessService accountAgeWitnessService, TorNetworkSettingsWindow torNetworkSettingsWindow, - CorruptedDatabaseFilesHandler corruptedDatabaseFilesHandler, - BSFormatter formatter) { + CorruptedDatabaseFilesHandler corruptedDatabaseFilesHandler) { this.bisqSetup = bisqSetup; this.walletsSetup = walletsSetup; this.user = user; @@ -180,7 +179,6 @@ public MainViewModel(BisqSetup bisqSetup, this.accountAgeWitnessService = accountAgeWitnessService; this.torNetworkSettingsWindow = torNetworkSettingsWindow; this.corruptedDatabaseFilesHandler = corruptedDatabaseFilesHandler; - this.formatter = formatter; TxIdTextField.setPreferences(preferences); @@ -288,33 +286,26 @@ private void setupHandlers() { tacWindow.onAction(acceptedHandler::run).show(); }, 1)); - bisqSetup.setCryptoSetupFailedHandler(msg -> { - UserThread.execute(() -> new Popup<>().warning(msg) - .useShutDownButton() - .useReportBugButton() - .show()); - }); + bisqSetup.setCryptoSetupFailedHandler(msg -> UserThread.execute(() -> + new Popup<>().warning(msg) + .useShutDownButton() + .useReportBugButton() + .show())); bisqSetup.setDisplayTorNetworkSettingsHandler(show -> { if (show) torNetworkSettingsWindow.show(); else torNetworkSettingsWindow.hide(); }); - bisqSetup.setSpvFileCorruptedHandler(msg -> { - new Popup<>().warning(msg) - .actionButtonText(Res.get("settings.net.reSyncSPVChainButton")) - .onAction(() -> GUIUtil.reSyncSPVChain(walletsSetup, preferences)) - .show(); - }); - bisqSetup.setVoteResultExceptionHandler(voteResultException -> { - log.warn(voteResultException.toString()); - }); + bisqSetup.setSpvFileCorruptedHandler(msg -> new Popup<>().warning(msg) + .actionButtonText(Res.get("settings.net.reSyncSPVChainButton")) + .onAction(() -> GUIUtil.reSyncSPVChain(walletsSetup, preferences)) + .show()); + bisqSetup.setVoteResultExceptionHandler(voteResultException -> log.warn(voteResultException.toString())); - bisqSetup.setChainFileLockedExceptionHandler(msg -> { - new Popup<>().warning(msg) - .useShutDownButton() - .show(); - }); + bisqSetup.setChainFileLockedExceptionHandler(msg -> new Popup<>().warning(msg) + .useShutDownButton() + .show()); bisqSetup.setLockedUpFundsHandler(msg -> new Popup<>().warning(msg).show()); bisqSetup.setShowFirstPopupIfResyncSPVRequestedHandler(this::showFirstPopupIfResyncSPVRequested); bisqSetup.setRequestWalletPasswordHandler(aesKeyHandler -> walletPasswordWindow @@ -335,9 +326,7 @@ private void setupHandlers() { bisqSetup.setDisplayAlertHandler(alert -> new DisplayAlertMessageWindow() .alertMessage(alert) .closeButtonText(Res.get("shared.close")) - .onClose(() -> { - user.setDisplayedAlert(alert); - }) + .onClose(() -> user.setDisplayedAlert(alert)) .show()); bisqSetup.setDisplayPrivateNotificationHandler(privateNotification -> new Popup<>().headLine(Res.get("popup.privateNotification.headline")) @@ -361,16 +350,46 @@ private void setupHandlers() { popupQueue.add(popup); } }); + bisqSetup.setDisplaySignedByArbitratorHandler(key -> { + if (!DevEnv.isDevMode()) { + preferences.dontShowAgain(key, true); + new Popup<>().information(Res.get("popup.accountSigning.signedByArbitrator", + Res.get("popup.accountSigning.generalInformation"))) + .show(); + } + }); + bisqSetup.setDisplaySignedByPeerHandler(key -> { + if (!DevEnv.isDevMode()) { + preferences.dontShowAgain(key, true); + new Popup<>().information(Res.get("popup.accountSigning.signedByPeer", + Res.get("popup.accountSigning.generalInformation"))) + .show(); + } + }); + bisqSetup.setDisplayPeerLimitLiftedHandler(key -> { + if (!DevEnv.isDevMode()) { + preferences.dontShowAgain(key, true); + new Popup<>().information(Res.get("popup.accountSigning.peerLimitLifted", + Res.get("popup.accountSigning.generalInformation"))) + .show(); + } + }); + bisqSetup.setDisplayPeerSignerHandler(key -> { + if (!DevEnv.isDevMode()) { + preferences.dontShowAgain(key, true); + new Popup<>().information(Res.get("popup.accountSigning.peerSigner", + Res.get("popup.accountSigning.generalInformation"))) + .show(); + } + }); bisqSetup.setWrongOSArchitectureHandler(msg -> new Popup<>().warning(msg).show()); - corruptedDatabaseFilesHandler.getCorruptedDatabaseFiles().ifPresent(files -> { - new Popup<>() - .warning(Res.get("popup.warning.incompatibleDB", files.toString(), - bisqEnvironment.getProperty(AppOptionKeys.APP_DATA_DIR_KEY))) - .useShutDownButton() - .show(); - }); + corruptedDatabaseFilesHandler.getCorruptedDatabaseFiles().ifPresent(files -> new Popup<>() + .warning(Res.get("popup.warning.incompatibleDB", files.toString(), + bisqEnvironment.getProperty(AppOptionKeys.APP_DATA_DIR_KEY))) + .useShutDownButton() + .show()); tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> new Popup<>() .warning(Res.get("popup.error.takeOfferRequestFailed", errorMessage)) @@ -379,9 +398,7 @@ private void setupHandlers() { bisqSetup.getBtcSyncProgress().addListener((observable, oldValue, newValue) -> updateBtcSyncProgress()); daoPresentation.getBsqSyncProgress().addListener((observable, oldValue, newValue) -> updateBtcSyncProgress()); - bisqSetup.setFilterWarningHandler(warning -> { - new Popup<>().warning(warning).show(); - }); + bisqSetup.setFilterWarningHandler(warning -> new Popup<>().warning(warning).show()); } private void setupP2PNumPeersWatcher() { @@ -483,7 +500,9 @@ public void onUpdatedDataReceived() { cryptoCurrencyAccount.init(); cryptoCurrencyAccount.setAccountName("ETH dummy");// Don't translate only for dev cryptoCurrencyAccount.setAddress("0x" + new Random().nextInt(1000000)); - cryptoCurrencyAccount.setSingleTradeCurrency(CurrencyUtil.getCryptoCurrency("ETH").get()); + Optional eth = CurrencyUtil.getCryptoCurrency("ETH"); + eth.ifPresent(cryptoCurrencyAccount::setSingleTradeCurrency); + user.addPaymentAccount(cryptoCurrencyAccount); } } @@ -593,10 +612,6 @@ BooleanProperty getIsFiatCurrencyPriceFeedSelected() { return marketPricePresentation.getIsFiatCurrencyPriceFeedSelected(); } - BooleanProperty getIsCryptoCurrencyPriceFeedSelected() { - return marketPricePresentation.getIsCryptoCurrencyPriceFeedSelected(); - } - BooleanProperty getIsExternallyProvidedPrice() { return marketPricePresentation.getIsExternallyProvidedPrice(); } diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index 66ed1be692d..565f4311990 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -349,15 +349,6 @@ public void setCloseHandler(OfferView.CloseHandler closeHandler) { // UI actions /////////////////////////////////////////////////////////////////////////////////////////// - protected void showFiatRoundingInfoPopup() { - if (CurrencyUtil.isFiatCurrency(model.tradeCurrencyCode.get()) && !DevEnv.isDevMode()) { - new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline")) - .information(Res.get("popup.roundedFiatValues.msg", model.tradeCurrencyCode.get())) - .dontShowAgainId("FiatValuesRoundedWarning") - .show(); - } - } - private void onPlaceOffer() { if (model.getDataModel().canPlaceOffer()) { if (model.getDataModel().isMakerFeeValid()) { @@ -532,8 +523,6 @@ protected void onPaymentAccountsComboBoxSelected() { model.onPaymentAccountSelected(paymentAccount); model.onCurrencySelected(model.getDataModel().getTradeCurrency()); } - - showFiatRoundingInfoPopup(); } else { currencySelection.setVisible(false); currencySelection.setManaged(false); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java index f15b7ea20eb..46c61cd26e8 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java @@ -128,7 +128,8 @@ public class OfferBookView extends ActivatableViewAndModel currencyComboBox; private AutocompleteComboBox paymentMethodComboBox; private AutoTooltipButton createOfferButton; - private AutoTooltipTableColumn amountColumn, volumeColumn, marketColumn, priceColumn, signingStateColumn, avatarColumn; + private AutoTooltipTableColumn amountColumn, volumeColumn, marketColumn, + priceColumn, paymentMethodColumn, signingStateColumn, avatarColumn; private TableView tableView; private OfferView.OfferActionHandler offerActionHandler; @@ -220,7 +221,7 @@ public void initialize() { tableView.getColumns().add(amountColumn); volumeColumn = getVolumeColumn(); tableView.getColumns().add(volumeColumn); - TableColumn paymentMethodColumn = getPaymentMethodColumn(); + paymentMethodColumn = getPaymentMethodColumn(); tableView.getColumns().add(paymentMethodColumn); signingStateColumn = getSigningStateColumn(); tableView.getColumns().add(signingStateColumn); @@ -310,6 +311,7 @@ protected void activate() { if (paymentMethodComboBox.getEditor().getText().isEmpty()) paymentMethodComboBox.getSelectionModel().select(SHOW_ALL); model.onSetPaymentMethod(paymentMethodComboBox.getSelectionModel().getSelectedItem()); + updateSigningStateColumn(); }); if (model.showAllPaymentMethods) @@ -339,6 +341,8 @@ protected void activate() { tableView.getColumns().remove(marketColumn); } + updateSigningStateColumn(); + return null; }); @@ -353,6 +357,16 @@ protected void activate() { model.priceFeedService.updateCounterProperty().addListener(priceFeedUpdateCounterListener); } + private void updateSigningStateColumn() { + if (model.hasSelectionAccountSigning()) { + if (!tableView.getColumns().contains(signingStateColumn)) { + tableView.getColumns().add(tableView.getColumns().indexOf(paymentMethodColumn) + 1, signingStateColumn); + } + } else { + tableView.getColumns().remove(signingStateColumn); + } + } + @Override protected void deactivate() { createOfferButton.setOnAction(null); @@ -865,8 +879,8 @@ public void updateItem(final OfferBookListItem item, boolean empty) { return column; } - private TableColumn getPaymentMethodColumn() { - TableColumn column = new AutoTooltipTableColumn<>(Res.get("shared.paymentMethod")) { + private AutoTooltipTableColumn getPaymentMethodColumn() { + AutoTooltipTableColumn column = new AutoTooltipTableColumn<>(Res.get("shared.paymentMethod")) { { setMinWidth(80); } diff --git a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java index bf2bc5b8719..063820316fe 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java @@ -286,6 +286,8 @@ void onSetPaymentMethod(PaymentMethod paymentMethod) { showAllPaymentMethods = isShowAllEntry(paymentMethod.getId()); if (!showAllPaymentMethods) this.selectedPaymentMethod = paymentMethod; + else + this.selectedPaymentMethod = PaymentMethod.getDummyPaymentMethod(GUIUtil.SHOW_ALL_FLAG); applyFilterPredicate(); } @@ -567,7 +569,7 @@ boolean requireUpdateToNewVersion() { boolean isInsufficientCounterpartyTradeLimit(Offer offer) { return CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) && !accountAgeWitnessService.verifyPeersTradeAmount(offer, offer.getAmount(), errorMessage -> { - }); + }); } boolean isMyInsufficientTradeLimit(Offer offer) { @@ -608,4 +610,19 @@ int getNumTrades(Offer offer) { .collect(Collectors.toSet()) .size(); } + + public boolean hasSelectionAccountSigning() { + if (showAllTradeCurrenciesProperty.get()) { + if (!selectedPaymentMethod.getId().equals(GUIUtil.SHOW_ALL_FLAG)) { + return PaymentMethod.hasChargebackRisk(selectedPaymentMethod); + } + } else { + if (selectedPaymentMethod.getId().equals(GUIUtil.SHOW_ALL_FLAG)) + return CurrencyUtil.getMatureMarketCurrencies().stream() + .anyMatch(c -> c.getCode().equals(selectedTradeCurrency.getCode())); + else + return PaymentMethod.hasChargebackRisk(selectedPaymentMethod, tradeCurrencyCode.get()); + } + return true; + } } diff --git a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java index 6f4393db85e..ef304a71fbd 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java @@ -306,13 +306,6 @@ protected void activate() { showNextStepAfterAmountIsSet(); } - if (CurrencyUtil.isFiatCurrency(model.getOffer().getCurrencyCode()) && !DevEnv.isDevMode()) { - new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline")) - .information(Res.get("popup.roundedFiatValues.msg", model.getOffer().getCurrencyCode())) - .dontShowAgainId("FiatValuesRoundedWarning") - .show(); - } - boolean currencyForMakerFeeBtc = model.dataModel.isCurrencyForTakerFeeBtc(); tradeFeeInBtcToggle.setSelected(currencyForMakerFeeBtc); tradeFeeInBsqToggle.setSelected(!currencyForMakerFeeBtc); diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java index 8d253569c8c..99ce4e85699 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java @@ -130,11 +130,6 @@ protected void deactivate() { removeBindings(); } - @Override - protected void showFiatRoundingInfoPopup() { - // don't show it again as it was already shown when creating the offer in the first place - } - /////////////////////////////////////////////////////////////////////////////////////////// // API ///////////////////////////////////////////////////////////////////////////////////////////