From 7280fb822d05b3536eaf7134bee0502a1c6db470 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Mon, 28 Sep 2020 23:26:29 -0500 Subject: [PATCH 1/3] Add new extraMap entry for offer. If maker is seller and is a xmr offer and has autoConf enabled we set a flag ("1") --- .../java/bisq/core/offer/CreateOfferService.java | 4 +++- core/src/main/java/bisq/core/offer/OfferPayload.java | 2 ++ core/src/main/java/bisq/core/offer/OfferUtil.java | 12 +++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/bisq/core/offer/CreateOfferService.java b/core/src/main/java/bisq/core/offer/CreateOfferService.java index 739149c6142..0d2ae126beb 100644 --- a/core/src/main/java/bisq/core/offer/CreateOfferService.java +++ b/core/src/main/java/bisq/core/offer/CreateOfferService.java @@ -203,7 +203,9 @@ public Offer createAndGetOffer(String offerId, Map extraDataMap = OfferUtil.getExtraDataMap(accountAgeWitnessService, referralIdService, paymentAccount, - currencyCode); + currencyCode, + preferences, + direction); OfferUtil.validateOfferData(filterManager, p2PService, diff --git a/core/src/main/java/bisq/core/offer/OfferPayload.java b/core/src/main/java/bisq/core/offer/OfferPayload.java index 7b82506690d..5c3419835d3 100644 --- a/core/src/main/java/bisq/core/offer/OfferPayload.java +++ b/core/src/main/java/bisq/core/offer/OfferPayload.java @@ -85,6 +85,8 @@ public static protobuf.OfferPayload.Direction toProtoMessage(Direction direction // Capability.SIGNED_ACCOUNT_AGE_WITNESS is 11 and Capability.MEDIATION is 12 so if we want to signal that maker // of the offer supports both capabilities we add "11, 12" to capabilities. public static final String CAPABILITIES = "capabilities"; + // If maker is seller and has xmrAutoConf enabled it is set to "1" otherwise it is not set + public static final String XMR_AUTO_CONF = "xmrAutoConf"; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/java/bisq/core/offer/OfferUtil.java b/core/src/main/java/bisq/core/offer/OfferUtil.java index 79035cea92c..28c9b5bb4f3 100644 --- a/core/src/main/java/bisq/core/offer/OfferUtil.java +++ b/core/src/main/java/bisq/core/offer/OfferUtil.java @@ -31,6 +31,7 @@ import bisq.core.provider.price.MarketPrice; import bisq.core.provider.price.PriceFeedService; import bisq.core.trade.statistics.ReferralIdService; +import bisq.core.user.AutoConfirmSettings; import bisq.core.user.Preferences; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; @@ -333,7 +334,9 @@ private static Optional getFeeInUserFiatCurrency(Coin makerFee, boolean public static Map getExtraDataMap(AccountAgeWitnessService accountAgeWitnessService, ReferralIdService referralIdService, PaymentAccount paymentAccount, - String currencyCode) { + String currencyCode, + Preferences preferences, + OfferPayload.Direction direction) { Map extraDataMap = new HashMap<>(); if (CurrencyUtil.isFiatCurrency(currencyCode)) { String myWitnessHashAsHex = accountAgeWitnessService.getMyWitnessHashAsHex(paymentAccount.getPaymentAccountPayload()); @@ -351,6 +354,13 @@ public static Map getExtraDataMap(AccountAgeWitnessService accou extraDataMap.put(OfferPayload.CAPABILITIES, Capabilities.app.toStringList()); + if (currencyCode.equals("XMR") && direction == OfferPayload.Direction.SELL) { + preferences.getAutoConfirmSettingsList().stream() + .filter(e -> e.getCurrencyCode().equals("XMR")) + .filter(AutoConfirmSettings::isEnabled) + .forEach(e -> extraDataMap.put(OfferPayload.XMR_AUTO_CONF, "1")); + } + return extraDataMap.isEmpty() ? null : extraDataMap; } From f46e13219525e76bb422f87aa885cf6b03a7535a Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Tue, 29 Sep 2020 00:45:31 -0500 Subject: [PATCH 2/3] Add rocket icon to xmr offers which have enabled autoconf Add info to tooltip and to offer window Add center css to actions column. It looks weird that title is left aligned and button is centered. only "last-column", "avatar-column" worked, making an new style e.g. center-column did not succeed... css is not my friend.... Shorten "Time since signing" to "Signed since" header to avoid truncation --- core/src/main/java/bisq/core/offer/Offer.java | 15 +++++++++++++++ .../main/java/bisq/core/offer/OfferPayload.java | 1 + core/src/main/java/bisq/core/offer/OfferUtil.java | 2 +- .../main/resources/i18n/displayStrings.properties | 3 ++- .../main/offer/offerbook/OfferBookView.java | 8 +++++++- .../main/offer/offerbook/OfferBookViewModel.java | 7 +++++++ .../main/overlays/windows/OfferDetailsWindow.java | 14 ++++++++++++-- .../main/overlays/windows/TradeDetailsWindow.java | 2 +- 8 files changed, 46 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/bisq/core/offer/Offer.java b/core/src/main/java/bisq/core/offer/Offer.java index 6b9ded1eeb6..93bab10b419 100644 --- a/core/src/main/java/bisq/core/offer/Offer.java +++ b/core/src/main/java/bisq/core/offer/Offer.java @@ -504,6 +504,21 @@ public boolean isUseReOpenAfterAutoClose() { return offerPayload.isUseReOpenAfterAutoClose(); } + public boolean isXmrAutoConf() { + if (!isXmr()) { + return false; + } + if (getExtraDataMap() == null || !getExtraDataMap().containsKey(OfferPayload.XMR_AUTO_CONF)) { + return false; + } + + return getExtraDataMap().get(OfferPayload.XMR_AUTO_CONF).equals(OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE); + } + + public boolean isXmr() { + return getCurrencyCode().equals("XMR"); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/core/src/main/java/bisq/core/offer/OfferPayload.java b/core/src/main/java/bisq/core/offer/OfferPayload.java index 5c3419835d3..88b1690c5f1 100644 --- a/core/src/main/java/bisq/core/offer/OfferPayload.java +++ b/core/src/main/java/bisq/core/offer/OfferPayload.java @@ -87,6 +87,7 @@ public static protobuf.OfferPayload.Direction toProtoMessage(Direction direction public static final String CAPABILITIES = "capabilities"; // If maker is seller and has xmrAutoConf enabled it is set to "1" otherwise it is not set public static final String XMR_AUTO_CONF = "xmrAutoConf"; + public static final String XMR_AUTO_CONF_ENABLED_VALUE = "1"; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/java/bisq/core/offer/OfferUtil.java b/core/src/main/java/bisq/core/offer/OfferUtil.java index 28c9b5bb4f3..d5c47ae473d 100644 --- a/core/src/main/java/bisq/core/offer/OfferUtil.java +++ b/core/src/main/java/bisq/core/offer/OfferUtil.java @@ -358,7 +358,7 @@ public static Map getExtraDataMap(AccountAgeWitnessService accou preferences.getAutoConfirmSettingsList().stream() .filter(e -> e.getCurrencyCode().equals("XMR")) .filter(AutoConfirmSettings::isEnabled) - .forEach(e -> extraDataMap.put(OfferPayload.XMR_AUTO_CONF, "1")); + .forEach(e -> extraDataMap.put(OfferPayload.XMR_AUTO_CONF, OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE)); } return extraDataMap.isEmpty() ? null : extraDataMap; diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 29e839077b6..aee4ba661f7 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -338,7 +338,7 @@ offerbook.offerersAcceptedBankSeats=Accepted seat of bank countries (taker):\n { offerbook.availableOffers=Available offers offerbook.filterByCurrency=Filter by currency offerbook.filterByPaymentMethod=Filter by payment method -offerbook.timeSinceSigning=Time since signing +offerbook.timeSinceSigning=Signed since offerbook.timeSinceSigning.info=This account was verified and {0} offerbook.timeSinceSigning.info.arbitrator=signed by an arbitrator and can sign peer accounts offerbook.timeSinceSigning.info.peer=signed by a peer, waiting for limits to be lifted @@ -347,6 +347,7 @@ offerbook.timeSinceSigning.info.signer=signed by peer and can sign peer accounts offerbook.timeSinceSigning.info.banned=account was banned offerbook.timeSinceSigning.daysSinceSigning={0} days offerbook.timeSinceSigning.daysSinceSigning.long={0} since signing +offerbook.xmrAutoConf=Is auto-confirm enabled offerbook.timeSinceSigning.help=When you successfully complete a trade with a peer who has a signed payment account, your payment account is signed.\n\ {0} days later, the initial limit of {1} is lifted and your account can sign other peers'' payment accounts. 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 5753c14c0b3..c913c8e977f 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 @@ -68,6 +68,7 @@ import javax.inject.Inject; import javax.inject.Named; +import de.jensd.fx.fontawesome.AwesomeIcon; import de.jensd.fx.glyphs.GlyphIcons; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; @@ -867,7 +868,11 @@ public void updateItem(final OfferBookListItem item, boolean empty) { if (model.isOfferBanned(item.getOffer())) { setGraphic(new AutoTooltipLabel(model.getPaymentMethod(item))); } else { - field = new HyperlinkWithIcon(model.getPaymentMethod(item)); + if (item.getOffer().isXmrAutoConf()) { + field = new HyperlinkWithIcon(model.getPaymentMethod(item), AwesomeIcon.ROCKET); + } else { + field = new HyperlinkWithIcon(model.getPaymentMethod(item)); + } field.setOnAction(event -> offerDetailsWindow.show(item.getOffer())); field.setTooltip(new Tooltip(model.getPaymentMethodToolTip(item))); setGraphic(field); @@ -937,6 +942,7 @@ private TableColumn getActionColumn() { setSortable(false); } }; + column.getStyleClass().addAll("last-column", "avatar-column"); column.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); column.setCellFactory( new Callback<>() { 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 64a6eaf9c02..4f39b8742ba 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 @@ -433,6 +433,13 @@ String getPaymentMethodToolTip(OfferBookListItem item) { result = Res.getWithCol("shared.paymentMethod") + " " + Res.get(offer.getPaymentMethod().getId()); result += "\n" + Res.getWithCol("shared.currency") + " " + CurrencyUtil.getNameAndCode(offer.getCurrencyCode()); + if (offer.isXmr()) { + String isAutoConf = offer.isXmrAutoConf() ? + Res.get("shared.yes") : + Res.get("shared.no"); + result += "\n" + Res.getWithCol("offerbook.xmrAutoConf") + " " + isAutoConf; + } + String countryCode = offer.getCountryCode(); if (isF2F(offer)) { if (countryCode != null) { diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java index ed0cc10efac..63f2da1900b 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java @@ -87,7 +87,9 @@ public class OfferDetailsWindow extends Overlay { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public OfferDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, User user, KeyRing keyRing, + public OfferDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, + User user, + KeyRing keyRing, Navigation navigation) { this.formatter = formatter; this.user = user; @@ -148,7 +150,7 @@ protected void createGridPane() { private void addContent() { gridPane.getColumnConstraints().get(0).setMinWidth(224); - int rows = 5; + int rows = 6; List acceptedBanks = offer.getAcceptedBankIds(); boolean showAcceptedBanks = acceptedBanks != null && !acceptedBanks.isEmpty(); List acceptedCountryCodes = offer.getAcceptedCountryCodes(); @@ -255,6 +257,14 @@ else if (BankUtil.isBankNameRequired(countryCode)) addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), method); } } + + if (offer.isXmr()) { + String isAutoConf = offer.isXmrAutoConf() ? + Res.get("shared.yes") : + Res.get("shared.no"); + addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerbook.xmrAutoConf"), isAutoConf); + } + if (showAcceptedBanks) { if (paymentMethod.equals(PaymentMethod.SAME_BANK)) { addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.bankId"), acceptedBanks.get(0)); diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java index 1fe5f8d8258..04ddedb8a35 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java @@ -235,7 +235,7 @@ private void addContent() { addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradingPeersOnion"), trade.getTradingPeerNodeAddress().getFullAddress()); - if (checkNotNull(trade.getOffer()).getCurrencyCode().equals("XMR") && + if (checkNotNull(trade.getOffer()).isXmr() && trade.getAssetTxProofResult() != null && trade.getAssetTxProofResult() != AssetTxProofResult.UNDEFINED) { // As the window is already overloaded we replace the tradingPeersPubKeyHash field with the auto-conf state From 137d9185e31a9224507a7c20be619554785becc9 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Wed, 30 Sep 2020 00:56:40 -0500 Subject: [PATCH 3/3] Only add a row if xmr offer --- .../desktop/main/overlays/windows/OfferDetailsWindow.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java index 63f2da1900b..1d88267abe7 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java @@ -150,7 +150,7 @@ protected void createGridPane() { private void addContent() { gridPane.getColumnConstraints().get(0).setMinWidth(224); - int rows = 6; + int rows = 5; List acceptedBanks = offer.getAcceptedBankIds(); boolean showAcceptedBanks = acceptedBanks != null && !acceptedBanks.isEmpty(); List acceptedCountryCodes = offer.getAcceptedCountryCodes(); @@ -165,6 +165,10 @@ private void addContent() { if (isF2F) rows += 2; + if (offer.isXmr()) { + rows++; + } + addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("shared.Offer")); String fiatDirectionInfo = "";